mirror of
https://github.com/containers/podman.git
synced 2025-06-19 16:33:24 +08:00
Merge pull request #12870 from rhatdan/userns1
Use PODMAN_USERNS environment variable when running as a service
This commit is contained in:
@ -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()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user