From 4970fd26e4115ee0f6ba9bf5155ae60c98e37ba1 Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Wed, 5 Nov 2025 09:42:08 -0500 Subject: [PATCH] test/e2e: delete CgV1 skips, delete tests skipped on Cgv2 Signed-off-by: Lokesh Mandvekar --- test/e2e/cleanup_test.go | 1 - test/e2e/common_test.go | 27 ----- test/e2e/container_clone_test.go | 3 - test/e2e/containers_conf_test.go | 7 -- test/e2e/cp_test.go | 1 - test/e2e/create_test.go | 2 - test/e2e/generate_kube_test.go | 2 - test/e2e/generate_spec_test.go | 11 +- test/e2e/info_test.go | 1 - test/e2e/kill_test.go | 1 - test/e2e/network_connect_disconnect_test.go | 2 - test/e2e/pause_test.go | 20 ++-- test/e2e/pod_create_test.go | 2 - test/e2e/pod_infra_container_test.go | 1 - test/e2e/pod_kill_test.go | 1 - test/e2e/pod_pause_test.go | 4 - test/e2e/pod_ps_test.go | 1 - test/e2e/pod_stats_test.go | 7 -- test/e2e/run_cgroup_parent_test.go | 5 - test/e2e/run_cpu_test.go | 78 +++----------- test/e2e/run_memory_test.go | 43 +------- test/e2e/run_ns_test.go | 2 - test/e2e/run_selinux_test.go | 1 - test/e2e/run_test.go | 110 ++++---------------- test/e2e/stats_test.go | 7 -- test/e2e/systemd_test.go | 4 - test/e2e/toolbox_test.go | 1 - test/e2e/update_test.go | 59 +---------- 28 files changed, 51 insertions(+), 353 deletions(-) diff --git a/test/e2e/cleanup_test.go b/test/e2e/cleanup_test.go index ed8effd509..cab7e90ba7 100644 --- a/test/e2e/cleanup_test.go +++ b/test/e2e/cleanup_test.go @@ -97,7 +97,6 @@ var _ = Describe("Podman container cleanup", func() { }) It("podman cleanup paused container", func() { - SkipIfRootlessCgroupsV1("Pause is not supported in cgroups v1") session := podmanTest.RunTopContainer("paused") session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index e5a29931d2..514167ce53 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -38,7 +38,6 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/sirupsen/logrus" - "go.podman.io/common/pkg/cgroups" "go.podman.io/common/pkg/libartifact" "go.podman.io/storage/pkg/ioutils" "go.podman.io/storage/pkg/lockfile" @@ -53,7 +52,6 @@ var ( CGROUP_MANAGER = "systemd" RESTORE_IMAGES = []string{ALPINE, BB, NGINX_IMAGE} defaultWaitTimeout = 90 - CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode() ) // PodmanTestIntegration struct for command line options @@ -1080,13 +1078,6 @@ func SkipIfRunc(p *PodmanTestIntegration, reason string) { } } -func SkipIfRootlessCgroupsV1(reason string) { - checkReason(reason) - if isRootless() && !CGROUPSV2 { - Skip("[rootless]: " + reason) - } -} - func SkipIfRootless(reason string) { checkReason(reason) if isRootless() { @@ -1179,24 +1170,6 @@ func isRootless() bool { return os.Geteuid() != 0 } -func isCgroupsV1() bool { - return !CGROUPSV2 -} - -func SkipIfCgroupV1(reason string) { - checkReason(reason) - if isCgroupsV1() { - Skip(reason) - } -} - -func SkipIfCgroupV2(reason string) { - checkReason(reason) - if CGROUPSV2 { - Skip(reason) - } -} - func isContainerized() bool { // This is set to "podman" by podman automatically return os.Getenv("container") != "" diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go index c19b27b4c4..b0379fcd1e 100644 --- a/test/e2e/container_clone_test.go +++ b/test/e2e/container_clone_test.go @@ -15,7 +15,6 @@ var _ = Describe("Podman container clone", func() { }) It("podman container clone basic test", func() { - SkipIfRootlessCgroupsV1("starting a container with the memory limits not supported") create := podmanTest.Podman([]string{"create", ALPINE}) create.WaitWithDefaultTimeout() Expect(create).To(ExitCleanly()) @@ -68,7 +67,6 @@ var _ = Describe("Podman container clone", func() { }) It("podman container clone resource limits override", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") create := podmanTest.Podman([]string{"create", "--cpus=5", ALPINE}) create.WaitWithDefaultTimeout() Expect(create).To(ExitCleanly()) @@ -143,7 +141,6 @@ var _ = Describe("Podman container clone", func() { }) It("podman container clone in a pod", func() { - SkipIfRootlessCgroupsV1("starting a container with the memory limits not supported") run := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:1234", ALPINE, "sleep", "20"}) run.WaitWithDefaultTimeout() Expect(run).To(ExitCleanly()) diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index 314c434c52..4352212f96 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -30,7 +30,6 @@ var _ = Describe("Verify podman containers.conf usage", func() { }) It("limits test", func() { - SkipIfRootlessCgroupsV1("Setting limits not supported on cgroupv1 for rootless users") // containers.conf is set to "nofile=500:500" session := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ulimit", "-n"}) session.WaitWithDefaultTimeout() @@ -56,7 +55,6 @@ var _ = Describe("Verify podman containers.conf usage", func() { }) It("oom-score-adj", func() { - SkipIfRootlessCgroupsV1("Setting limits not supported on cgroupv1 for rootless users") // containers.conf is set to "oom_score_adj=999" session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "cat", "/proc/self/oom_score_adj"}) session.WaitWithDefaultTimeout() @@ -86,9 +84,6 @@ var _ = Describe("Verify podman containers.conf usage", func() { }) It("cgroup_conf in containers.conf", func() { - if isCgroupsV1() { - Skip("Setting cgroup_confs not supported on cgroupv1") - } // FIXME: Needs crun-1.8.2-2 to allow this with --cgroup-manager=cgroupfs, once this is available remove the skip below. SkipIfRootless("--cgroup-manager=cgoupfs and --cgroup-conf not supported in rootless mode with crun") conffile := filepath.Join(podmanTest.TempDir, "container.conf") @@ -147,7 +142,6 @@ var _ = Describe("Verify podman containers.conf usage", func() { }) It("add capabilities", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1") cap := podmanTest.Podman([]string{"run", ALPINE, "grep", "CapEff", "/proc/self/status"}) cap.WaitWithDefaultTimeout() Expect(cap).Should(ExitCleanly()) @@ -193,7 +187,6 @@ var _ = Describe("Verify podman containers.conf usage", func() { }) verifyNSHandling := func(nspath, option string) { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") os.Setenv("CONTAINERS_CONF", "config/containers-ns.conf") if IsRemote() { podmanTest.RestartRemoteService() diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go index 3000a54ee0..584677fdda 100644 --- a/test/e2e/cp_test.go +++ b/test/e2e/cp_test.go @@ -72,7 +72,6 @@ var _ = Describe("Podman cp", func() { // Copy a file to the container, then back to the host in --pid=host It("podman cp --pid=host file", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") srcFile, err := os.CreateTemp("", "") Expect(err).ToNot(HaveOccurred()) defer srcFile.Close() diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 4eb42140de..32de6cdccb 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -426,7 +426,6 @@ var _ = Describe("Podman create", func() { }) It("podman create with -m 1000000 sets swap to 2000000", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") numMem := 1000000 ctrName := "testCtr" session := podmanTest.Podman([]string{"create", "-t", "-m", fmt.Sprintf("%db", numMem), "--name", ctrName, ALPINE, "/bin/sh"}) @@ -441,7 +440,6 @@ var _ = Describe("Podman create", func() { }) It("podman create --cpus 5 sets nanocpus", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") numCpus := 5 nanoCPUs := numCpus * 1000000000 ctrName := "testCtr" diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index bc3fd5fe4e..76f0efb73f 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -609,7 +609,6 @@ var _ = Describe("Podman kube generate", func() { }) It("on pod with memory limit", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") podName := "testMemoryLimit" podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName}) podSession.WaitWithDefaultTimeout() @@ -635,7 +634,6 @@ var _ = Describe("Podman kube generate", func() { }) It("on pod with cpu limit", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") podName := "testCpuLimit" podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName}) podSession.WaitWithDefaultTimeout() diff --git a/test/e2e/generate_spec_test.go b/test/e2e/generate_spec_test.go index aebb364913..b68d850dc2 100644 --- a/test/e2e/generate_spec_test.go +++ b/test/e2e/generate_spec_test.go @@ -8,7 +8,6 @@ import ( . "github.com/containers/podman/v6/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman generate spec", func() { @@ -23,7 +22,6 @@ var _ = Describe("Podman generate spec", func() { }) It("podman generate spec basic usage", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") session := podmanTest.Podman([]string{"create", "--cpus", "5", "--name", "specgen", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -34,7 +32,6 @@ var _ = Describe("Podman generate spec", func() { }) It("podman generate spec file", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") session := podmanTest.Podman([]string{"create", "--cpus", "5", "--name", "specgen", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -58,12 +55,6 @@ var _ = Describe("Podman generate spec", func() { session = podmanTest.Podman([]string{"generate", "spec", "--compact", "podspecgen"}) session.WaitWithDefaultTimeout() - - if isRootless() && !CGROUPSV2 { - Expect(session).Should(Exit(0)) - Expect(session.ErrorToString()).Should(ContainSubstring("Resource limits are not supported and ignored on cgroups V1 rootless")) - } else { - Expect(session).Should(ExitCleanly()) - } + Expect(session).Should(ExitCleanly()) }) }) diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index b4823a4c77..73b14ec0fa 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -133,7 +133,6 @@ var _ = Describe("Podman Info", func() { It("Podman info must contain cgroupControllers with RelevantControllers", func() { SkipIfRootless("Hard to tell which controllers are going to be enabled for rootless") - SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") session := podmanTest.Podman([]string{"info", "--format", "{{.Host.CgroupControllers}}"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitCleanly()) diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go index 7c8a4a7f8d..10e72ace59 100644 --- a/test/e2e/kill_test.go +++ b/test/e2e/kill_test.go @@ -107,7 +107,6 @@ var _ = Describe("Podman kill", func() { }) It("podman kill paused container", func() { - SkipIfRootlessCgroupsV1("pause is not supported for cgroupv1 rootless") ctrName := "testctr" session := podmanTest.RunTopContainer(ctrName) session.WaitWithDefaultTimeout() diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go index 301f6b8202..9113fc4522 100644 --- a/test/e2e/network_connect_disconnect_test.go +++ b/test/e2e/network_connect_disconnect_test.go @@ -49,7 +49,6 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("podman network disconnect", func() { - SkipIfRootlessCgroupsV1("stats not supported under rootless CgroupsV1") netName := "aliasTest" + stringid.GenerateRandomID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() @@ -170,7 +169,6 @@ var _ = Describe("Podman network connect and disconnect", func() { }) It("podman network connect", func() { - SkipIfRootlessCgroupsV1("stats not supported under rootless CgroupsV1") netName := "aliasTest" + stringid.GenerateRandomID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index c70b6f9583..5f608fd923 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -18,19 +18,15 @@ var _ = Describe("Podman pause", func() { createdState := "created" BeforeEach(func() { - SkipIfRootlessCgroupsV1("Pause is not supported in cgroups v1") + b, err := os.ReadFile("/proc/self/cgroup") + if err != nil { + Skip("cannot read self cgroup") + } - if CGROUPSV2 { - b, err := os.ReadFile("/proc/self/cgroup") - if err != nil { - Skip("cannot read self cgroup") - } - - path := filepath.Join("/sys/fs/cgroup", strings.TrimSuffix(strings.Replace(string(b), "0::", "", 1), "\n"), "cgroup.freeze") - _, err = os.Stat(path) - if err != nil { - Skip("freezer controller not available on the current kernel") - } + path := filepath.Join("/sys/fs/cgroup", strings.TrimSuffix(strings.Replace(string(b), "0::", "", 1), "\n"), "cgroup.freeze") + _, err = os.Stat(path) + if err != nil { + Skip("freezer controller not available on the current kernel") } }) diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 60b0677351..9eab96fafb 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -1192,8 +1192,6 @@ ENTRYPOINT ["sleep","99999"] }) It("podman pod create --share-parent test", func() { - SkipIfRootlessCgroupsV1("rootless cannot use cgroups with cgroupsv1") - SkipIfCgroupV1("CgroupMode shows 'host' on CGv1, not CID (issue 15013, wontfix") podCreate := podmanTest.Podman([]string{"pod", "create", "--share-parent=false"}) podCreate.WaitWithDefaultTimeout() Expect(podCreate).Should(ExitCleanly()) diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go index c4ec7634fa..6aee04d707 100644 --- a/test/e2e/pod_infra_container_test.go +++ b/test/e2e/pod_infra_container_test.go @@ -225,7 +225,6 @@ var _ = Describe("Podman pod create", func() { }) It("podman pod container can override pod pid NS", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") session := podmanTest.Podman([]string{"pod", "create", "--share", "pid"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 83f2d6a470..052badae17 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -107,7 +107,6 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill all", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go index b7eefc8d01..98d2caaf98 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -11,10 +11,6 @@ import ( var _ = Describe("Podman pod pause", func() { pausedState := "Paused" - BeforeEach(func() { - SkipIfRootlessCgroupsV1("Pause is not supported in cgroups v1") - }) - It("podman pod pause bogus pod", func() { session := podmanTest.Podman([]string{"pod", "pause", "foobar"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index fd8b2c2c5a..745307a394 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -155,7 +155,6 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps --ctr-names", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index c6054ac794..211944d674 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -9,13 +9,6 @@ import ( ) var _ = Describe("Podman pod stats", func() { - BeforeEach(func() { - SkipIfRootlessCgroupsV1("Tests fail with both CGv1 + required --cgroup-manager=cgroupfs") - if isContainerized() { - SkipIfCgroupV1("All tests fail Error: unable to load cgroup at ...: cgroup deleted") - } - }) - It("podman pod stats should run with no pods", func() { session := podmanTest.Podman([]string{"pod", "stats", "--no-stream"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go index 50c9376cce..015eb6b655 100644 --- a/test/e2e/run_cgroup_parent_test.go +++ b/test/e2e/run_cgroup_parent_test.go @@ -16,10 +16,6 @@ import ( const cgroupRoot = "/sys/fs/cgroup" var _ = Describe("Podman run with --cgroup-parent", func() { - BeforeEach(func() { - SkipIfRootlessCgroupsV1("cgroup parent is not supported in cgroups v1") - }) - Specify("valid --cgroup-parent using cgroupfs", func() { if !Containerized() { Skip("Must be containerized to run this test.") @@ -47,7 +43,6 @@ var _ = Describe("Podman run with --cgroup-parent", func() { }) Specify("always honor --cgroup-parent", func() { - SkipIfCgroupV1("test not supported in cgroups v1") if Containerized() || podmanTest.CgroupManager == "cgroupfs" { Skip("Requires Systemd cgroup manager support") } diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go index aa76aa9b63..448214df3b 100644 --- a/test/e2e/run_cpu_test.go +++ b/test/e2e/run_cpu_test.go @@ -13,95 +13,49 @@ import ( var _ = Describe("Podman run cpu", func() { BeforeEach(func() { - SkipIfRootlessCgroupsV1("Setting CPU not supported on cgroupv1 for rootless users") - - if CGROUPSV2 { - if err := os.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+cpuset"), 0o644); err != nil { - Skip("cpuset controller not available on the current kernel") - } + if err := os.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+cpuset"), 0o644); err != nil { + Skip("cpuset controller not available on the current kernel") } }) It("podman run cpu-period", func() { - var result *PodmanSessionIntegration - if CGROUPSV2 { - result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) - } else { - result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"}) - } + result := podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) Expect(result.OutputToString()).To(ContainSubstring("5000")) }) It("podman run cpu-quota", func() { - var result *PodmanSessionIntegration - - if CGROUPSV2 { - result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) - } else { - result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}) - } + result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) Expect(result.OutputToString()).To(ContainSubstring("5000")) }) It("podman run cpus", func() { - if CGROUPSV2 { - result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) - result.WaitWithDefaultTimeout() - Expect(result).Should(ExitCleanly()) - Expect(result.OutputToString()).To(Equal("5000 100000")) - } else { - result := podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"}) - result.WaitWithDefaultTimeout() - Expect(result).Should(ExitCleanly()) - Expect(result.OutputToString()).To(Equal("100000")) - - result = podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}) - result.WaitWithDefaultTimeout() - Expect(result).Should(ExitCleanly()) - Expect(result.OutputToString()).To(Equal("50000")) - } + result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(ExitCleanly()) + Expect(result.OutputToString()).To(Equal("5000 100000")) }) It("podman run cpu-shares", func() { - if CGROUPSV2 { - // [2-262144] is mapped to [1-10000] - result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"}) - result.WaitWithDefaultTimeout() - Expect(result).Should(ExitCleanly()) - Expect(result.OutputToString()).To(Equal("10000")) - } else { - result := podmanTest.Podman([]string{"run", "--rm", "-c", "2", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.shares"}) - result.WaitWithDefaultTimeout() - Expect(result).Should(ExitCleanly()) - Expect(result.OutputToString()).To(Equal("2")) - } + // [2-262144] is mapped to [1-10000] + result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(ExitCleanly()) + Expect(result.OutputToString()).To(Equal("10000")) }) It("podman run cpuset-cpus", func() { - var result *PodmanSessionIntegration - - if CGROUPSV2 { - result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.cpus.effective"}) - } else { - result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"}) - } + result := podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.cpus.effective"}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) Expect(result.OutputToString()).To(Equal("0")) }) It("podman run cpuset-mems", func() { - var result *PodmanSessionIntegration - - if CGROUPSV2 { - result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.mems.effective"}) - } else { - result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"}) - } + result := podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.mems.effective"}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) Expect(result.OutputToString()).To(Equal("0")) @@ -120,7 +74,6 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run invalid cpu-rt-period with cgroupsv2", func() { - SkipIfCgroupV1("testing options that only work in cgroup v2") result := podmanTest.Podman([]string{"run", "--rm", "--cpu-rt-period=5000", ALPINE, "ls"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) @@ -128,7 +81,6 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run invalid cpu-rt-runtime with cgroupsv2", func() { - SkipIfCgroupV1("testing options that only work in cgroup v2") result := podmanTest.Podman([]string{"run", "--rm", "--cpu-rt-runtime=5000", ALPINE, "ls"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go index ba821589a3..1723042043 100644 --- a/test/e2e/run_memory_test.go +++ b/test/e2e/run_memory_test.go @@ -3,40 +3,21 @@ package integration import ( - "fmt" - . "github.com/containers/podman/v6/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) var _ = Describe("Podman run memory", func() { - BeforeEach(func() { - SkipIfRootlessCgroupsV1("Setting Memory not supported on cgroupv1 for rootless users") - }) - It("podman run memory test", func() { - var session *PodmanSessionIntegration - - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--memory=40m", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.max"}) - } else { - session = podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"}) - } + session := podmanTest.Podman([]string{"run", "--memory=40m", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.max"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("41943040")) }) It("podman run memory-reservation test", func() { - var session *PodmanSessionIntegration - - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.low"}) - } else { - session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"}) - } - + session := podmanTest.Podman([]string{"run", "--memory-reservation=40m", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.low"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("41943040")) @@ -48,29 +29,13 @@ var _ = Describe("Podman run memory", func() { expect string ) - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--memory=20m", "--memory-swap=30M", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.swap.max"}) - expect = "10485760" - } else { - session = podmanTest.Podman([]string{"run", "--memory=20m", "--memory-swap=30M", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"}) - expect = "31457280" - } + session = podmanTest.Podman([]string{"run", "--memory=20m", "--memory-swap=30M", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.swap.max"}) + expect = "10485760" session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal(expect)) }) - for _, limit := range []string{"0", "15", "100"} { - testName := fmt.Sprintf("podman run memory-swappiness test(%s)", limit) - It(testName, func() { - SkipIfCgroupV2("memory-swappiness not supported on cgroupV2") - session := podmanTest.Podman([]string{"run", fmt.Sprintf("--memory-swappiness=%s", limit), ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - Expect(session.OutputToString()).To(Equal(limit)) - }) - } - It("podman run memory test on oomkilled container", func() { mem := SystemExec("cat", []string{"/proc/sys/vm/overcommit_memory"}) mem.WaitWithDefaultTimeout() diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go index 1882b7d2ad..c395950d0b 100644 --- a/test/e2e/run_ns_test.go +++ b/test/e2e/run_ns_test.go @@ -13,7 +13,6 @@ import ( var _ = Describe("Podman run ns", func() { It("podman run pidns test", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") session := podmanTest.Podman([]string{"run", fedoraMinimal, "bash", "-c", "echo $$"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -92,7 +91,6 @@ var _ = Describe("Podman run ns", func() { }) It("podman run --ipc=host --pid=host", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") cmd := exec.Command("ls", "-l", "/proc/self/ns/pid") res, err := cmd.Output() Expect(err).ToNot(HaveOccurred()) diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go index 5752ec02fd..c89cbc338a 100644 --- a/test/e2e/run_selinux_test.go +++ b/test/e2e/run_selinux_test.go @@ -239,7 +239,6 @@ var _ = Describe("Podman run", func() { }) It("podman test --pid=host", func() { - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") session := podmanTest.Podman([]string{"run", "--pid=host", ALPINE, "cat", "/proc/self/attr/current"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index b80ef3332f..cbb8dd5dd9 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -3,7 +3,9 @@ package integration import ( + "errors" "fmt" + "io/fs" "net" "os" "path/filepath" @@ -523,7 +525,6 @@ var _ = Describe("Podman run", func() { }) It("podman run security-opt unmask on /sys/fs/cgroup", func() { - SkipIfCgroupV1("podman umask on /sys/fs/cgroup will fail with cgroups V1") SkipIfRootless("/sys/fs/cgroup rw access is needed") rwOnCgroups := "/sys/fs/cgroup cgroup2 rw" session := podmanTest.Podman([]string{"run", "--security-opt", "unmask=ALL", "--security-opt", "mask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"}) @@ -734,8 +735,6 @@ USER bin`, BB) }) It("podman run limits test", func() { - SkipIfRootlessCgroupsV1("Setting limits not supported on cgroupv1 for rootless users") - if !isRootless() { session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "rtprio=99", "--cap-add=sys_nice", fedoraMinimal, "cat", "/proc/self/sched"}) session.WaitWithDefaultTimeout() @@ -752,13 +751,6 @@ USER bin`, BB) Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(ContainSubstring("1024")) - if !CGROUPSV2 { - // --oom-kill-disable not supported on cgroups v2. - session = podmanTest.Podman([]string{"run", "--rm", "--oom-kill-disable=true", fedoraMinimal, "echo", "memory-hog"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - } - session = podmanTest.Podman([]string{"run", "--rm", "--oom-score-adj=999", fedoraMinimal, "cat", "/proc/self/oom_score_adj"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -833,106 +825,60 @@ USER bin`, BB) }) It("podman run blkio-weight test", func() { - SkipIfRootlessCgroupsV1("Setting blkio-weight not supported on cgroupv1 for rootless users") SkipIfRootless("By default systemd doesn't delegate io to rootless users") - if CGROUPSV2 { - if _, err := os.Stat("/sys/fs/cgroup/io.stat"); os.IsNotExist(err) { - Skip("Kernel does not have io.stat") - } - if _, err := os.Stat("/sys/fs/cgroup/system.slice/io.bfq.weight"); os.IsNotExist(err) { - Skip("Kernel does not support BFQ IO scheduler") - } - session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - // there was a documentation issue in the kernel that reported a different range [1-10000] for the io controller. - // older versions of crun/runc used it. For the time being allow both versions to pass the test. - // FIXME: drop "|51" once all the runtimes we test have the fix in place. - Expect(strings.Replace(session.OutputToString(), "default ", "", 1)).To(MatchRegexp("15|51")) - } else { - if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) { - Skip("Kernel does not support blkio.weight") - } - session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.weight"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - Expect(session.OutputToString()).To(ContainSubstring("15")) + if _, err := os.Stat("/sys/fs/cgroup/io.stat"); errors.Is(err, fs.ErrNotExist) { + Skip("Kernel does not have io.stat") } + if _, err := os.Stat("/sys/fs/cgroup/system.slice/io.bfq.weight"); errors.Is(err, fs.ErrNotExist) { + Skip("Kernel does not support BFQ IO scheduler") + } + session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(ExitCleanly()) + // there was a documentation issue in the kernel that reported a different range [1-10000] for the io controller. + // older versions of crun/runc used it. For the time being allow both versions to pass the test. + // FIXME: drop "|51" once all the runtimes we test have the fix in place. + Expect(strings.Replace(session.OutputToString(), "default ", "", 1)).To(MatchRegexp("15|51")) }) It("podman run device-read-bps test", func() { SkipIfRootless("Setting device-read-bps not supported for rootless users") skipWithoutDevNullb0() - var session *PodmanSessionIntegration - - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--rm", "--device-read-bps=/dev/nullb0:1mb", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) - } else { - session = podmanTest.Podman([]string{"run", "--rm", "--device-read-bps=/dev/nullb0:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.read_bps_device"}) - } - + session := podmanTest.Podman([]string{"run", "--rm", "--device-read-bps=/dev/nullb0:1mb", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 - Expect(session.OutputToString()).To(ContainSubstring("1048576")) - } + // FIXME: https://github.com/containers/podman/commit/9b9789c207d8b84ee37e9c37c613879369a8690c }) It("podman run device-write-bps test", func() { SkipIfRootless("Setting device-write-bps not supported for rootless users") skipWithoutDevNullb0() - var session *PodmanSessionIntegration - - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/nullb0:1mb", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) - } else { - session = podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/nullb0:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_bps_device"}) - } + session := podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/nullb0:1mb", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 - Expect(session.OutputToString()).To(ContainSubstring("1048576")) - } + // FIXME: https://github.com/containers/podman/commit/9b9789c207d8b84ee37e9c37c613879369a8690c }) It("podman run device-read-iops test", func() { SkipIfRootless("Setting device-read-iops not supported for rootless users") skipWithoutDevNullb0() - var session *PodmanSessionIntegration - - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--rm", "--device-read-iops=/dev/nullb0:100", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) - } else { - session = podmanTest.Podman([]string{"run", "--rm", "--device-read-iops=/dev/nullb0:100", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.read_iops_device"}) - } - + session := podmanTest.Podman([]string{"run", "--rm", "--device-read-iops=/dev/nullb0:100", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 - Expect(session.OutputToString()).To(ContainSubstring("100")) - } + // FIXME: https://github.com/containers/podman/commit/9b9789c207d8b84ee37e9c37c613879369a8690c }) It("podman run device-write-iops test", func() { SkipIfRootless("Setting device-write-iops not supported for rootless users") skipWithoutDevNullb0() - var session *PodmanSessionIntegration - - if CGROUPSV2 { - session = podmanTest.Podman([]string{"run", "--rm", "--device-write-iops=/dev/nullb0:100", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) - } else { - session = podmanTest.Podman([]string{"run", "--rm", "--device-write-iops=/dev/nullb0:100", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_iops_device"}) - } - + session := podmanTest.Podman([]string{"run", "--rm", "--device-write-iops=/dev/nullb0:100", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.max"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 - Expect(session.OutputToString()).To(ContainSubstring("100")) - } + // FIXME: https://github.com/containers/podman/commit/9b9789c207d8b84ee37e9c37c613879369a8690c }) It("podman run notify_socket", func() { @@ -1734,7 +1680,6 @@ VOLUME %s`, ALPINE, volPath, volPath) 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") checkLines := func(lines []string) { @@ -1744,14 +1689,6 @@ VOLUME %s`, ALPINE, volPath, volPath) if len(parts) < 2 { continue } - if !CGROUPSV2 { - // ignore unified on cgroup v1. - // both runc and crun do not set it. - // crun does not set named hierarchies. - if parts[1] == "" || strings.Contains(parts[1], "name=") { - continue - } - } if parts[2] == "/" { continue } @@ -1788,7 +1725,6 @@ VOLUME %s`, ALPINE, volPath, volPath) }) It("podman run with cgroups=disabled runs without cgroups", func() { - 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") @@ -1822,7 +1758,6 @@ VOLUME %s`, ALPINE, volPath, volPath) }) It("podman run with cgroups=enabled makes cgroups", func() { - SkipIfRootlessCgroupsV1("Enable cgroups not supported on cgroupv1 for rootless users") // Only works on crun if !strings.Contains(podmanTest.OCIRuntime, "crun") { Skip("Test only works on crun") @@ -1970,7 +1905,6 @@ VOLUME %s`, ALPINE, volPath, volPath) }) It("podman run verify pids-limit", func() { - SkipIfCgroupV1("pids-limit not supported on cgroup V1") limit := "4321" session := podmanTest.Podman([]string{"run", "--pids-limit", limit, "--net=none", "--rm", ALPINE, "cat", "/sys/fs/cgroup/pids.max"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index c87c6dfd06..c569ecd313 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -15,13 +15,6 @@ import ( // TODO: we need to check the output. Currently, we only check the exit codes // which is not enough. var _ = Describe("Podman stats", func() { - BeforeEach(func() { - SkipIfRootlessCgroupsV1("stats not supported on cgroupv1 for rootless users") - if isContainerized() { - SkipIfCgroupV1("stats not supported inside cgroupv1 container environment") - } - }) - It("podman stats with bogus container", func() { session := podmanTest.Podman([]string{"stats", "--no-stream", "123"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go index f8d15e12fb..f1c40c6cb7 100644 --- a/test/e2e/systemd_test.go +++ b/test/e2e/systemd_test.go @@ -41,10 +41,6 @@ var _ = Describe("Podman systemd", func() { Expect(conData).To(HaveLen(1)) Expect(conData[0].Config).To(HaveField("SystemdMode", true)) - // stats not supported w/ CGv1 rootless or containerized - if isCgroupsV1() && (isRootless() || isContainerized()) { - return - } stats := podmanTest.Podman([]string{"stats", "--no-stream", ctrName}) stats.WaitWithDefaultTimeout() Expect(stats).Should(ExitCleanly()) diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index 49eadd3d7b..1707c9db3d 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -109,7 +109,6 @@ var _ = Describe("Toolbox-specific testing", func() { if podmanTest.RemoteTest { Skip("Shm size check does not work with a remote client") } - SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1") var session *PodmanSessionIntegration var cmd *exec.Cmd var hostShmSize, containerShmSize int diff --git a/test/e2e/update_test.go b/test/e2e/update_test.go index c86782cc2a..433919f473 100644 --- a/test/e2e/update_test.go +++ b/test/e2e/update_test.go @@ -7,61 +7,11 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" - "go.podman.io/common/pkg/cgroupv2" "go.podman.io/storage/pkg/fileutils" ) var _ = Describe("Podman update", func() { - It("podman update container all options v1", func() { - SkipIfCgroupV2("testing flags that only work in cgroup v1") - SkipIfRootless("many of these handlers are not enabled while rootless in CI") - session := podmanTest.Podman([]string{"run", "-dt", ALPINE}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - - ctrID := session.OutputToString() - - commonArgs := []string{ - "update", - "--cpus", "5", - "--cpuset-cpus", "0", - "--cpu-shares", "123", - "--cpuset-mems", "0", - "--memory", "1G", - "--memory-swap", "2G", - "--memory-reservation", "2G", - "--memory-swappiness", "50", - "--pids-limit", "123", ctrID, - } - - session = podmanTest.Podman(commonArgs) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - - // checking cpu quota from --cpus - podmanTest.CheckFileInContainerSubstring(ctrID, "/sys/fs/cgroup/cpu/cpu.cfs_quota_us", "500000") - - // checking cpuset-cpus - podmanTest.CheckFileInContainer(ctrID, "/sys/fs/cgroup/cpuset/cpuset.cpus", "0") - - // checking cpuset-mems - podmanTest.CheckFileInContainer(ctrID, "/sys/fs/cgroup/cpuset/cpuset.mems", "0") - - // checking memory limit - podmanTest.CheckFileInContainerSubstring(ctrID, "/sys/fs/cgroup/memory/memory.limit_in_bytes", "1073741824") - - // checking memory-swap - podmanTest.CheckFileInContainerSubstring(ctrID, "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes", "2147483648") - - // checking cpu-shares - podmanTest.CheckFileInContainerSubstring(ctrID, "/sys/fs/cgroup/cpu/cpu.shares", "123") - - // checking pids-limit - podmanTest.CheckFileInContainerSubstring(ctrID, "/sys/fs/cgroup/pids/pids.max", "123") - }) - It("podman update container unspecified pid limit", func() { - SkipIfCgroupV1("testing flags that only work in cgroup v2") SkipIfRootless("many of these handlers are not enabled while rootless in CI") session := podmanTest.Podman([]string{"run", "-dt", "--pids-limit", "-1", ALPINE}) session.WaitWithDefaultTimeout() @@ -86,7 +36,6 @@ var _ = Describe("Podman update", func() { }) It("podman update container all options v2", func() { - SkipIfCgroupV1("testing flags that only work in cgroup v2") SkipIfRootless("many of these handlers are not enabled while rootless in CI") skipWithoutDevNullb0() session := podmanTest.Podman([]string{"run", "-dt", ALPINE}) @@ -167,16 +116,10 @@ var _ = Describe("Podman update", func() { ctrID := session.OutputToString() - path := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us" - if v2, _ := cgroupv2.Enabled(); v2 { - path = "/sys/fs/cgroup/cpu.max" - } - - podmanTest.CheckFileInContainerSubstring(ctrID, path, "500000") + podmanTest.CheckFileInContainerSubstring(ctrID, "/sys/fs/cgroup/cpu.max", "500000") }) It("podman update persists changes", func() { - SkipIfCgroupV1("testing flags that only work in cgroup v2") SkipIfRootless("many of these handlers are not enabled while rootless in CI") memoryInspect := ".HostConfig.Memory"