github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/e2e/run_cleanup_test.go (about) 1 package integration 2 3 import ( 4 "os" 5 6 . "github.com/containers/podman/v3/test/utils" 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 . "github.com/onsi/gomega/gexec" 10 ) 11 12 var _ = Describe("Podman run exit", func() { 13 var ( 14 tempdir string 15 err error 16 podmanTest *PodmanTestIntegration 17 ) 18 19 BeforeEach(func() { 20 tempdir, err = CreateTempDirInTempDir() 21 if err != nil { 22 os.Exit(1) 23 } 24 podmanTest = PodmanTestCreate(tempdir) 25 podmanTest.Setup() 26 podmanTest.RestoreArtifact(ALPINE) 27 }) 28 29 AfterEach(func() { 30 podmanTest.Cleanup() 31 f := CurrentGinkgoTestDescription() 32 processTestResult(f) 33 34 }) 35 36 It("podman run -d mount cleanup test", func() { 37 SkipIfRemote("podman-remote does not support mount") 38 SkipIfRootless("FIXME podman mount requires podman unshare first") 39 40 result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"}) 41 result.WaitWithDefaultTimeout() 42 cid := result.OutputToString() 43 Expect(result).Should(Exit(0)) 44 45 mount := SystemExec("mount", nil) 46 Expect(mount).Should(Exit(0)) 47 Expect(mount.OutputToString()).To(ContainSubstring(cid)) 48 49 pmount := podmanTest.Podman([]string{"mount", "--notruncate"}) 50 pmount.WaitWithDefaultTimeout() 51 Expect(pmount).Should(Exit(0)) 52 Expect(pmount.OutputToString()).To(ContainSubstring(cid)) 53 54 stop := podmanTest.Podman([]string{"stop", cid}) 55 stop.WaitWithDefaultTimeout() 56 Expect(stop).Should(Exit(0)) 57 58 // We have to force cleanup so the unmount happens 59 podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid}) 60 podmanCleanupSession.WaitWithDefaultTimeout() 61 Expect(podmanCleanupSession).Should(Exit(0)) 62 63 mount = SystemExec("mount", nil) 64 Expect(mount).Should(Exit(0)) 65 Expect(mount.OutputToString()).NotTo(ContainSubstring(cid)) 66 67 pmount = podmanTest.Podman([]string{"mount", "--notruncate"}) 68 pmount.WaitWithDefaultTimeout() 69 Expect(pmount).Should(Exit(0)) 70 Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid)) 71 72 }) 73 })