mirror of
				https://github.com/containers/podman.git
				synced 2025-11-04 08:56:05 +08:00 
			
		
		
		
	Moving from Go module v4 to v5 prepares us for public releases. Move done using gomove [1] as with the v3 and v4 moves. [1] https://github.com/KSubedi/gomove Signed-off-by: Matt Heon <mheon@redhat.com>
		
			
				
	
	
		
			90 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package integration
 | 
						|
 | 
						|
import (
 | 
						|
	"path/filepath"
 | 
						|
 | 
						|
	. "github.com/containers/podman/v5/test/utils"
 | 
						|
	. "github.com/onsi/ginkgo/v2"
 | 
						|
	. "github.com/onsi/gomega"
 | 
						|
)
 | 
						|
 | 
						|
var _ = Describe("Podman run with volumes", func() {
 | 
						|
	var (
 | 
						|
		containerStorageDir    string
 | 
						|
		dbDir                  string
 | 
						|
		runContainerStorageDir string
 | 
						|
		runDBDir               string
 | 
						|
	)
 | 
						|
 | 
						|
	BeforeEach(func() {
 | 
						|
		containerStorageDir = filepath.Join(podmanTest.Root, podmanTest.ImageCacheFS+"-containers")
 | 
						|
		dbDir = filepath.Join(podmanTest.Root, "libpod")
 | 
						|
		runContainerStorageDir = filepath.Join(podmanTest.RunRoot, podmanTest.ImageCacheFS+"-containers")
 | 
						|
		runDBDir = tempdir
 | 
						|
	})
 | 
						|
 | 
						|
	It("podman run with no transient-store", func() {
 | 
						|
		session := podmanTest.Podman([]string{"run", ALPINE, "true"})
 | 
						|
		session.WaitWithDefaultTimeout()
 | 
						|
		Expect(session).Should(ExitCleanly())
 | 
						|
 | 
						|
		_ = SystemExec("ls", []string{"-l", containerStorageDir})
 | 
						|
 | 
						|
		// All files should be in permanent store, not volatile
 | 
						|
		Expect(filepath.Join(containerStorageDir, "containers.json")).Should(BeARegularFile())
 | 
						|
		Expect(filepath.Join(containerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(runContainerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(runContainerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
 | 
						|
		if podmanTest.DatabaseBackend == "sqlite" {
 | 
						|
			Expect(filepath.Join(podmanTest.Root, "db.sql")).Should(BeARegularFile())
 | 
						|
			Expect(filepath.Join(podmanTest.RunRoot, "db.sql")).Should(Not(BeAnExistingFile()))
 | 
						|
		} else {
 | 
						|
			Expect(filepath.Join(dbDir, "bolt_state.db")).Should(BeARegularFile())
 | 
						|
			Expect(filepath.Join(runDBDir, "bolt_state.db")).Should(Not(BeAnExistingFile()))
 | 
						|
		}
 | 
						|
	})
 | 
						|
 | 
						|
	It("podman run --rm with no transient-store", func() {
 | 
						|
		session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "true"})
 | 
						|
		session.WaitWithDefaultTimeout()
 | 
						|
		Expect(session).Should(ExitCleanly())
 | 
						|
 | 
						|
		// All files should not be in permanent store, not volatile
 | 
						|
		Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(containerStorageDir, "volatile-containers.json")).Should(BeARegularFile())
 | 
						|
		Expect(filepath.Join(runContainerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(runContainerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
 | 
						|
		if podmanTest.DatabaseBackend == "sqlite" {
 | 
						|
			Expect(filepath.Join(podmanTest.Root, "db.sql")).Should(BeARegularFile())
 | 
						|
			Expect(filepath.Join(podmanTest.RunRoot, "db.sql")).Should(Not(BeAnExistingFile()))
 | 
						|
		} else {
 | 
						|
			Expect(filepath.Join(dbDir, "bolt_state.db")).Should(BeARegularFile())
 | 
						|
			Expect(filepath.Join(runDBDir, "bolt_state.db")).Should(Not(BeAnExistingFile()))
 | 
						|
		}
 | 
						|
	})
 | 
						|
 | 
						|
	It("podman run --transient-store", func() {
 | 
						|
		SkipIfRemote("Can't change store options remotely")
 | 
						|
		session := podmanTest.Podman([]string{"run", "--transient-store", ALPINE, "true"})
 | 
						|
		session.WaitWithDefaultTimeout()
 | 
						|
		Expect(session).Should(ExitCleanly())
 | 
						|
 | 
						|
		// All files should be in runroot store, volatile
 | 
						|
		Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(containerStorageDir, "volatile-containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(runContainerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
 | 
						|
		Expect(filepath.Join(runContainerStorageDir, "volatile-containers.json")).Should(BeARegularFile())
 | 
						|
 | 
						|
		if podmanTest.DatabaseBackend == "sqlite" {
 | 
						|
			Expect(filepath.Join(podmanTest.Root, "db.sql")).Should(Not(BeAnExistingFile()))
 | 
						|
			Expect(filepath.Join(podmanTest.RunRoot, "db.sql")).Should(BeARegularFile())
 | 
						|
		} else {
 | 
						|
			Expect(filepath.Join(dbDir, "bolt_state.db")).Should(Not(BeAnExistingFile()))
 | 
						|
			Expect(filepath.Join(runDBDir, "bolt_state.db")).Should(BeARegularFile())
 | 
						|
		}
 | 
						|
	})
 | 
						|
 | 
						|
})
 |