Skip to content

Commit

Permalink
Test dadoo should not write exit code when runc exec fails
Browse files Browse the repository at this point in the history
[#158383828]

Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
  • Loading branch information
yulianedyalkova authored and georgethebeatle committed Jun 15, 2018
1 parent 28d8ed2 commit f24d19f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions rundmc/execrunner/dadoo/execrunner_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,15 @@ var _ = Describe("Dadoo ExecRunner", func() {
}
}

// return exit status of runc on fd3
if !dadooPanicsBeforeReportingRuncExitCode {
// if dadooPanics then closes the pipe without writing a value
_, err = fd3.Write([]byte{runcReturns})
Expect(err).NotTo(HaveOccurred())
if dadooPanicsBeforeReportingRuncExitCode {
fd3.Close()
return
}

// return exit status of runc on fd3
_, err = fd3.Write([]byte{runcReturns})
Expect(err).NotTo(HaveOccurred())

fd3.Close()
// write exit code of actual process to $processdir/exitcode file
if exitCode != nil {
Expand Down Expand Up @@ -381,6 +384,7 @@ var _ = Describe("Dadoo ExecRunner", func() {
Context("when runc exec fails", func() {
BeforeEach(func() {
runcReturns = 3
dadooWritesExitCode = nil
})

It("cleans up the process dir", func() {
Expand Down Expand Up @@ -482,6 +486,7 @@ var _ = Describe("Dadoo ExecRunner", func() {
Context("when `runC exec` fails", func() {
BeforeEach(func() {
runcReturns = 3
dadooWritesExitCode = nil
})

It("return an error including the last log line when runC fails to start the container", func() {
Expand Down

0 comments on commit f24d19f

Please sign in to comment.