Skip to content

Commit 09786bc

Browse files
authored
Merge pull request #151698 from cockroachdb/blathers/backport-release-25.3-151680
release-25.3: kvcoord: deflake TestDistSenderReplicaStall
2 parents b6086c2 + b915e85 commit 09786bc

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)