Skip to content

Commit 973d78a

Browse files
committed
roachtest: only use timestamp when taking snapshot for invariant problem
We take the risk that two tests could attempt to create a snapshot at the same exact millisecond, as we have a 63 character limit on the snapshot name and the cluster name usually exceeds this by itself.
1 parent e6f59d7 commit 973d78a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/cmd/roachtest/test_runner.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,8 +1834,11 @@ func (r *testRunner) maybeSaveClusterDueToInvariantProblems(
18341834
for _, det := range dets {
18351835
if det.Stdout != "" {
18361836
_ = c.Extend(ctx, 7*24*time.Hour, t.L())
1837-
timestamp := timeutil.Now().Format("20060102_150405")
1838-
snapName := fmt.Sprintf("invariant-problem-%s-%s", c.Name(), timestamp)
1837+
timestamp := timeutil.Now().UnixMilli()
1838+
// We take the risk that two tests could attempt to create a snapshot
1839+
// at the same exact millisecond, as we have a 63 character limit on
1840+
// the name and the cluster name usually exceeds this by itself.
1841+
snapName := fmt.Sprintf("invariant-problem-%d", timestamp)
18391842
if _, err := c.CreateSnapshot(ctx, snapName); err != nil {
18401843
t.L().Printf("failed to create snapshot %q: %s", snapName, err)
18411844
snapName = "<failed>"

0 commit comments

Comments
 (0)