Skip to content

Commit 86b6124

Browse files
committed
rangefeed: deflake TestUnbufferedRegWithStreamManager
Under stress, this test would fail because attempting to publish 20 events in a tight loop would overwhelm the processor's event buffer (which has a capacity of 16). Epic: none Release note: None
1 parent e0fae3c commit 86b6124

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/kv/kvserver/rangefeed/unbuffered_registration_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ func TestUnbufferedRegWithStreamManager(t *testing.T) {
6565
})
6666
})
6767
testServerStream.reset()
68-
t.Run("publish 20 logical ops to 50 registrations", func(t *testing.T) {
69-
for i := 0; i < 20; i++ {
68+
eventCount := testProcessorEventCCap - 1
69+
t.Run(fmt.Sprintf("publish %d logical ops to 50 registrations", eventCount), func(t *testing.T) {
70+
for range eventCount {
7071
p.ConsumeLogicalOps(ctx, writeValueOp(hlc.Timestamp{WallTime: 1}))
7172
}
72-
testServerStream.waitForEventCount(t, 20*50)
73+
testServerStream.waitForEventCount(t, eventCount*50)
7374
testServerStream.iterateEventsByStreamID(func(_ int64, events []*kvpb.MuxRangeFeedEvent) {
74-
require.Equal(t, 20, len(events))
75+
require.Equal(t, eventCount, len(events))
7576
require.NotNil(t, events[0].RangeFeedEvent.Val)
7677
})
7778
})

0 commit comments

Comments
 (0)