Skip to content

Commit 08dc6ce

Browse files
committed
roachtest: recover panics in post test assertions
We previously were recovering panics in the main test goroutine, but not post tests assertions, which could cause an entire CI run to crash. This patch adds a similar recover.
1 parent 769e7c7 commit 08dc6ce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/cmd/roachtest/test_runner.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,15 @@ func (r *testRunner) postTestAssertions(
17031703
_ = r.stopper.RunAsyncTask(ctx, "test-post-assertions", func(ctx context.Context) {
17041704
defer close(postAssertCh)
17051705

1706+
defer func() {
1707+
// Unlike the main test goroutine, we _do_ want to log t.Fatal* calls here
1708+
// to make it clear that the post-test assertions failed. Otherwise, the fatal
1709+
// will be recorded as a normal test failure.
1710+
if r := recover(); r != nil {
1711+
postAssertionErr(fmt.Errorf("post-test assertion panicked: %v", r))
1712+
}
1713+
}()
1714+
17061715
// We collect all the admin health endpoints in parallel,
17071716
// and select the first one that succeeds to run the validation queries
17081717
statuses, err := c.HealthStatus(ctx, t.L(), c.CRDBNodes())

0 commit comments

Comments
 (0)