4
. "github.com/containers/podman/v5/test/utils"
5
. "github.com/onsi/ginkgo/v2"
6
. "github.com/onsi/gomega"
9
var _ = Describe("PodmanTest test", func() {
10
var podmanTest *FakePodmanTest
13
podmanTest = FakePodmanTestCreate()
17
FakeOutputs = make(map[string][]string)
20
It("Test NumberOfContainersRunning", func() {
21
FakeOutputs["ps -q"] = []string{"one", "two"}
22
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
25
It("Test NumberOfContainers", func() {
26
FakeOutputs["ps -aq"] = []string{"one", "two"}
27
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
30
It("Test NumberOfPods", func() {
31
FakeOutputs["pod ps -q"] = []string{"one", "two"}
32
Expect(podmanTest.NumberOfPods()).To(Equal(2))
35
It("Test WaitForContainer", func() {
36
FakeOutputs["ps -q"] = []string{"one", "two"}
37
Expect(WaitForContainer(podmanTest)).To(BeTrue())
39
FakeOutputs["ps -q"] = []string{"one"}
40
Expect(WaitForContainer(podmanTest)).To(BeTrue())
42
FakeOutputs["ps -q"] = []string{""}
43
Expect(WaitForContainer(podmanTest)).To(Not(BeTrue()))
46
It("Test GetContainerStatus", func() {
47
FakeOutputs["ps --all --format={{.Status}}"] = []string{"Need func update"}
48
Expect(podmanTest.GetContainerStatus()).To(Equal("Need func update"))
51
It("Test WaitContainerReady", func() {
52
FakeOutputs["logs testimage"] = []string{""}
53
Expect(WaitContainerReady(podmanTest, "testimage", "ready", 2, 1)).To(Not(BeTrue()))
55
FakeOutputs["logs testimage"] = []string{"I am ready"}
56
Expect(WaitContainerReady(podmanTest, "testimage", "am ready", 2, 1)).To(BeTrue())
58
FakeOutputs["logs testimage"] = []string{"I am ready"}
59
Expect(WaitContainerReady(podmanTest, "testimage", "", 2, 1)).To(BeTrue())