From 5614c29ce1132ac8ee05687910248134d0f5c766 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 9 Jun 2022 15:31:26 +0200 Subject: compat api: fix regressions from "Swagger refactor/cleanup" For some reason commit 5b79cf15a022 moved the container create options parsing from cmd/podman/common to pkg/api/handlers. However it did not remove the old code. Unfortunately it moved the code from an outdated version and did not update it before this commit was merged. Therefore a couple of regressions were introduced. I manually compared both versions and found three missing bugfixes. I fixed the network test again that was changed in bce97a3b5dd1. We want bridge as default even as rootless. Sine the test is not run as rootless in CI the regression was not caught. Also the no hosts test never worked since it was missing the import check if the hosts file exists. I don't think we can check for the volume parsing change since this only works on windows/wsl. Signed-off-by: Paul Holzinger --- test/apiv2/20-containers.at | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 8f34b7e05..383c527b4 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -240,14 +240,11 @@ 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.$network_expect + .NetworkSettings.Networks.podman.NetworkID=podman t POST containers/${cid_top}/start 204 # make sure the container is running t GET containers/${cid_top}/json 200 \ @@ -378,13 +375,8 @@ 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="$network_type" + .HostConfig.NetworkMode="bridge" t DELETE containers/$cid?v=true 204 @@ -486,7 +478,8 @@ for endpoint in containers/create libpod/containers/create; do t POST libpod/containers/$cid/init 204 - t GET libpod/containers/$cid/json 200 + t GET libpod/containers/$cid/json 200 \ + .HostsPath="" t DELETE containers/$cid 204 done -- cgit v1.2.3-54-g00ecf