Skip to content

Commit 8c2ac17

Browse files
craig[bot]iskettaneh
andcommitted
Merge #151680
151680: kvcoord: deflake TestDistSenderReplicaStall r=iskettaneh a=iskettaneh Previously, the test would timeout after 30 seconds if it hasn't finished successfully. However, the 30 seconds countdown start from the beginning of the test, before creating the test cluster and running it. A few failures happened because the nodes took a long time in the CI to actually become up and running. This commit deflakes the test by starting the 30 seconds countdown after test cluster is actually functional. References: #151660 Release note: None Co-authored-by: iskettaneh <[email protected]>
2 parents 2134917 + 7491a69 commit 8c2ac17

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pkg/kv/kvclient/kvcoord/dist_sender_circuit_breaker_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ func TestDistSenderReplicaStall(t *testing.T) {
5050
}
5151

5252
testutils.RunTrueAndFalse(t, "clientTimeout", func(t *testing.T, clientTimeout bool) {
53-
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
54-
defer time.AfterFunc(29*time.Second, func() {
55-
log.Errorf(ctx, "about to time out, all stacks:\n\n%s", allstacks.Get())
56-
}).Stop()
57-
defer cancel()
53+
ctx := context.Background()
5854

5955
// The lease won't move unless we use expiration-based leases. We also
6056
// speed up the test by reducing various intervals and timeouts.
@@ -89,6 +85,12 @@ func TestDistSenderReplicaStall(t *testing.T) {
8985
desc := tc.AddVotersOrFatal(t, key, tc.Targets(1, 2)...)
9086
t.Logf("created %s", desc)
9187

88+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
89+
defer time.AfterFunc(29*time.Second, func() {
90+
log.Errorf(ctx, "about to time out, all stacks:\n\n%s", allstacks.Get())
91+
}).Stop()
92+
defer cancel()
93+
9294
// Move the lease to n3, and make sure everyone has applied it by
9395
// replicating a write.
9496
tc.TransferRangeLeaseOrFatal(t, desc, tc.Target(2))

0 commit comments

Comments
 (0)