Skip to content

Commit

Permalink
oci/tests/int: always propagate exit code
Browse files Browse the repository at this point in the history
Signed-off-by: Sunny <[email protected]>
  • Loading branch information
darkowlzz committed Jul 21, 2023
1 parent 0571631 commit 195404d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions oci/tests/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,11 @@ func TestMain(m *testing.M) {
log.Printf("Failed to stop environment: %v", err)
}

// Calling exit on panic prevents logging of panic error.
// Exit only on normal return. Explicitly detect panic and log the error
// on panic.
if err := recover(); err == nil {
os.Exit(exitCode)
} else {
// Log the panic error before exit to surface the cause of panic.
if err := recover(); err != nil {
log.Printf("panic: %v", err)
}
os.Exit(exitCode)
}()

// Get terraform state output.
Expand Down

0 comments on commit 195404d

Please sign in to comment.