Skip to content

Commit

Permalink
roachtest: skip post-test assertions on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Miral Gadani committed Aug 4, 2023
1 parent fedb692 commit 3c64af2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions pkg/cmd/roachtest/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,16 +1087,19 @@ func (r *testRunner) runTest(
t.ReplaceL(logger)
}

// Awkward file name to keep it close to test.log.
l.Printf("running post test assertions (test-post-assertions.log)")
replaceLogger("test-post-assertions")

// We still want to run the post-test assertions even if the test timed out as it
// might provide useful information about the health of the nodes. Any assertion failures
// will will be recorded against, and eventually fail, the test.
// TODO (miral): consider not running these assertions if the test has already failed
if err := r.postTestAssertions(ctx, t, c, 10*time.Minute); err != nil {
l.Printf("error during post test assertions: %v; see test-post-assertions.log for details", err)
if !t.Failed() {
// Awkward file name to keep it close to test.log.
l.Printf("running post test assertions (test-post-assertions.log)")
replaceLogger("test-post-assertions")

// We still want to run the post-test assertions even if the test timed out as it
// might provide useful information about the health of the nodes. Any assertion failures
// will will be recorded against, and eventually fail, the test.
if err := r.postTestAssertions(ctx, t, c, 10*time.Minute); err != nil {
l.Printf("error during post test assertions: %v; see test-post-assertions.log for details", err)
}
} else {
l.Printf("skipping post test assertions as test failed")
}

// From now on, all logging goes to test-teardown.log to give a clear separation between
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -2412,8 +2412,8 @@ func WithDisplay(display string) ParallelOption {
}

// Parallel runs a user-defined function across the nodes in the
// cluster. If any of the commands fail, Parallel will log an error
// and exit the program.
// cluster. If any of the commands fail, Parallel will log each failure
// and return an error.
//
// A user may also pass in a RunRetryOpts to control how the function is retried
// in the case of a failure.
Expand Down

0 comments on commit 3c64af2

Please sign in to comment.