diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/apiv2/10-images.at | 4 | ||||
| -rw-r--r-- | test/apiv2/20-containers.at | 4 | ||||
| -rw-r--r-- | test/apiv2/python/rest_api/test_v2_0_0_system.py | 13 | ||||
| -rwxr-xr-x | test/apiv2/test-apiv2 | 1 | ||||
| -rw-r--r-- | test/buildah-bud/buildah-tests.diff | 18 | ||||
| -rw-r--r-- | test/e2e/run_test.go | 30 |
6 files changed, 40 insertions, 30 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index abc8d44b7..d3fde9f9d 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -94,6 +94,10 @@ t GET libpod/images/json?filters='garb1age}' 500 \ t GET libpod/images/json?filters='{"label":["testl' 500 \ .cause="unexpected end of JSON input" +# Prune images - bad all input +t POST libpod/images/prune?all='garb1age' 500 \ + .cause="schema: error converting value for \"all\"" + # Prune images - bad filter input t POST images/prune?filters='garb1age}' 500 \ .cause="invalid character 'g' looking for beginning of value" diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 8fdecb4bd..afff68c22 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -22,6 +22,10 @@ podman run $IMAGE true t GET libpod/containers/json 200 length=0 +# bad all input +t GET libpod/containers/json?all='garb1age' 500 \ + .cause="schema: error converting value for \"all\"" + t GET libpod/containers/json?all=true 200 \ length=1 \ .[0].Id~[0-9a-f]\\{64\\} \ diff --git a/test/apiv2/python/rest_api/test_v2_0_0_system.py b/test/apiv2/python/rest_api/test_v2_0_0_system.py index 8171abb84..1140d09cf 100644 --- a/test/apiv2/python/rest_api/test_v2_0_0_system.py +++ b/test/apiv2/python/rest_api/test_v2_0_0_system.py @@ -30,13 +30,12 @@ class SystemTestCase(APITestCase): # Actor.ID is uppercase for compatibility self.assertIn("ID", obj["Actor"]) # Verify 1.22+ deprecated variants are present if current originals are - if (obj["Actor"]["ID"]): - self.assertEqual(obj["Actor"]["ID"], obj["id"]) - if (obj["Action"]): - self.assertEqual(obj["Action"], obj["status"]) - if (obj["Actor"].get("Attributes") and obj["Actor"]["Attributes"].get("image")): - self.assertEqual(obj["Actor"]["Attributes"]["image"], obj["from"]) - + if obj["Actor"]["ID"]: + self.assertEqual(obj["Actor"]["ID"], obj["id"]) + if obj["Action"]: + self.assertEqual(obj["Action"], obj["status"]) + if obj["Actor"].get("Attributes") and obj["Actor"]["Attributes"].get("image"): + self.assertEqual(obj["Actor"]["Attributes"]["image"], obj["from"]) def test_ping(self): required_headers = ( diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2 index e1bf28bae..c644b9578 100755 --- a/test/apiv2/test-apiv2 +++ b/test/apiv2/test-apiv2 @@ -327,6 +327,7 @@ function start_service() { die "Cannot start service on non-localhost ($HOST)" fi + echo $WORKDIR $PODMAN_BIN --root $WORKDIR/server_root --syslog=true \ system service \ --time 15 \ diff --git a/test/buildah-bud/buildah-tests.diff b/test/buildah-bud/buildah-tests.diff index 66d470648..bb28e11c9 100644 --- a/test/buildah-bud/buildah-tests.diff +++ b/test/buildah-bud/buildah-tests.diff @@ -1,4 +1,4 @@ -From d684753d6f00ee95720d8fb2e09c7ac19b37b01e Mon Sep 17 00:00:00 2001 +From 5baab334cac9853c1d4bae9466d46dbbe5ff7158 Mon Sep 17 00:00:00 2001 From: Ed Santiago <santiago@redhat.com> Date: Tue, 9 Feb 2021 17:28:05 -0700 Subject: [PATCH] tweaks for running buildah tests under podman @@ -9,10 +9,10 @@ Signed-off-by: Ed Santiago <santiago@redhat.com> 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/tests/helpers.bash b/tests/helpers.bash -index 11deb367..44c71dad 100644 +index 166316d5..775d7c9b 100644 --- a/tests/helpers.bash +++ b/tests/helpers.bash -@@ -34,6 +34,23 @@ function setup() { +@@ -43,6 +43,23 @@ EOF ROOTDIR_OPTS="--root ${TESTDIR}/root --runroot ${TESTDIR}/runroot --storage-driver ${STORAGE_DRIVER}" BUILDAH_REGISTRY_OPTS="--registries-conf ${TESTSDIR}/registries.conf --registries-conf-dir ${TESTDIR}/registries.d --short-name-alias-conf ${TESTDIR}/cache/shortnames.conf" PODMAN_REGISTRY_OPTS="--registries-conf ${TESTSDIR}/registries.conf" @@ -36,8 +36,8 @@ index 11deb367..44c71dad 100644 } function starthttpd() { -@@ -57,6 +74,12 @@ function stophttpd() { - function teardown() { +@@ -84,6 +101,12 @@ function teardown(){ + function teardown_tests() { stophttpd + if [[ -n "$PODMAN_SERVER_PID" ]]; then @@ -49,7 +49,7 @@ index 11deb367..44c71dad 100644 # Workaround for #1991 - buildah + overlayfs leaks mount points. # Many tests leave behind /var/tmp/.../root/overlay and sub-mounts; # let's find those and clean them up, otherwise 'rm -rf' fails. -@@ -129,7 +152,13 @@ function copy() { +@@ -156,7 +179,13 @@ function copy() { } function podman() { @@ -64,7 +64,7 @@ index 11deb367..44c71dad 100644 } ################# -@@ -164,15 +193,40 @@ function run_buildah() { +@@ -191,15 +220,40 @@ function run_buildah() { --retry) retry=3; shift;; # retry network flakes esac @@ -108,7 +108,7 @@ index 11deb367..44c71dad 100644 # without "quotes", multiple lines are glommed together into one if [ -n "$output" ]; then echo "$output" -@@ -396,3 +450,12 @@ function skip_if_no_docker() { +@@ -477,3 +531,12 @@ function skip_if_no_docker() { skip "this test needs actual docker, not podman-docker" fi } @@ -122,5 +122,5 @@ index 11deb367..44c71dad 100644 + fi +} -- -2.31.1 +2.25.1 diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 846da283d..cb61aba21 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -11,6 +11,7 @@ import ( "syscall" "time" + "github.com/containers/podman/v3/pkg/cgroups" . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" "github.com/mrunalp/fileutils" @@ -1323,35 +1324,36 @@ USER mail`, BB) }) It("podman run with cgroups=disabled runs without cgroups", func() { - SkipIfRootless("FIXME: I believe this should work but need to fix this test") SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") // Only works on crun if !strings.Contains(podmanTest.OCIRuntime, "crun") { Skip("Test only works on crun") } + ownsCgroup, err := cgroups.UserOwnsCurrentSystemdCgroup() + Expect(err).ShouldNot(HaveOccurred()) + if !ownsCgroup { + // Podman moves itself to a new cgroup if it doesn't own the current cgroup + Skip("Test only works when Podman owns the current cgroup") + } + + trim := func(i string) string { + return strings.TrimSuffix(i, "\n") + } + curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup") Expect(err).ShouldNot(HaveOccurred()) - var curCgroups = string(curCgroupsBytes) + curCgroups := trim(string(curCgroupsBytes)) fmt.Printf("Output:\n%s\n", curCgroups) Expect(curCgroups).ToNot(Equal("")) - ctrName := "testctr" - container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=disabled", ALPINE, "top"}) + container := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroups=disabled", ALPINE, "cat", "/proc/self/cgroup"}) container.WaitWithDefaultTimeout() Expect(container).Should(Exit(0)) - // Get PID and get cgroups of that PID - inspectOut := podmanTest.InspectContainer(ctrName) - Expect(len(inspectOut)).To(Equal(1)) - pid := inspectOut[0].State.Pid - Expect(pid).ToNot(Equal(0)) - Expect(inspectOut[0].HostConfig.CgroupParent).To(Equal("")) - - ctrCgroupsBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid)) - Expect(err).ShouldNot(HaveOccurred()) - var ctrCgroups = string(ctrCgroupsBytes) + ctrCgroups := trim(container.OutputToString()) fmt.Printf("Output\n:%s\n", ctrCgroups) + Expect(ctrCgroups).To(Equal(curCgroups)) }) |
