diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-01 06:05:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 06:05:00 -0400 |
commit | 556117c2e95bb0e4da7d36e10d94c3ec0ac4072f (patch) | |
tree | c32a05e34382a41cd96f8ccca939a34a1871b0a7 /test/e2e/common_test.go | |
parent | c0dac6c5f34312f136e0a061b905d7cbc2350fa6 (diff) | |
parent | d4ca13f7c0d0af7d1b8f88671548f7aa99cb1b10 (diff) | |
download | podman-556117c2e95bb0e4da7d36e10d94c3ec0ac4072f.tar.gz podman-556117c2e95bb0e4da7d36e10d94c3ec0ac4072f.tar.bz2 podman-556117c2e95bb0e4da7d36e10d94c3ec0ac4072f.zip |
Merge pull request #7848 from cevich/fix_tests
Fix two e2e tests
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r-- | test/e2e/common_test.go | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index f4c80d865..c663a4dca 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -599,19 +599,21 @@ func (p *PodmanTestIntegration) CreateSeccompJson(in []byte) (string, error) { return jsonFile, nil } -func SkipIfRootlessCgroupsV1(reason string) { +func checkReason(reason string) { if len(reason) < 5 { - panic("SkipIfRootlessCgroupsV1 must specify a reason to skip") + 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) { - if len(reason) < 5 { - panic("SkipIfRootless must specify a reason to skip") - } + checkReason(reason) if os.Geteuid() != 0 { ginkgo.Skip("[rootless]: " + reason) } @@ -629,23 +631,34 @@ func isRootless() bool { } func SkipIfCgroupV1(reason string) { - if len(reason) < 5 { - panic("SkipIfCgroupV1 must specify a reason to skip") - } + checkReason(reason) if !CGROUPSV2 { Skip(reason) } } func SkipIfCgroupV2(reason string) { - if len(reason) < 5 { - panic("SkipIfCgroupV2 must specify a reason to skip") - } + checkReason(reason) if CGROUPSV2 { Skip(reason) } } +func isContainerized() bool { + // This is set to "podman" by podman automatically + if os.Getenv("container") != "" { + return true + } + return false +} + +func SkipIfContainerized(reason string) { + checkReason(reason) + if isContainerized() { + Skip(reason) + } +} + // PodmanAsUser is the exec call to podman on the filesystem with the specified uid/gid and environment func (p *PodmanTestIntegration) PodmanAsUser(args []string, uid, gid uint32, cwd string, env []string) *PodmanSessionIntegration { podmanSession := p.PodmanAsUserBase(args, uid, gid, cwd, env, false, false, nil) |