From 7fc1a329bd014d61f9895fc212aef452f6fb8f84 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 22 Jun 2018 16:44:59 -0400 Subject: Add `podman container cleanup` to CLI When we run containers in detach mode, nothing cleans up the network stack or the mount points. This patch will tell conmon to execute the cleanup code when the container exits. It can also be called to attempt to cleanup previously running containers. Signed-off-by: Daniel J Walsh Closes: #942 Approved by: mheon --- test/e2e/run_cleanup_test.go | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/e2e/run_cleanup_test.go (limited to 'test/e2e/run_cleanup_test.go') diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go new file mode 100644 index 000000000..8adf8888c --- /dev/null +++ b/test/e2e/run_cleanup_test.go @@ -0,0 +1,47 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman run exit", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman run -d mount cleanup test", func() { + mount := podmanTest.SystemExec("mount", nil) + mount.WaitWithDefaultTimeout() + out1 := mount.OutputToString() + result := podmanTest.Podman([]string{"run", "-d", ALPINE, "echo", "hello"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + result = podmanTest.SystemExec("sleep", []string{"5"}) + result.WaitWithDefaultTimeout() + + mount = podmanTest.SystemExec("mount", nil) + mount.WaitWithDefaultTimeout() + out2 := mount.OutputToString() + Expect(out1).To(Equal(out2)) + }) +}) -- cgit v1.2.3-54-g00ecf