github.com/containers/podman/v4@v4.9.4/test/e2e/run_transient_test.go (about) 1 package integration 2 3 import ( 4 "path/filepath" 5 6 . "github.com/containers/podman/v4/test/utils" 7 . "github.com/onsi/ginkgo/v2" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("Podman run with volumes", func() { 12 var ( 13 containerStorageDir string 14 dbDir string 15 runContainerStorageDir string 16 runDBDir string 17 ) 18 19 BeforeEach(func() { 20 containerStorageDir = filepath.Join(podmanTest.Root, podmanTest.ImageCacheFS+"-containers") 21 dbDir = filepath.Join(podmanTest.Root, "libpod") 22 runContainerStorageDir = filepath.Join(podmanTest.RunRoot, podmanTest.ImageCacheFS+"-containers") 23 runDBDir = tempdir 24 }) 25 26 It("podman run with no transient-store", func() { 27 session := podmanTest.Podman([]string{"run", ALPINE, "true"}) 28 session.WaitWithDefaultTimeout() 29 Expect(session).Should(ExitCleanly()) 30 31 _ = SystemExec("ls", []string{"-l", containerStorageDir}) 32 33 // All files should be in permanent store, not volatile 34 Expect(filepath.Join(containerStorageDir, "containers.json")).Should(BeARegularFile()) 35 Expect(filepath.Join(containerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile())) 36 Expect(filepath.Join(runContainerStorageDir, "containers.json")).Should(Not(BeAnExistingFile())) 37 Expect(filepath.Join(runContainerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile())) 38 39 if podmanTest.DatabaseBackend == "sqlite" { 40 Expect(filepath.Join(podmanTest.Root, "db.sql")).Should(BeARegularFile()) 41 Expect(filepath.Join(podmanTest.RunRoot, "db.sql")).Should(Not(BeAnExistingFile())) 42 } else { 43 Expect(filepath.Join(dbDir, "bolt_state.db")).Should(BeARegularFile()) 44 Expect(filepath.Join(runDBDir, "bolt_state.db")).Should(Not(BeAnExistingFile())) 45 } 46 }) 47 48 It("podman run --rm with no transient-store", func() { 49 session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "true"}) 50 session.WaitWithDefaultTimeout() 51 Expect(session).Should(ExitCleanly()) 52 53 // All files should not be in permanent store, not volatile 54 Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile())) 55 Expect(filepath.Join(containerStorageDir, "volatile-containers.json")).Should(BeARegularFile()) 56 Expect(filepath.Join(runContainerStorageDir, "containers.json")).Should(Not(BeAnExistingFile())) 57 Expect(filepath.Join(runContainerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile())) 58 59 if podmanTest.DatabaseBackend == "sqlite" { 60 Expect(filepath.Join(podmanTest.Root, "db.sql")).Should(BeARegularFile()) 61 Expect(filepath.Join(podmanTest.RunRoot, "db.sql")).Should(Not(BeAnExistingFile())) 62 } else { 63 Expect(filepath.Join(dbDir, "bolt_state.db")).Should(BeARegularFile()) 64 Expect(filepath.Join(runDBDir, "bolt_state.db")).Should(Not(BeAnExistingFile())) 65 } 66 }) 67 68 It("podman run --transient-store", func() { 69 SkipIfRemote("Can't change store options remotely") 70 session := podmanTest.Podman([]string{"run", "--transient-store", ALPINE, "true"}) 71 session.WaitWithDefaultTimeout() 72 Expect(session).Should(ExitCleanly()) 73 74 // All files should be in runroot store, volatile 75 Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile())) 76 Expect(filepath.Join(containerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile())) 77 Expect(filepath.Join(runContainerStorageDir, "containers.json")).Should(Not(BeAnExistingFile())) 78 Expect(filepath.Join(runContainerStorageDir, "volatile-containers.json")).Should(BeARegularFile()) 79 80 if podmanTest.DatabaseBackend == "sqlite" { 81 Expect(filepath.Join(podmanTest.Root, "db.sql")).Should(Not(BeAnExistingFile())) 82 Expect(filepath.Join(podmanTest.RunRoot, "db.sql")).Should(BeARegularFile()) 83 } else { 84 Expect(filepath.Join(dbDir, "bolt_state.db")).Should(Not(BeAnExistingFile())) 85 Expect(filepath.Join(runDBDir, "bolt_state.db")).Should(BeARegularFile()) 86 } 87 }) 88 89 })