mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-14 04:39:33 +00:00
For most callers podman run -d already makes sure the container runs so this does nothing and only slows the test down. For the signal test we can instead check for container output which is better as we know the pid1 is actually ready to get the signal. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package utils_test
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
. "go.podman.io/podman/v6/test/utils"
|
|
)
|
|
|
|
var _ = Describe("PodmanTest test", func() {
|
|
var podmanTest *FakePodmanTest
|
|
|
|
BeforeEach(func() {
|
|
podmanTest = FakePodmanTestCreate()
|
|
})
|
|
|
|
AfterEach(func() {
|
|
FakeOutputs = make(map[string][]string)
|
|
})
|
|
|
|
It("Test NumberOfContainersRunning", func() {
|
|
FakeOutputs["ps -q"] = []string{"one", "two"}
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
|
|
})
|
|
|
|
It("Test NumberOfContainers", func() {
|
|
FakeOutputs["ps -aq"] = []string{"one", "two"}
|
|
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
|
})
|
|
|
|
It("Test NumberOfPods", func() {
|
|
FakeOutputs["pod ps -q"] = []string{"one", "two"}
|
|
Expect(podmanTest.NumberOfPods()).To(Equal(2))
|
|
})
|
|
|
|
It("Test GetContainerStatus", func() {
|
|
FakeOutputs["ps --all --format={{.Status}}"] = []string{"Need func update"}
|
|
Expect(podmanTest.GetContainerStatus()).To(Equal("Need func update"))
|
|
})
|
|
|
|
It("Test WaitContainerReady", func() {
|
|
FakeOutputs["logs testimage"] = []string{""}
|
|
Expect(WaitContainerReady(podmanTest, "testimage", "ready", 2, 1)).To(Not(BeTrue()))
|
|
|
|
FakeOutputs["logs testimage"] = []string{"I am ready"}
|
|
Expect(WaitContainerReady(podmanTest, "testimage", "am ready", 2, 1)).To(BeTrue())
|
|
|
|
FakeOutputs["logs testimage"] = []string{"I am ready"}
|
|
Expect(WaitContainerReady(podmanTest, "testimage", "", 2, 1)).To(BeTrue())
|
|
})
|
|
})
|