podman

Форк
0
/
podmantest_test.go 
62 строки · 1.7 Кб
1
package utils_test
2

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

9
var _ = Describe("PodmanTest test", func() {
10
	var podmanTest *FakePodmanTest
11

12
	BeforeEach(func() {
13
		podmanTest = FakePodmanTestCreate()
14
	})
15

16
	AfterEach(func() {
17
		FakeOutputs = make(map[string][]string)
18
	})
19

20
	It("Test NumberOfContainersRunning", func() {
21
		FakeOutputs["ps -q"] = []string{"one", "two"}
22
		Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
23
	})
24

25
	It("Test NumberOfContainers", func() {
26
		FakeOutputs["ps -aq"] = []string{"one", "two"}
27
		Expect(podmanTest.NumberOfContainers()).To(Equal(2))
28
	})
29

30
	It("Test NumberOfPods", func() {
31
		FakeOutputs["pod ps -q"] = []string{"one", "two"}
32
		Expect(podmanTest.NumberOfPods()).To(Equal(2))
33
	})
34

35
	It("Test WaitForContainer", func() {
36
		FakeOutputs["ps -q"] = []string{"one", "two"}
37
		Expect(WaitForContainer(podmanTest)).To(BeTrue())
38

39
		FakeOutputs["ps -q"] = []string{"one"}
40
		Expect(WaitForContainer(podmanTest)).To(BeTrue())
41

42
		FakeOutputs["ps -q"] = []string{""}
43
		Expect(WaitForContainer(podmanTest)).To(Not(BeTrue()))
44
	})
45

46
	It("Test GetContainerStatus", func() {
47
		FakeOutputs["ps --all --format={{.Status}}"] = []string{"Need func update"}
48
		Expect(podmanTest.GetContainerStatus()).To(Equal("Need func update"))
49
	})
50

51
	It("Test WaitContainerReady", func() {
52
		FakeOutputs["logs testimage"] = []string{""}
53
		Expect(WaitContainerReady(podmanTest, "testimage", "ready", 2, 1)).To(Not(BeTrue()))
54

55
		FakeOutputs["logs testimage"] = []string{"I am ready"}
56
		Expect(WaitContainerReady(podmanTest, "testimage", "am ready", 2, 1)).To(BeTrue())
57

58
		FakeOutputs["logs testimage"] = []string{"I am ready"}
59
		Expect(WaitContainerReady(podmanTest, "testimage", "", 2, 1)).To(BeTrue())
60
	})
61

62
})
63

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

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

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

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