diff --git a/pkg/cmd/roachtest/tests/disk_stall.go b/pkg/cmd/roachtest/tests/disk_stall.go index 13eee2858266..10065d9941a1 100644 --- a/pkg/cmd/roachtest/tests/disk_stall.go +++ b/pkg/cmd/roachtest/tests/disk_stall.go @@ -159,7 +159,15 @@ func runDiskStalledDetection( m.ExpectDeath() } s.Stall(ctx, c.Node(1)) - defer s.Unstall(ctx, c.Node(1)) + { + // NB: We use a background context in the defer'ed unstall command, + // otherwise on test failure our c.Run calls will be ignored. Leaving + // the disk stalled will prevent artifact collection, making debugging + // difficult. + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + defer s.Unstall(ctx, c.Node(1)) + } // Wait twice the maximum sync duration and check if our SQL connection to // node 1 is still alive. It should've been terminated.