Skip to content

Commit

Permalink
feat: Add test to check exit code (#180)
Browse files Browse the repository at this point in the history
Signed-off-by: Shubharanshu Mahapatra <[email protected]>
  • Loading branch information
Shubhranshu153 authored Aug 20, 2024
1 parent 0b08ffe commit 5710c25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ func Run(o *RunOption) {
})
})

ginkgo.It("container should exit with exit code in case of an error", func() {
exitCode := 10
cmd := fmt.Sprintf("exit %d", exitCode)
session := command.RunWithoutSuccessfulExit(o.BaseOpt, "run", "--rm", "--name", testContainerName,
localImages[defaultImage], "sh", "-c", cmd)
gomega.Expect(session.ExitCode()).To(gomega.Equal(exitCode))
})

ginkgo.It("with --rm flag, container should be removed when it exits", func() {
command.Run(o.BaseOpt, "run", "--rm", "--name", testContainerName, localImages[defaultImage])
err := containerShouldNotExist(o.BaseOpt, testContainerName)
Expand Down

0 comments on commit 5710c25

Please sign in to comment.