From f2ff550967660a611f8f28e9bd79d39bc007c104 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 9 Jan 2019 13:23:01 -0500 Subject: Fix handling of nil volumes Currently if a user passes in a -v with -v $bogus:/foobar We crash. This will throw a proper error. Signed-off-by: Daniel J Walsh --- test/e2e/run_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index a0b16a254..1e7f4f0f4 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -596,6 +596,21 @@ USER mail` Expect(session.ExitCode()).To(Equal(0)) }) + It("podman run --volumes flag with empty host dir", func() { + vol1 := filepath.Join(podmanTest.TempDir, "vol-test1") + err := os.MkdirAll(vol1, 0755) + Expect(err).To(BeNil()) + + session := podmanTest.Podman([]string{"run", "--volume", ":/myvol1:z", ALPINE, "touch", "/myvol2/foo.txt"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).ToNot(Equal(0)) + Expect(session.ErrorToString()).To(ContainSubstring("directory cannot be empty")) + session = podmanTest.Podman([]string{"run", "--volume", vol1 + ":", ALPINE, "touch", "/myvol2/foo.txt"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).ToNot(Equal(0)) + Expect(session.ErrorToString()).To(ContainSubstring("directory cannot be empty")) + }) + It("podman run --mount flag with multiple mounts", func() { vol1 := filepath.Join(podmanTest.TempDir, "vol-test1") err := os.MkdirAll(vol1, 0755) -- cgit v1.2.3-54-g00ecf