Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
98943: kvserver: increase `TestReplicateQueueExpirationLeasesOnly` timeouts r=erikgrinaker a=erikgrinaker

Resolves cockroachdb#98939.

Epic: none
Release note: None

Co-authored-by: Erik Grinaker <[email protected]>
  • Loading branch information
craig[bot] and erikgrinaker committed Mar 18, 2023
2 parents 0a72a49 + 7227a32 commit b791abd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/kv/kvserver/replicate_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,11 @@ func TestReplicateQueueExpirationLeasesOnly(t *testing.T) {
skip.UnderRace(t) // too slow under stressrace
skip.UnderShort(t)

timeout := 5 * time.Second
if skip.Stress() {
timeout = 30 * time.Second
}

ctx := context.Background()
tc := testcluster.StartTestCluster(t, 3, base.TestClusterArgs{
ServerArgs: base.TestServerArgs{
Expand Down Expand Up @@ -2410,12 +2415,12 @@ func TestReplicateQueueExpirationLeasesOnly(t *testing.T) {
require.NoError(t, err)
require.Eventually(t, func() bool {
epochLeases, expLeases = countLeases()
t.Logf("enabling: epochLeases=%d expLeases=%d", epochLeases, expLeases)
return epochLeases == 0 && expLeases > 0
}, 10*time.Second, 200*time.Millisecond)
t.Logf("enabled: epochLeases=%d expLeases=%d", epochLeases, expLeases)
}, timeout, 500*time.Millisecond)

// Run a scan across the ranges, just to make sure they work.
scanCtx, cancel := context.WithTimeout(ctx, 3*time.Second)
scanCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
_, err = db.Scan(scanCtx, scratchKey, scratchKey.PrefixEnd(), 1)
require.NoError(t, err)
Expand All @@ -2429,7 +2434,7 @@ func TestReplicateQueueExpirationLeasesOnly(t *testing.T) {
require.NoError(t, err)
require.Eventually(t, func() bool {
epochLeases, expLeases = countLeases()
t.Logf("disabling: epochLeases=%d expLeases=%d", epochLeases, expLeases)
return epochLeases > 0 && expLeases > 0 && expLeases <= initialExpLeases
}, 10*time.Second, 200*time.Millisecond)
t.Logf("disabled: epochLeases=%d expLeases=%d", epochLeases, expLeases)
}, timeout, 500*time.Millisecond)
}

0 comments on commit b791abd

Please sign in to comment.