Skip to content

Commit

Permalink
Define, and use, PodmanExitCleanlyWithOptions
Browse files Browse the repository at this point in the history
This is a generalization of PodmanExitCleanly, scalable
to an arbitrary number of possible options.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Jan 23, 2025
1 parent df9e8c3 commit 4bdb947
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 8 additions & 1 deletion test/e2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 4bdb947

Please sign in to comment.