mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-28 03:07:56 +00:00
A bool assert on the parsed repo/tag map says nothing about the actual images output when it fails. Match the line with a regex instead, the failure then prints every line and the pattern. This also removes tagOutputToMap which had no other user. Part of #18540. Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
package utils_test
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
. "go.podman.io/podman/v6/test/utils"
|
|
)
|
|
|
|
var _ = Describe("PodmanSession test", func() {
|
|
var session *PodmanSession
|
|
|
|
BeforeEach(func() {
|
|
session = StartFakeCmdSession([]string{"PodmanSession", "test", "Podman Session"})
|
|
session.WaitWithDefaultTimeout()
|
|
})
|
|
|
|
It("Test OutputToString", func() {
|
|
Expect(session.OutputToString()).To(Equal("PodmanSession test Podman Session"))
|
|
})
|
|
|
|
It("Test OutputToStringArray", func() {
|
|
Expect(session.OutputToStringArray()).To(Equal([]string{"PodmanSession", "test", "Podman Session"}))
|
|
})
|
|
|
|
It("Test ErrorToString", func() {
|
|
Expect(session.ErrorToString()).To(Equal("PodmanSession test Podman Session"))
|
|
})
|
|
|
|
It("Test ErrorToStringArray", func() {
|
|
Expect(session.ErrorToStringArray()).To(Equal([]string{"PodmanSession", "test", "Podman Session"}))
|
|
})
|
|
|
|
It("Test ErrorToStringArray with empty output", func() {
|
|
session = StartFakeCmdSession([]string{})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ErrorToStringArray()).To(BeEmpty())
|
|
})
|
|
|
|
It("Test IsJSONOutputValid", func() {
|
|
session = StartFakeCmdSession([]string{`{"page":1,"fruits":["apple","peach","pear"]}`})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
|
|
|
session = StartFakeCmdSession([]string{"I am not JSON"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.IsJSONOutputValid()).To(Not(BeTrue()))
|
|
})
|
|
|
|
It("Test WaitWithDefaultTimeout", func() {
|
|
session = StartFakeCmdSession([]string{"sleep", "2"})
|
|
Expect(session.ExitCode()).Should(Equal(-1))
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).Should(Equal(0))
|
|
})
|
|
})
|