mirror of
https://github.com/containers/podman.git
synced 2025-11-29 09:37:38 +08:00
test/e2e: delete CgV1 skips, delete tests skipped on Cgv2
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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") != ""
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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())
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user