Skip to content

feat: Add test to check exit code #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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