Skip to content

Commit 345a86b

Browse files
craig[bot]tbg
andcommitted
Merge #156369
156369: roachtest: simplify and deflake cleanup in clock jump test r=tbg a=tbg Closes #156339. Passing test run: https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Nightlies_RoachtestNightlyGceBazel/20660221?hideTestsFromDependencies=false&hideProblemsFromDependencies=false Epic: none Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
2 parents e00f221 + bcfb934 commit 345a86b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

pkg/cmd/roachtest/tests/clock_jump_crash.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,7 @@ func runClockJump(ctx context.Context, t test.Test, c cluster.Cluster, tc clockJ
5454
// test is done to pacify the dead node detector. Do this after the
5555
// clock offset is reset or the node will crash again.
5656
var aliveAfterOffset bool
57-
defer func() {
58-
offsetInjector.recover(ctx, c.Spec().NodeCount)
59-
// Resetting the clock is a jump in the opposite direction which
60-
// can cause a crash even if the original jump didn't. Wait a few
61-
// seconds before checking whether the node is alive and
62-
// restarting it if not.
63-
time.Sleep(3 * time.Second)
64-
if !isAlive(db, t.L()) {
65-
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), c.Node(1))
66-
}
67-
}()
57+
6858
defer offsetInjector.recover(ctx, c.Spec().NodeCount)
6959
offsetInjector.offset(ctx, c.Spec().NodeCount, tc.offset)
7060

@@ -76,6 +66,13 @@ func runClockJump(ctx context.Context, t test.Test, c cluster.Cluster, tc clockJ
7666
if aliveAfterOffset != tc.aliveAfterOffset {
7767
t.Fatalf("Expected node health %v, got %v", tc.aliveAfterOffset, aliveAfterOffset)
7868
}
69+
70+
// Resetting the clock is a jump in the opposite direction which can cause a
71+
// crash even if the original jump didn't. Since we do not control when
72+
// exactly the clock jumps, we simply stop and wipe the node (which also
73+
// prevents the post-test assertions from complaining about a down node).
74+
c.Wipe(ctx, c.All())
75+
offsetInjector.recover(ctx, c.Spec().NodeCount)
7976
}
8077

8178
type clockJumpTestCase struct {

0 commit comments

Comments
 (0)