diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/checkpoint_test.go | 45 | ||||
-rw-r--r-- | test/e2e/exec_test.go | 32 | ||||
-rw-r--r-- | test/e2e/run_test.go | 15 | ||||
-rw-r--r-- | test/e2e/start_test.go | 10 | ||||
-rw-r--r-- | test/install/Dockerfile.Centos | 2 | ||||
-rw-r--r-- | test/install/Dockerfile.Fedora | 2 |
6 files changed, 101 insertions, 5 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index 4e892d11c..ca2f35fc9 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -199,14 +199,17 @@ var _ = Describe("Podman checkpoint", func() { }) It("podman checkpoint container with established tcp connections", func() { - Skip("Seems to not work (yet) in CI") podmanTest.RestoreArtifact(redis) - session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "seccomp=unconfined", "--network", "host", "-d", redis}) + session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "seccomp=unconfined", "-d", redis}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + IP := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"}) + IP.WaitWithDefaultTimeout() + Expect(IP.ExitCode()).To(Equal(0)) + // Open a network connection to the redis server - conn, err := net.Dial("tcp", "127.0.0.1:6379") + conn, err := net.Dial("tcp", IP.OutputToString()+":6379") if err != nil { os.Exit(1) } @@ -287,4 +290,40 @@ var _ = Describe("Podman checkpoint", func() { Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) + It("podman checkpoint and restore container with same IP", func() { + session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "seccomp=unconfined", "--name", "test_name", "-d", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + IPBefore := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"}) + IPBefore.WaitWithDefaultTimeout() + Expect(IPBefore.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"container", "checkpoint", "test_name"}) + result.WaitWithDefaultTimeout() + + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited")) + + result = podmanTest.Podman([]string{"container", "restore", "test_name"}) + result.WaitWithDefaultTimeout() + + IPAfter := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"}) + IPAfter.WaitWithDefaultTimeout() + Expect(IPAfter.ExitCode()).To(Equal(0)) + + // Check that IP address did not change between checkpointing and restoring + Expect(IPBefore.OutputToString()).To(Equal(IPAfter.OutputToString())) + + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up")) + + result = podmanTest.Podman([]string{"rm", "-fa"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) + }) diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index fec80717f..a181501a5 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -127,4 +127,36 @@ var _ = Describe("Podman exec", func() { Expect(session2.ExitCode()).To(Equal(0)) Expect(session2.OutputToString()).To(Equal(testUser)) }) + + It("podman exec simple working directory test", func() { + setup := podmanTest.RunTopContainer("test1") + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"exec", "-l", "--workdir", "/tmp", "pwd"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + match, _ := session.GrepString("/tmp") + Expect(match).Should(BeTrue()) + + session = podmanTest.Podman([]string{"exec", "-l", "-w", "/tmp", "pwd"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + match, _ = session.GrepString("/tmp") + Expect(match).Should(BeTrue()) + }) + + It("podman exec missing working directory test", func() { + setup := podmanTest.RunTopContainer("test1") + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"exec", "-l", "--workdir", "/missing", "pwd"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(1)) + + session = podmanTest.Podman([]string{"exec", "-l", "-w", "/missing", "pwd"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(1)) + }) }) 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) diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index 64245c609..9d7ac145c 100644 --- a/test/e2e/start_test.go +++ b/test/e2e/start_test.go @@ -115,4 +115,14 @@ var _ = Describe("Podman start", func() { numContainers := podmanTest.NumberOfContainers() Expect(numContainers).To(Equal(1)) }) + + It("podman start --sig-proxy should not work without --attach", func() { + session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"start", "-l", "--sig-proxy"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + }) }) diff --git a/test/install/Dockerfile.Centos b/test/install/Dockerfile.Centos index 11f60029b..608d3c971 100644 --- a/test/install/Dockerfile.Centos +++ b/test/install/Dockerfile.Centos @@ -1,3 +1,3 @@ FROM registry.centos.org/centos/centos:7 -RUN yum install -y rpms/noarch/* rpms/x86_64/*
\ No newline at end of file +RUN yum install -y rpms/x86_64/* diff --git a/test/install/Dockerfile.Fedora b/test/install/Dockerfile.Fedora index 3a7b472de..74cee771d 100644 --- a/test/install/Dockerfile.Fedora +++ b/test/install/Dockerfile.Fedora @@ -1,3 +1,3 @@ FROM registry.fedoraproject.org/fedora:29 -RUN dnf install -y rpms/noarch/* rpms/x86_64/* +RUN dnf install -y rpms/x86_64/* |