diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-06-24 14:57:49 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-07-06 13:31:28 -0400 |
commit | 3405e4fb6899846ba00c25e2c643c6338f432a8f (patch) | |
tree | 0110a00d9637f37f07bbb896ef736a9d07f25aa4 /test/e2e/run_userns_test.go | |
parent | eb85f429073d7dca0d2d01a1afe5a972ca9b429b (diff) | |
download | podman-3405e4fb6899846ba00c25e2c643c6338f432a8f.tar.gz podman-3405e4fb6899846ba00c25e2c643c6338f432a8f.tar.bz2 podman-3405e4fb6899846ba00c25e2c643c6338f432a8f.zip |
test: add tests for --user and volumes
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test/e2e/run_userns_test.go')
-rw-r--r-- | test/e2e/run_userns_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go index e48a427d2..c0d98f7b1 100644 --- a/test/e2e/run_userns_test.go +++ b/test/e2e/run_userns_test.go @@ -245,4 +245,31 @@ var _ = Describe("Podman UserNS support", func() { ok, _ := session.GrepString("4998") Expect(ok).To(BeTrue()) }) + + It("podman --user with volume", func() { + tests := []struct { + uid, gid, arg, vol string + }{ + {"0", "0", "0:0", "vol-0"}, + {"1000", "0", "1000", "vol-1"}, + {"1000", "1000", "1000:1000", "vol-2"}, + } + + for _, tt := range tests { + session := podmanTest.Podman([]string{"run", "-d", "--user", tt.arg, "--mount", "type=volume,src=" + tt.vol + ",dst=/home/user", "alpine", "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", tt.vol}) + inspectUID.WaitWithDefaultTimeout() + Expect(inspectUID.ExitCode()).To(Equal(0)) + Expect(inspectUID.OutputToString()).To(Equal(tt.uid)) + + // Make sure we're defaulting to 0. + inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", tt.vol}) + inspectGID.WaitWithDefaultTimeout() + Expect(inspectGID.ExitCode()).To(Equal(0)) + Expect(inspectGID.OutputToString()).To(Equal(tt.gid)) + } + }) }) |