summaryrefslogtreecommitdiff
path: root/test/e2e/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r--test/e2e/common_test.go51
1 files changed, 41 insertions, 10 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 1943020c3..c663a4dca 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -599,6 +599,26 @@ func (p *PodmanTestIntegration) CreateSeccompJson(in []byte) (string, error) {
return jsonFile, nil
}
+func checkReason(reason string) {
+ if len(reason) < 5 {
+ panic("Test must specify a reason to skip")
+ }
+}
+
+func SkipIfRootlessCgroupsV1(reason string) {
+ checkReason(reason)
+ if os.Geteuid() != 0 && !CGROUPSV2 {
+ Skip("[rootless]: " + reason)
+ }
+}
+
+func SkipIfRootless(reason string) {
+ checkReason(reason)
+ if os.Geteuid() != 0 {
+ ginkgo.Skip("[rootless]: " + reason)
+ }
+}
+
func SkipIfNotFedora() {
info := GetHostDistributionInfo()
if info.Distribution != "fedora" {
@@ -610,21 +630,32 @@ func isRootless() bool {
return os.Geteuid() != 0
}
-func SkipIfCgroupV1() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
+func SkipIfCgroupV1(reason string) {
+ checkReason(reason)
+ if !CGROUPSV2 {
+ Skip(reason)
+ }
+}
- if !cgroupsv2 {
- Skip("Skip on systems with cgroup V1 systems")
+func SkipIfCgroupV2(reason string) {
+ checkReason(reason)
+ if CGROUPSV2 {
+ Skip(reason)
}
}
-func SkipIfCgroupV2() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
+func isContainerized() bool {
+ // This is set to "podman" by podman automatically
+ if os.Getenv("container") != "" {
+ return true
+ }
+ return false
+}
- if cgroupsv2 {
- Skip("Skip on systems with cgroup V2 systems")
+func SkipIfContainerized(reason string) {
+ checkReason(reason)
+ if isContainerized() {
+ Skip(reason)
}
}