Skip to content

Commit 631a61b

Browse files
committed
roachtest: improve snap name and error handling
1 parent eb71e0f commit 631a61b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/cmd/roachtest/test_runner.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,12 @@ func (r *testRunner) maybeSaveClusterDueToInvariantProblems(
17021702
for _, det := range dets {
17031703
if det.Stdout != "" {
17041704
_ = c.Extend(ctx, 7*24*time.Hour, t.L())
1705-
snapName := "invariant-problem-" + c.Name() + "-" + strconv.Itoa(rand.Int())
1706-
_, _ = c.CreateSnapshot(ctx, snapName)
1705+
timestamp := timeutil.Now().Format("20060102_150405")
1706+
snapName := fmt.Sprintf("invariant-problem-%s-%s", c.Name(), timestamp)
1707+
if _, err := c.CreateSnapshot(ctx, snapName); err != nil {
1708+
t.L().Printf("failed to create snapshot %q: %s", snapName, err)
1709+
snapName = "<failed>"
1710+
}
17071711
c.Save(ctx, "invariant problem - snap name "+snapName, t.L())
17081712
t.Error("invariant problem - snap name " + snapName + ":\n" + det.Stdout)
17091713
return

0 commit comments

Comments
 (0)