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.go39
1 files changed, 35 insertions, 4 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 51f290159..ed55484e3 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -13,10 +13,11 @@ import (
"testing"
"time"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/inspect"
- "github.com/containers/libpod/v2/pkg/rootless"
- . "github.com/containers/libpod/v2/test/utils"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/cgroups"
+ "github.com/containers/podman/v2/pkg/inspect"
+ "github.com/containers/podman/v2/pkg/rootless"
+ . "github.com/containers/podman/v2/test/utils"
"github.com/containers/storage"
"github.com/containers/storage/pkg/reexec"
"github.com/containers/storage/pkg/stringid"
@@ -151,6 +152,8 @@ var _ = SynchronizedBeforeSuite(func() []byte {
return []byte(path)
}, func(data []byte) {
+ cwd, _ := os.Getwd()
+ INTEGRATION_ROOT = filepath.Join(cwd, "../../")
LockTmpDir = string(data)
})
@@ -595,3 +598,31 @@ func SkipIfNotFedora() {
ginkgo.Skip("Test can only run on Fedora")
}
}
+
+func isRootless() bool {
+ return os.Geteuid() != 0
+}
+
+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")
+ }
+}
+
+// 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)
+ return &PodmanSessionIntegration{podmanSession}
+}