Define, and use, PodmanExitCleanlyWithOptions

This is a generalization of PodmanExitCleanly, scalable
to an arbitrary number of possible options.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2025-01-22 23:31:42 +01:00
parent df9e8c3ce6
commit 4bdb947d72
2 changed files with 9 additions and 4 deletions

View File

@ -492,7 +492,14 @@ func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData {
// It returns the session (to allow consuming output if desired).
func (p *PodmanTestIntegration) PodmanExitCleanly(args ...string) *PodmanSessionIntegration {
GinkgoHelper()
session := p.Podman(args)
return p.PodmanExitCleanlyWithOptions(PodmanExecOptions{}, args...)
}
// PodmanExitCleanlyWithOptions runs a podman command with (optinos, args), and expects it to ExitCleanly within the default timeout.
// It returns the session (to allow consuming output if desired).
func (p *PodmanTestIntegration) PodmanExitCleanlyWithOptions(options PodmanExecOptions, args ...string) *PodmanSessionIntegration {
GinkgoHelper()
session := p.PodmanWithOptions(options, args...)
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
return session

View File

@ -457,11 +457,9 @@ var _ = Describe("Podman exec", func() {
files := []*os.File{
devNull,
}
session := podmanTest.PodmanWithOptions(PodmanExecOptions{
podmanTest.PodmanExitCleanlyWithOptions(PodmanExecOptions{
ExtraFiles: files,
}, "exec", "--preserve-fds", "1", "test1", "ls")
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
})
It("podman exec preserves --group-add groups", func() {