summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-18 06:08:06 -0500
committerGitHub <noreply@github.com>2022-01-18 06:08:06 -0500
commitd0eb24bae0023848447568d024acdaadb632edfe (patch)
tree43461089256941739fc91e525229e670b26697d6 /test
parent02502e2c14efe99b8179ca23f3341254c9f39351 (diff)
parent10d969ff1a15e8f53eb5a2fa7eb8cfb321609b55 (diff)
downloadpodman-d0eb24bae0023848447568d024acdaadb632edfe.tar.gz
podman-d0eb24bae0023848447568d024acdaadb632edfe.tar.bz2
podman-d0eb24bae0023848447568d024acdaadb632edfe.zip
Merge pull request #12870 from rhatdan/userns1
Use PODMAN_USERNS environment variable when running as a service
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_userns_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index c1645af06..e8ba42cf0 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -301,5 +301,34 @@ var _ = Describe("Podman UserNS support", func() {
Expect(inspectGID).Should(Exit(0))
Expect(inspectGID.OutputToString()).To(Equal(tt.gid))
}
+
+ })
+ It("podman PODMAN_USERNS", func() {
+ SkipIfNotRootless("keep-id only works in rootless mode")
+
+ podmanUserns, podmanUserusSet := os.LookupEnv("PODMAN_USERNS")
+ os.Setenv("PODMAN_USERNS", "keep-id")
+ defer func() {
+ if podmanUserusSet {
+ os.Setenv("PODMAN_USERNS", podmanUserns)
+ } else {
+ os.Unsetenv("PODMAN_USERNS")
+ }
+ }()
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
+ result := podmanTest.Podman([]string{"create", ALPINE, "true"})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", "--format", "{{ .HostConfig.IDMappings }}", result.OutputToString()})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.OutputToString()).To(Not(Equal("<nil>")))
+
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
})
})