Skip to content

Commit 366d7ba

Browse files
feat: Add test to check exit code
Signed-off-by: Shubharanshu Mahapatra <[email protected]>
1 parent 0b08ffe commit 366d7ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/run.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ func Run(o *RunOption) {
6767
})
6868
})
6969

70+
ginkgo.It("container should exit with exit code in case of an error", func() {
71+
exitCode := 10
72+
cmd := fmt.Sprintf("exit %d", exitCode)
73+
session := command.RunWithoutSuccessfulExit(o.BaseOpt, "run", "--rm", "--name", testContainerName, localImages[defaultImage], "sh", "-c", cmd)
74+
gomega.Expect(session.ExitCode()).To(gomega.Equal(exitCode))
75+
})
76+
7077
ginkgo.It("with --rm flag, container should be removed when it exits", func() {
7178
command.Run(o.BaseOpt, "run", "--rm", "--name", testContainerName, localImages[defaultImage])
7279
err := containerShouldNotExist(o.BaseOpt, testContainerName)

0 commit comments

Comments
 (0)