mirror of
https://github.com/containers/podman.git
synced 2025-12-08 14:48:48 +08:00
Merge pull request #15384 from sstosh/options-cgroupsv1-rootless
Warning messages are printed and ignored if we use an unsupported option on cgroups V1 rootless systems
This commit is contained in:
@@ -87,6 +87,7 @@ 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(Exit(0))
|
||||
|
||||
@@ -438,6 +438,7 @@ 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"})
|
||||
@@ -452,6 +453,7 @@ 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"
|
||||
|
||||
@@ -490,6 +490,7 @@ var _ = Describe("Podman generate kube", func() {
|
||||
})
|
||||
|
||||
It("podman generate kube on pod with memory limit", func() {
|
||||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||
podName := "testMemoryLimit"
|
||||
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
|
||||
podSession.WaitWithDefaultTimeout()
|
||||
@@ -515,6 +516,7 @@ var _ = Describe("Podman generate kube", func() {
|
||||
})
|
||||
|
||||
It("podman generate kube on pod with cpu limit", func() {
|
||||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||
podName := "testCpuLimit"
|
||||
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
|
||||
podSession.WaitWithDefaultTimeout()
|
||||
|
||||
@@ -41,6 +41,7 @@ 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(Exit(0))
|
||||
@@ -51,6 +52,7 @@ 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(Exit(0))
|
||||
|
||||
@@ -56,7 +56,12 @@ echo $rand | 0 | $rand
|
||||
|
||||
@test "podman run --memory=0 runtime option" {
|
||||
run_podman run --memory=0 --rm $IMAGE echo hello
|
||||
is "$output" "hello" "failed to run when --memory is set to 0"
|
||||
if is_rootless && ! is_cgroupsv2; then
|
||||
is "${lines[0]}" "Resource limits are not supported and ignored on cgroups V1 rootless systems" "--memory is not supported"
|
||||
is "${lines[1]}" "hello" "--memory is ignored"
|
||||
else
|
||||
is "$output" "hello" "failed to run when --memory is set to 0"
|
||||
fi
|
||||
}
|
||||
|
||||
# 'run --preserve-fds' passes a number of additional file descriptors into the container
|
||||
|
||||
Reference in New Issue
Block a user