diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-06-09 06:57:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 06:57:01 -0400 |
commit | 643a692360bf769d12dc8b73acaa3481b0f07992 (patch) | |
tree | c1258a578d6126df68210c1e3edb332ef63be22a /test/apiv2/20-containers.at | |
parent | 576c739e5ff01c760b383a258c62ed3ca7e1c30c (diff) | |
parent | bce97a3b5dd1477c74232b49d246491aa289a995 (diff) | |
download | podman-643a692360bf769d12dc8b73acaa3481b0f07992.tar.gz podman-643a692360bf769d12dc8b73acaa3481b0f07992.tar.bz2 podman-643a692360bf769d12dc8b73acaa3481b0f07992.zip |
Merge pull request #14543 from edsantiago/apiv2_test_cleanup
apiv2 tests: clean up
Diffstat (limited to 'test/apiv2/20-containers.at')
-rw-r--r-- | test/apiv2/20-containers.at | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 4d32a1031..8f34b7e05 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -45,16 +45,16 @@ t GET libpod/containers/json?all=true 200 \ .[0].IsInfra=false # Test compat API for Network Settings (.Network is N/A when rootless) -network_expect= +network_expect="Networks=null" if root; then - network_expect='.[0].NetworkSettings.Networks.podman.NetworkID=podman' + network_expect="Networks.podman.NetworkID=podman" fi t GET /containers/json?all=true 200 \ length=1 \ .[0].Id~[0-9a-f]\\{64\\} \ .[0].Image=$IMAGE \ .[0].Mounts~.*/tmp \ - $network_expect + .[0].NetworkSettings.$network_expect # compat API imageid with sha256: prefix t GET containers/json?limit=1 200 \ @@ -239,11 +239,15 @@ t GET containers/$cid/json 200 \ t POST containers/create Image=$IMAGE Entrypoint='["top"]' 201 \ .Id~[0-9a-f]\\{64\\} cid_top=$(jq -r '.Id' <<<"$output") + +# Unexpected difference between /containers/json and /containers/CID/json: +# in rootless, the former returns .Networks=none, the latter .Networks={} +network_expect=${network_expect/=null/='{}'} t GET containers/${cid_top}/json 200 \ .Config.Entrypoint[0]="top" \ .Config.Cmd='[]' \ .Path="top" \ - .NetworkSettings.Networks.podman.NetworkID=podman + .NetworkSettings.$network_expect t POST containers/${cid_top}/start 204 # make sure the container is running t GET containers/${cid_top}/json 200 \ @@ -374,8 +378,13 @@ t DELETE containers/$cid?v=true 204 t POST containers/create Image=$IMAGE HostConfig='{"NetworkMode":"default"}' 201 \ .Id~[0-9a-f]\\{64\\} cid=$(jq -r '.Id' <<<"$output") +if root; then + network_type=bridge +else + network_type=slirp4netns +fi t GET containers/$cid/json 200 \ - .HostConfig.NetworkMode="bridge" + .HostConfig.NetworkMode="$network_type" t DELETE containers/$cid?v=true 204 |