Skip to content

Commit

Permalink
roachtest: fix cluster-init
Browse files Browse the repository at this point in the history
This is an edulcorated backport of cockroachdb#69940, which cannot be backported
as-is due to severe roachtest infra changes.

Release justification: test-only changes

Release note: None
  • Loading branch information
knz committed Sep 15, 2021
1 parent cbd3c9f commit e8801ee
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/cmd/roachtest/cluster_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ func runClusterInit(ctx context.Context, t *test, c *cluster) {
c.Wipe(ctx)

func() {
// At the end of each iteration, wipe the cluster if the test
// has succeeded. This is useful because the `roachprod
// monitor` command at the end seems to be confused by `start`
// commands that were not issued by c.Start(). Wipe the data
// directory at the end before the test function terminates
// ensures that the monitor check does not run.
defer func() {
// Defers are run unconditionally, even during a Fatal call.
if !t.Failed() {
c.l.Printf("wiping cluster after test success")
c.Wipe(ctx)
}
}()

var g errgroup.Group
for i := 1; i <= c.spec.NodeCount; i++ {
i := i
Expand Down

0 comments on commit e8801ee

Please sign in to comment.