|
5 | 5 |
|
6 | 6 | load helpers
|
7 | 7 | load helpers.network
|
| 8 | +load helpers.registry |
8 | 9 |
|
9 | 10 | # This is a long ugly way to clean up pods and remove the pause image
|
10 | 11 | function teardown() {
|
@@ -934,3 +935,46 @@ spec:
|
934 | 935 | run_podman pod rm -a
|
935 | 936 | run_podman rm -a
|
936 | 937 | }
|
| 938 | + |
| 939 | +@test "podman play --build private registry" { |
| 940 | + skip_if_remote "--build is not supported in context remote" |
| 941 | + |
| 942 | + local registry=localhost:${PODMAN_LOGIN_REGISTRY_PORT} |
| 943 | + local from_image=$registry/quadlet_image_test:$(random_string) |
| 944 | + local authfile=$PODMAN_TMPDIR/authfile.json |
| 945 | + |
| 946 | + mkdir -p $PODMAN_TMPDIR/userimage |
| 947 | + cat > $PODMAN_TMPDIR/userimage/Containerfile << _EOF |
| 948 | +from $from_image |
| 949 | +USER bin |
| 950 | +_EOF |
| 951 | + |
| 952 | + # Start the registry and populate the authfile that we can use for the test. |
| 953 | + start_registry |
| 954 | + run_podman login --authfile=$authfile \ |
| 955 | + --tls-verify=false \ |
| 956 | + --username ${PODMAN_LOGIN_USER} \ |
| 957 | + --password ${PODMAN_LOGIN_PASS} \ |
| 958 | + $registry |
| 959 | + |
| 960 | + # Push the test image to the registry |
| 961 | + run_podman image tag $IMAGE $from_image |
| 962 | + run_podman image push --tls-verify=false --authfile=$authfile $from_image |
| 963 | + |
| 964 | + # Remove the local image to make sure it will be pulled again |
| 965 | + run_podman image rm --ignore $from_image |
| 966 | + |
| 967 | + _write_test_yaml command=id image=userimage |
| 968 | + run_podman 125 play kube --build --start=false $PODMAN_TMPDIR/test.yaml |
| 969 | + assert "$output" "=~" \ |
| 970 | + "Error: short-name resolution enforced but cannot prompt without a TTY|Resolving \"userimage\" using unqualified-search registries" \ |
| 971 | + "The error message does match any of the expected ones" |
| 972 | + |
| 973 | + run_podman play kube --replace --context-dir=$PODMAN_TMPDIR --tls-verify=false --authfile=$authfile --build --start=false $PODMAN_TMPDIR/test.yaml |
| 974 | + run_podman inspect --format "{{ .Config.User }}" test_pod-test |
| 975 | + is "$output" bin "expect container within pod to run as the bin user" |
| 976 | + |
| 977 | + run_podman stop -a -t 0 |
| 978 | + run_podman pod rm -t 0 -f test_pod |
| 979 | + run_podman rmi -f userimage:latest $from_image |
| 980 | +} |
0 commit comments