podman

Форк
0
/
volume_rm_test.go 
110 строк · 3.5 Кб
1
package integration
2

3
import (
4
	. "github.com/containers/podman/v5/test/utils"
5
	. "github.com/onsi/ginkgo/v2"
6
	. "github.com/onsi/gomega"
7
	. "github.com/onsi/gomega/gexec"
8
)
9

10
var _ = Describe("Podman volume rm", func() {
11

12
	AfterEach(func() {
13
		podmanTest.CleanupVolume()
14
	})
15

16
	It("podman volume rm", func() {
17
		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
18
		session.WaitWithDefaultTimeout()
19
		Expect(session).Should(ExitCleanly())
20

21
		session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
22
		session.WaitWithDefaultTimeout()
23
		Expect(session).Should(ExitCleanly())
24

25
		session = podmanTest.Podman([]string{"volume", "ls"})
26
		session.WaitWithDefaultTimeout()
27
		Expect(session).Should(ExitCleanly())
28
		Expect(session.OutputToStringArray()).To(BeEmpty())
29
	})
30

31
	It("podman volume rm with --force flag", func() {
32
		session := podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
33
		cid := session.OutputToString()
34
		session.WaitWithDefaultTimeout()
35
		Expect(session).Should(ExitCleanly())
36

37
		session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
38
		session.WaitWithDefaultTimeout()
39
		Expect(session).Should(Exit(2))
40
		Expect(session.ErrorToString()).To(ContainSubstring(cid))
41

42
		session = podmanTest.Podman([]string{"volume", "rm", "-t", "0", "-f", "myvol"})
43
		session.WaitWithDefaultTimeout()
44
		Expect(session).Should(ExitCleanly())
45

46
		session = podmanTest.Podman([]string{"volume", "ls"})
47
		session.WaitWithDefaultTimeout()
48
		Expect(session).Should(ExitCleanly())
49
		Expect(session.OutputToStringArray()).To(BeEmpty())
50
	})
51

52
	It("podman volume remove bogus", func() {
53
		session := podmanTest.Podman([]string{"volume", "rm", "bogus"})
54
		session.WaitWithDefaultTimeout()
55
		Expect(session).Should(Exit(1))
56
	})
57

58
	It("podman rm with --all flag", func() {
59
		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
60
		session.WaitWithDefaultTimeout()
61
		Expect(session).Should(ExitCleanly())
62

63
		session = podmanTest.Podman([]string{"volume", "create"})
64
		session.WaitWithDefaultTimeout()
65
		Expect(session).Should(ExitCleanly())
66

67
		session = podmanTest.Podman([]string{"volume", "rm", "-a"})
68
		session.WaitWithDefaultTimeout()
69
		Expect(session).Should(ExitCleanly())
70

71
		session = podmanTest.Podman([]string{"volume", "ls"})
72
		session.WaitWithDefaultTimeout()
73
		Expect(session).Should(ExitCleanly())
74
		Expect(session.OutputToStringArray()).To(BeEmpty())
75
	})
76

77
	It("podman volume rm by partial name", func() {
78
		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
79
		session.WaitWithDefaultTimeout()
80
		Expect(session).Should(ExitCleanly())
81

82
		session = podmanTest.Podman([]string{"volume", "rm", "myv"})
83
		session.WaitWithDefaultTimeout()
84
		Expect(session).Should(ExitCleanly())
85

86
		session = podmanTest.Podman([]string{"volume", "ls"})
87
		session.WaitWithDefaultTimeout()
88
		Expect(session).Should(ExitCleanly())
89
		Expect(session.OutputToStringArray()).To(BeEmpty())
90
	})
91

92
	It("podman volume rm by nonunique partial name", func() {
93
		session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
94
		session.WaitWithDefaultTimeout()
95
		Expect(session).Should(ExitCleanly())
96

97
		session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
98
		session.WaitWithDefaultTimeout()
99
		Expect(session).Should(ExitCleanly())
100

101
		session = podmanTest.Podman([]string{"volume", "rm", "myv"})
102
		session.WaitWithDefaultTimeout()
103
		Expect(session).To(ExitWithError())
104

105
		session = podmanTest.Podman([]string{"volume", "ls"})
106
		session.WaitWithDefaultTimeout()
107
		Expect(session).Should(ExitCleanly())
108
		Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2))
109
	})
110
})
111

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

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

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

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