summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/events_test.go2
-rw-r--r--test/e2e/libpod_suite_remote_test.go2
-rw-r--r--test/e2e/libpod_suite_test.go26
-rw-r--r--test/e2e/pod_stats_test.go9
-rw-r--r--test/e2e/run_memory_test.go15
-rw-r--r--test/e2e/stats_test.go9
6 files changed, 34 insertions, 29 deletions
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 7f9550255..93c51098f 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -15,11 +15,11 @@ import (
var _ = Describe("Podman events", func() {
var (
tempdir string
- err error
podmanTest *PodmanTestIntegration
)
BeforeEach(func() {
+ var err error
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index 8a071a911..7a067e861 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -219,3 +219,5 @@ func (p *PodmanTestIntegration) DelayForService() error {
func populateCache(podman *PodmanTestIntegration) {}
func removeCache() {}
+func SkipIfCgroupV1() {}
+func SkipIfCgroupV2() {}
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 3543bd110..105fcf6a8 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -9,21 +9,41 @@ import (
"path/filepath"
"strings"
- "github.com/onsi/ginkgo"
+ "github.com/containers/libpod/v2/pkg/cgroups"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
)
func SkipIfRemote() {
}
+func SkipIfCgroupV1() {
+ cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
+ Expect(err).To(BeNil())
+
+ if !cgroupsv2 {
+ Skip("Skip on systems with cgroup V1 systems")
+ }
+}
+
+func SkipIfCgroupV2() {
+ cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
+ Expect(err).To(BeNil())
+
+ if cgroupsv2 {
+ Skip("Skip on systems with cgroup V2 systems")
+ }
+}
+
func SkipIfRootless() {
if os.Geteuid() != 0 {
- ginkgo.Skip("This function is not enabled for rootless podman")
+ Skip("This function is not enabled for rootless podman")
}
}
func SkipIfRootlessV2() {
if os.Geteuid() != 0 {
- ginkgo.Skip("This function is not enabled for v2 rootless podman")
+ Skip("This function is not enabled for v2 rootless podman")
}
}
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index 6cf392bd7..74d1c1838 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -5,7 +5,6 @@ package integration
import (
"os"
- "github.com/containers/libpod/v2/pkg/cgroups"
. "github.com/containers/libpod/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -13,16 +12,14 @@ import (
var _ = Describe("Podman pod stats", func() {
var (
+ err error
tempdir string
podmanTest *PodmanTestIntegration
)
BeforeEach(func() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if os.Geteuid() != 0 && !cgroupsv2 {
- Skip("This function is not enabled for rootless podman not running on cgroups v2")
+ if os.Geteuid() != 0 {
+ SkipIfCgroupV2()
}
tempdir, err = CreateTempDirInTempDir()
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index 0e88c09b3..5ae45b62f 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -78,13 +78,7 @@ var _ = Describe("Podman run memory", func() {
})
It("podman run memory-swappiness test", func() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if cgroupsv2 {
- Skip("Memory swappiness not supported on cgroups v2")
- }
-
+ SkipIfCgroupV2()
session := podmanTest.Podman([]string{"run", "--memory-swappiness=15", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -92,12 +86,7 @@ var _ = Describe("Podman run memory", func() {
})
It("podman run kernel-memory test", func() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if cgroupsv2 {
- Skip("Kernel memory not supported on cgroups v2")
- }
+ SkipIfCgroupV2()
session := podmanTest.Podman([]string{"run", "--kernel-memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index 009bb9cac..37a99076e 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -7,7 +7,6 @@ import (
"os"
"time"
- "github.com/containers/libpod/v2/pkg/cgroups"
. "github.com/containers/libpod/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -22,12 +21,10 @@ var _ = Describe("Podman stats", func() {
)
BeforeEach(func() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
- if os.Geteuid() != 0 && !cgroupsv2 {
- Skip("This function is not enabled for rootless podman not running on cgroups v2")
+ if os.Geteuid() != 0 {
+ SkipIfCgroupV1()
}
+ var err error
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)