podman

Форк
0
/
libpod_suite_test.go 
80 строк · 2.5 Кб
1
//go:build !remote_testing
2

3
package integration
4

5
import (
6
	"os"
7
	"path/filepath"
8

9
	. "github.com/onsi/ginkgo/v2"
10
	. "github.com/onsi/gomega"
11
)
12

13
func IsRemote() bool {
14
	return false
15
}
16

17
// Podman is the exec call to podman on the filesystem
18
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
19
	podmanSession := p.PodmanBase(args, false, false)
20
	return &PodmanSessionIntegration{podmanSession}
21
}
22

23
// PodmanSystemdScope runs the podman command in a new systemd scope
24
func (p *PodmanTestIntegration) PodmanSystemdScope(args []string) *PodmanSessionIntegration {
25
	wrapper := []string{"systemd-run", "--scope"}
26
	if isRootless() {
27
		wrapper = []string{"systemd-run", "--scope", "--user"}
28
	}
29
	podmanSession := p.PodmanAsUserBase(args, 0, 0, "", nil, false, false, wrapper, nil)
30
	return &PodmanSessionIntegration{podmanSession}
31
}
32

33
// PodmanExtraFiles is the exec call to podman on the filesystem and passes down extra files
34
func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os.File) *PodmanSessionIntegration {
35
	podmanSession := p.PodmanAsUserBase(args, 0, 0, "", nil, false, false, nil, extraFiles)
36
	return &PodmanSessionIntegration{podmanSession}
37
}
38

39
func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
40
	defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf")
41
	err := os.Setenv("CONTAINERS_REGISTRIES_CONF", defaultFile)
42
	Expect(err).ToNot(HaveOccurred())
43
}
44

45
func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) {
46
	outfile := filepath.Join(p.TempDir, "registries.conf")
47
	os.Setenv("CONTAINERS_REGISTRIES_CONF", outfile)
48
	err := os.WriteFile(outfile, b, 0644)
49
	Expect(err).ToNot(HaveOccurred())
50
}
51

52
func resetRegistriesConfigEnv() {
53
	os.Setenv("CONTAINERS_REGISTRIES_CONF", "")
54
}
55

56
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
57
	return PodmanTestCreateUtil(tempDir, false)
58
}
59

60
// RestoreArtifact puts the cached image into our test store
61
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
62
	tarball := imageTarPath(image)
63
	if _, err := os.Stat(tarball); err == nil {
64
		GinkgoWriter.Printf("Restoring %s...\n", image)
65
		restore := p.PodmanNoEvents([]string{"load", "-q", "-i", tarball})
66
		restore.Wait(90)
67
	}
68
	return nil
69
}
70

71
func (p *PodmanTestIntegration) StopRemoteService() {}
72

73
// We don't support running API service when local
74
func (p *PodmanTestIntegration) StartRemoteService() {
75
}
76

77
// Just a stub for compiling with `!remote`.
78
func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
79
	return nil
80
}
81

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.