diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/10-images.at | 2 | ||||
-rw-r--r-- | test/e2e/common_test.go | 7 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 17 | ||||
-rw-r--r-- | test/e2e/run_test.go | 31 |
4 files changed, 56 insertions, 1 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 7b500bf57..693c34ced 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -41,7 +41,7 @@ t GET images/$iid/json 200 \ .Id=sha256:$iid \ .RepoTags[0]=$IMAGE -t POST "images/create?fromImage=alpine" '' 200 +t POST "images/create?fromImage=alpine" '' 200 .error=null .status~".*Download complete.*" t POST "images/create?fromImage=alpine&tag=latest" '' 200 diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 53810d882..d033cc646 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -619,6 +619,13 @@ func SkipIfNotRootless(reason string) { } } +func SkipIfNotSystemd(manager, reason string) { + checkReason(reason) + if manager != "systemd" { + ginkgo.Skip("[notSystemd]: " + reason) + } +} + func SkipIfNotFedora() { info := GetHostDistributionInfo() if info.Distribution != "fedora" { diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index db3f7a36b..225bd538e 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -5,6 +5,7 @@ import ( "os" "regexp" "sort" + "strconv" "strings" . "github.com/containers/podman/v2/test/utils" @@ -210,6 +211,22 @@ var _ = Describe("Podman ps", func() { Expect(result.IsJSONOutputValid()).To(BeTrue()) }) + It("podman ps json format Created field is int64", func() { + session := podmanTest.RunTopContainer("test1") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"ps", "--format", "json"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + // Make sure Created field is an int64 + created, err := result.jq(".[0].Created") + Expect(err).To(BeNil()) + _, err = strconv.ParseInt(created, 10, 64) + Expect(err).To(BeNil()) + }) + It("podman ps print a human-readable `Status` with json format", func() { _, ec, _ := podmanTest.RunLsContainer("test1") Expect(ec).To(Equal(0)) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 934b78202..18db63c15 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1191,6 +1191,37 @@ USER mail` Expect(found).To(BeTrue()) }) + It("podman run with cgroups=split", func() { + SkipIfNotSystemd(podmanTest.CgroupManager, "do not test --cgroups=split if not running on systemd") + SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") + SkipIfRemote("--cgroups=split cannot be used in remote mode") + + container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"}) + container.WaitWithDefaultTimeout() + Expect(container.ExitCode()).To(Equal(0)) + lines := container.OutputToStringArray() + + cgroup := "" + for _, line := range lines { + parts := strings.SplitN(line, ":", 3) + if !CGROUPSV2 { + // ignore unified on cgroup v1 + // both runc and crun do not set it. + if parts[1] == "" { + continue + } + } + if parts[2] == "/" { + continue + } + if cgroup == "" { + cgroup = parts[2] + continue + } + Expect(cgroup).To(Equal(parts[2])) + } + }) + 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") |