Skip to content

Commit

Permalink
kvserver: use leader leases in TestFlowControlSendQueueRangeSplitMerge
Browse files Browse the repository at this point in the history
Use leader leases in this test, to avoid the leader changing while the
test doesn't expect it. Also, to further test leader leases.

Part of: #132614
Release note: None
  • Loading branch information
kvoli committed Dec 6, 2024
1 parent ea3b62f commit 69ab1fb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/kv/kvserver/flow_control_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5691,6 +5691,13 @@ func TestFlowControlSendQueueRangeSplitMerge(t *testing.T) {
// lower (8 and 16 MiB default).
kvflowcontrol.ElasticTokensPerStream.Override(ctx, &settings.SV, 2<<20)
kvflowcontrol.RegularTokensPerStream.Override(ctx, &settings.SV, 4<<20)
// This test doesn't want leadership changing hands, and leader leases (by
// virtue of raft fortification) help ensure this. Override to disable any
// metamorphosis.
kvserver.OverrideDefaultLeaseType(ctx, &settings.SV, roachpb.LeaseLeader)
// Using a manual clock here ensures that StoreLiveness support, once
// established, never expires. By extension, leadership should stay sticky.
manualClock := hlc.NewHybridManualClock()

disableWorkQueueGrantingServers := make([]atomic.Bool, numNodes)
setTokenReturnEnabled := func(enabled bool, serverIdxs ...int) {
Expand All @@ -5705,6 +5712,9 @@ func TestFlowControlSendQueueRangeSplitMerge(t *testing.T) {
argsPerServer[i] = base.TestServerArgs{
Settings: settings,
Knobs: base.TestingKnobs{
Server: &server.TestingKnobs{
WallClock: manualClock,
},
Store: &kvserver.StoreTestingKnobs{
FlowControlTestingKnobs: &kvflowcontrol.TestingKnobs{
UseOnlyForScratchRanges: true,
Expand Down

0 comments on commit 69ab1fb

Please sign in to comment.