Skip to content

Commit 9530fcb

Browse files
committed
test: remove cgroupsv1 tests and skips
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent e10e923 commit 9530fcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+104
-531
lines changed

test/apiv2/25-containersMore.at

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ if root || have_cgroupsv2; then
2828
.Name=foo
2929

3030
t POST libpod/containers/foo/unpause 204
31-
else
32-
# cgroupsv1 rootless : pause and unpause are not supported in cgroups v1 rootless
33-
t POST libpod/containers/foo/pause 500 \
34-
.cause="this container does not have a cgroup" \
35-
.message~".*pause containers on rootless containers with cgroup V1"
36-
37-
t POST libpod/containers/foo/unpause 500 \
38-
.cause="container state improper" \
39-
.message~".*is not paused, can't unpause: container state improper"
4031
fi
4132

4233
t GET libpod/containers/foo/json 200 \

test/apiv2/40-pods.at

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,7 @@ t POST libpod/pods/fakename/start 404 \
4747
.cause="no such pod" \
4848
.message="no pod with name or ID fakename found: no such pod"
4949

50-
if root || have_cgroupsv2; then
51-
t POST libpod/pods/foo/pause 200
52-
else
53-
# Rootless cgroupsv1 : unsupported
54-
t POST "libpod/pods/foo/pause (rootless cgroups v1)" 500 \
55-
.cause="this container does not have a cgroup" \
56-
.message~".*pause pods containing rootless containers with cgroup V1"
57-
fi
50+
t POST libpod/pods/foo/pause 200
5851
t POST libpod/pods/foo/unpause 200
5952
t POST "libpod/pods/foo/unpause (2nd unpause in a row)" 200
6053
t POST "libpod/pods/fakename/unpause" 404\
@@ -108,28 +101,21 @@ t POST libpod/pods/bar/stop?t=1 200 \
108101

109102
t POST libpod/pods/bar/start 200
110103

111-
if root || have_cgroupsv2; then
112-
t GET libpod/pods/stats?all=true 200
113-
is $(jq '. | length' <<<"$output") 3 "stats?all=true: number of records found"
104+
t GET libpod/pods/stats?all=true 200
105+
is $(jq '. | length' <<<"$output") 3 "stats?all=true: number of records found"
114106

115-
t GET libpod/pods/stats?namesOrIDs=foo 200
116-
is $(jq '. | length' <<<"$output") 1 "stats?namesOrIDs=foo: number of records found"
107+
t GET libpod/pods/stats?namesOrIDs=foo 200
108+
is $(jq '. | length' <<<"$output") 1 "stats?namesOrIDs=foo: number of records found"
117109

118-
t GET libpod/pods/stats?namesOrIDs=fakename 404 \
119-
.cause="no such pod" \
110+
t GET libpod/pods/stats?namesOrIDs=fakename 404 \
111+
.cause="no such pod" \
120112
.message="unable to get list of pods: no pod with name or ID fakename found: no such pod"
121113

122-
t GET "libpod/pods/stats?all=true&namesOrIDs=foo" 500 \
123-
.cause="--all, --latest and arguments cannot be used together" \
124-
.message="--all, --latest and arguments cannot be used together"
114+
t GET "libpod/pods/stats?all=true&namesOrIDs=foo" 500 \
115+
.cause="--all, --latest and arguments cannot be used together" \
116+
.message="--all, --latest and arguments cannot be used together"
125117

126-
t DELETE libpod/pods/bar?force=true 200
127-
else
128-
# Rootless cgroupsv1 : libpod/pods/stats is unsupported
129-
t GET libpod/pods/stats?all=true 500 \
130-
.cause="pod stats is not supported in rootless mode without cgroups v2" \
131-
.message~"pod stats is not supported in rootless mode without cgroups v2"
132-
fi
118+
t DELETE libpod/pods/bar?force=true 200
133119

134120
# test the fake name
135121
t GET libpod/pods/fakename/top 404 \
@@ -161,10 +147,7 @@ t DELETE libpod/pods/foo 200
161147
t DELETE "libpod/pods/foo (pod has already been deleted)" 404
162148

163149
# Expect this to time out
164-
if root || have_cgroupsv2; then
165-
# Rootless cgroupsv1 : libpod/pods/stats is unsupported
166-
APIV2_TEST_EXPECT_TIMEOUT=5 t GET "libpod/pods/stats?stream=true&delay=1" 999
167-
fi
150+
APIV2_TEST_EXPECT_TIMEOUT=5 t GET "libpod/pods/stats?stream=true&delay=1" 999
168151

169152
podman pod create --name=specgen
170153

test/e2e/cleanup_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ var _ = Describe("Podman container cleanup", func() {
9898
})
9999

100100
It("podman cleanup paused container", func() {
101-
SkipIfRootlessCgroupsV1("Pause is not supported in cgroups v1")
102101
session := podmanTest.RunTopContainer("paused")
103102
session.WaitWithDefaultTimeout()
104103
Expect(session).Should(ExitCleanly())

test/e2e/common_test.go

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
. "github.com/onsi/gomega"
3939
. "github.com/onsi/gomega/gexec"
4040
"github.com/sirupsen/logrus"
41-
"go.podman.io/common/pkg/cgroups"
4241
"go.podman.io/common/pkg/libartifact"
4342
"go.podman.io/storage/pkg/ioutils"
4443
"go.podman.io/storage/pkg/lockfile"
@@ -53,7 +52,6 @@ var (
5352
CGROUP_MANAGER = "systemd"
5453
RESTORE_IMAGES = []string{ALPINE, BB, NGINX_IMAGE}
5554
defaultWaitTimeout = 90
56-
CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode()
5755
)
5856

5957
// PodmanTestIntegration struct for command line options
@@ -784,7 +782,7 @@ func (p *PodmanTestIntegration) RunTopContainer(name string) *PodmanSessionInteg
784782
// runs top. If the name passed != "", it will have a name, command args can also be passed in
785783
func (p *PodmanTestIntegration) RunTopContainerWithArgs(name string, args []string) *PodmanSessionIntegration {
786784
// In proxy environment, some tests need to the --http-proxy=false option (#16684)
787-
var podmanArgs = []string{"run", "--http-proxy=false"}
785+
podmanArgs := []string{"run", "--http-proxy=false"}
788786
if name != "" {
789787
podmanArgs = append(podmanArgs, "--name", name)
790788
}
@@ -803,7 +801,7 @@ func (p *PodmanTestIntegration) RunTopContainerWithArgs(name string, args []stri
803801
// RunLsContainer runs a simple container in the background that
804802
// simply runs ls. If the name passed != "", it will have a name
805803
func (p *PodmanTestIntegration) RunLsContainer(name string) (*PodmanSessionIntegration, int, string) {
806-
var podmanArgs = []string{"run"}
804+
podmanArgs := []string{"run"}
807805
if name != "" {
808806
podmanArgs = append(podmanArgs, "--name", name)
809807
}
@@ -822,7 +820,7 @@ func (p *PodmanTestIntegration) RunLsContainer(name string) (*PodmanSessionInteg
822820

823821
// RunNginxWithHealthCheck runs the alpine nginx container with an optional name and adds a healthcheck into it
824822
func (p *PodmanTestIntegration) RunNginxWithHealthCheck(name string) (*PodmanSessionIntegration, string) {
825-
var podmanArgs = []string{"run"}
823+
podmanArgs := []string{"run"}
826824
if name != "" {
827825
podmanArgs = append(podmanArgs, "--name", name)
828826
}
@@ -835,7 +833,7 @@ func (p *PodmanTestIntegration) RunNginxWithHealthCheck(name string) (*PodmanSes
835833

836834
// RunContainerWithNetworkTest runs the fedoraMinimal curl with the specified network mode.
837835
func (p *PodmanTestIntegration) RunContainerWithNetworkTest(mode string) *PodmanSessionIntegration {
838-
var podmanArgs = []string{"run"}
836+
podmanArgs := []string{"run"}
839837
if mode != "" {
840838
podmanArgs = append(podmanArgs, "--network", mode)
841839
}
@@ -845,7 +843,7 @@ func (p *PodmanTestIntegration) RunContainerWithNetworkTest(mode string) *Podman
845843
}
846844

847845
func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSessionIntegration, int, string) {
848-
var podmanArgs = []string{"run", "--pod", pod}
846+
podmanArgs := []string{"run", "--pod", pod}
849847
if name != "" {
850848
podmanArgs = append(podmanArgs, "--name", name)
851849
}
@@ -1006,7 +1004,7 @@ func (s *PodmanSessionIntegration) InspectPodArrToJSON() []define.InspectPodData
10061004
// CreatePod creates a pod with no infra container
10071005
// it optionally takes a pod name
10081006
func (p *PodmanTestIntegration) CreatePod(options map[string][]string) (*PodmanSessionIntegration, int, string) {
1009-
var args = []string{"pod", "create", "--infra=false", "--share", ""}
1007+
args := []string{"pod", "create", "--infra=false", "--share", ""}
10101008
for k, values := range options {
10111009
for _, v := range values {
10121010
args = append(args, k+"="+v)
@@ -1019,7 +1017,7 @@ func (p *PodmanTestIntegration) CreatePod(options map[string][]string) (*PodmanS
10191017
}
10201018

10211019
func (p *PodmanTestIntegration) CreateVolume(options map[string][]string) (*PodmanSessionIntegration, int, string) {
1022-
var args = []string{"volume", "create"}
1020+
args := []string{"volume", "create"}
10231021
for k, values := range options {
10241022
for _, v := range values {
10251023
args = append(args, k+"="+v)
@@ -1083,13 +1081,6 @@ func SkipIfRunc(p *PodmanTestIntegration, reason string) {
10831081
}
10841082
}
10851083

1086-
func SkipIfRootlessCgroupsV1(reason string) {
1087-
checkReason(reason)
1088-
if isRootless() && !CGROUPSV2 {
1089-
Skip("[rootless]: " + reason)
1090-
}
1091-
}
1092-
10931084
func SkipIfRootless(reason string) {
10941085
checkReason(reason)
10951086
if isRootless() {
@@ -1182,24 +1173,6 @@ func isRootless() bool {
11821173
return os.Geteuid() != 0
11831174
}
11841175

1185-
func isCgroupsV1() bool {
1186-
return !CGROUPSV2
1187-
}
1188-
1189-
func SkipIfCgroupV1(reason string) {
1190-
checkReason(reason)
1191-
if isCgroupsV1() {
1192-
Skip(reason)
1193-
}
1194-
}
1195-
1196-
func SkipIfCgroupV2(reason string) {
1197-
checkReason(reason)
1198-
if CGROUPSV2 {
1199-
Skip(reason)
1200-
}
1201-
}
1202-
12031176
func isContainerized() bool {
12041177
// This is set to "podman" by podman automatically
12051178
return os.Getenv("container") != ""
@@ -1382,8 +1355,10 @@ func (p *PodmanTestIntegration) makeOptions(args []string, options PodmanExecOpt
13821355

13831356
podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...)
13841357
if !options.NoCache {
1385-
cacheOptions := []string{"--storage-opt",
1386-
fmt.Sprintf("%s.imagestore=%s", p.PodmanTest.ImageCacheFS, p.PodmanTest.ImageCacheDir)}
1358+
cacheOptions := []string{
1359+
"--storage-opt",
1360+
fmt.Sprintf("%s.imagestore=%s", p.PodmanTest.ImageCacheFS, p.PodmanTest.ImageCacheDir),
1361+
}
13871362
podmanOptions = append(cacheOptions, podmanOptions...)
13881363
}
13891364
podmanOptions = append(podmanOptions, args...)

test/e2e/container_clone_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var _ = Describe("Podman container clone", func() {
1515
})
1616

1717
It("podman container clone basic test", func() {
18-
SkipIfRootlessCgroupsV1("starting a container with the memory limits not supported")
1918
create := podmanTest.Podman([]string{"create", ALPINE})
2019
create.WaitWithDefaultTimeout()
2120
Expect(create).To(ExitCleanly())
@@ -68,7 +67,6 @@ var _ = Describe("Podman container clone", func() {
6867
})
6968

7069
It("podman container clone resource limits override", func() {
71-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
7270
create := podmanTest.Podman([]string{"create", "--cpus=5", ALPINE})
7371
create.WaitWithDefaultTimeout()
7472
Expect(create).To(ExitCleanly())
@@ -144,7 +142,6 @@ var _ = Describe("Podman container clone", func() {
144142
})
145143

146144
It("podman container clone in a pod", func() {
147-
SkipIfRootlessCgroupsV1("starting a container with the memory limits not supported")
148145
run := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:1234", ALPINE, "sleep", "20"})
149146
run.WaitWithDefaultTimeout()
150147
Expect(run).To(ExitCleanly())

test/e2e/containers_conf_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,16 @@ import (
2020
)
2121

2222
var _ = Describe("Verify podman containers.conf usage", func() {
23-
2423
BeforeEach(func() {
2524
confPath, err := filepath.Abs("config/containers.conf")
2625
Expect(err).ToNot(HaveOccurred())
2726
os.Setenv("CONTAINERS_CONF", confPath)
2827
if IsRemote() {
2928
podmanTest.RestartRemoteService()
3029
}
31-
3230
})
3331

3432
It("limits test", func() {
35-
SkipIfRootlessCgroupsV1("Setting limits not supported on cgroupv1 for rootless users")
3633
// containers.conf is set to "nofile=500:500"
3734
session := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ulimit", "-n"})
3835
session.WaitWithDefaultTimeout()
@@ -55,11 +52,9 @@ var _ = Describe("Verify podman containers.conf usage", func() {
5552
} else {
5653
Expect(session.OutputToString()).To(Not(Equal("500")))
5754
}
58-
5955
})
6056

6157
It("oom-score-adj", func() {
62-
SkipIfRootlessCgroupsV1("Setting limits not supported on cgroupv1 for rootless users")
6358
// containers.conf is set to "oom_score_adj=999"
6459
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "cat", "/proc/self/oom_score_adj"})
6560
session.WaitWithDefaultTimeout()
@@ -85,15 +80,10 @@ var _ = Describe("Verify podman containers.conf usage", func() {
8580
} else {
8681
Expect(session.OutputToString()).To(ContainSubstring("0"))
8782
}
88-
8983
}
90-
9184
})
9285

9386
It("cgroup_conf in containers.conf", func() {
94-
if isCgroupsV1() {
95-
Skip("Setting cgroup_confs not supported on cgroupv1")
96-
}
9787
// FIXME: Needs crun-1.8.2-2 to allow this with --cgroup-manager=cgroupfs, once this is available remove the skip below.
9888
SkipIfRootless("--cgroup-manager=cgoupfs and --cgroup-conf not supported in rootless mode with crun")
9989
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
@@ -152,7 +142,6 @@ var _ = Describe("Verify podman containers.conf usage", func() {
152142
})
153143

154144
It("add capabilities", func() {
155-
SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1")
156145
cap := podmanTest.Podman([]string{"run", ALPINE, "grep", "CapEff", "/proc/self/status"})
157146
cap.WaitWithDefaultTimeout()
158147
Expect(cap).Should(ExitCleanly())
@@ -198,7 +187,6 @@ var _ = Describe("Verify podman containers.conf usage", func() {
198187
})
199188

200189
verifyNSHandling := func(nspath, option string) {
201-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
202190
os.Setenv("CONTAINERS_CONF", "config/containers-ns.conf")
203191
if IsRemote() {
204192
podmanTest.RestartRemoteService()
@@ -812,7 +800,6 @@ var _ = Describe("Verify podman containers.conf usage", func() {
812800
}
813801

814802
It("podman containers.conf container_name_as_hostname", func() {
815-
816803
// With default containers.conf
817804

818805
// Start container with no options

test/e2e/cp_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ var _ = Describe("Podman cp", func() {
7373

7474
// Copy a file to the container, then back to the host in --pid=host
7575
It("podman cp --pid=host file", func() {
76-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
7776
srcFile, err := os.CreateTemp("", "")
7877
Expect(err).ToNot(HaveOccurred())
7978
defer srcFile.Close()

test/e2e/create_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ var _ = Describe("Podman create", func() {
427427
})
428428

429429
It("podman create with -m 1000000 sets swap to 2000000", func() {
430-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
431430
numMem := 1000000
432431
ctrName := "testCtr"
433432
session := podmanTest.Podman([]string{"create", "-t", "-m", fmt.Sprintf("%db", numMem), "--name", ctrName, ALPINE, "/bin/sh"})
@@ -442,7 +441,6 @@ var _ = Describe("Podman create", func() {
442441
})
443442

444443
It("podman create --cpus 5 sets nanocpus", func() {
445-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
446444
numCpus := 5
447445
nanoCPUs := numCpus * 1000000000
448446
ctrName := "testCtr"

test/e2e/generate_kube_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,6 @@ var _ = Describe("Podman kube generate", func() {
608608
})
609609

610610
It("on pod with memory limit", func() {
611-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
612611
podName := "testMemoryLimit"
613612
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
614613
podSession.WaitWithDefaultTimeout()
@@ -634,7 +633,6 @@ var _ = Describe("Podman kube generate", func() {
634633
})
635634

636635
It("on pod with cpu limit", func() {
637-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
638636
podName := "testCpuLimit"
639637
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
640638
podSession.WaitWithDefaultTimeout()

test/e2e/generate_spec_test.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
. "github.com/containers/podman/v5/test/utils"
99
. "github.com/onsi/ginkgo/v2"
1010
. "github.com/onsi/gomega"
11-
. "github.com/onsi/gomega/gexec"
1211
)
1312

1413
var _ = Describe("Podman generate spec", func() {
@@ -24,7 +23,6 @@ var _ = Describe("Podman generate spec", func() {
2423
})
2524

2625
It("podman generate spec basic usage", func() {
27-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
2826
session := podmanTest.Podman([]string{"create", "--cpus", "5", "--name", "specgen", ALPINE})
2927
session.WaitWithDefaultTimeout()
3028
Expect(session).Should(ExitCleanly())
@@ -35,7 +33,6 @@ var _ = Describe("Podman generate spec", func() {
3533
})
3634

3735
It("podman generate spec file", func() {
38-
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
3936
session := podmanTest.Podman([]string{"create", "--cpus", "5", "--name", "specgen", ALPINE})
4037
session.WaitWithDefaultTimeout()
4138
Expect(session).Should(ExitCleanly())
@@ -61,11 +58,6 @@ var _ = Describe("Podman generate spec", func() {
6158
session = podmanTest.Podman([]string{"generate", "spec", "--compact", "podspecgen"})
6259
session.WaitWithDefaultTimeout()
6360

64-
if isRootless() && !CGROUPSV2 {
65-
Expect(session).Should(Exit(0))
66-
Expect(session.ErrorToString()).Should(ContainSubstring("Resource limits are not supported and ignored on cgroups V1 rootless"))
67-
} else {
68-
Expect(session).Should(ExitCleanly())
69-
}
61+
Expect(session).Should(ExitCleanly())
7062
})
7163
})

0 commit comments

Comments
 (0)