Skip to content

Commit

Permalink
Merge #73436
Browse files Browse the repository at this point in the history
73436: kvserver: add timeouts for rangefeed test cases r=tbg a=erikgrinaker

This splits out some test tweaks from #72724, since we're exploring alternative approaches for that PR and may abandon it.

Release note: None

Co-authored-by: Erik Grinaker <[email protected]>
  • Loading branch information
craig[bot] and erikgrinaker committed Dec 7, 2021
2 parents 39923c0 + c3836b0 commit bad623e
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions pkg/kv/kvserver/replica_rangefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ func TestReplicaRangefeed(t *testing.T) {
Span: rangefeedSpan,
WithDiff: true,
}
pErr := store.RangeFeed(&req, stream)
streamErrC <- pErr
timer := time.AfterFunc(10*time.Second, stream.Cancel)
defer timer.Stop()
streamErrC <- store.RangeFeed(&req, stream)
}(i)
}

Expand Down Expand Up @@ -501,8 +502,9 @@ func TestReplicaRangefeedRetryErrors(t *testing.T) {
},
Span: rangefeedSpan,
}
pErr := store.RangeFeed(&req, stream)
streamErrC <- pErr
timer := time.AfterFunc(10*time.Second, stream.Cancel)
defer timer.Stop()
streamErrC <- store.RangeFeed(&req, stream)
}()

// Wait for the first checkpoint event.
Expand Down Expand Up @@ -535,6 +537,8 @@ func TestReplicaRangefeedRetryErrors(t *testing.T) {
},
Span: rangefeedSpan,
}
timer := time.AfterFunc(10*time.Second, stream.Cancel)
defer timer.Stop()
streamErrC <- store.RangeFeed(&req, stream)
}()

Expand Down Expand Up @@ -577,9 +581,9 @@ func TestReplicaRangefeedRetryErrors(t *testing.T) {
},
Span: rangefeedLeftSpan,
}

pErr := store.RangeFeed(&req, streamLeft)
streamLeftErrC <- pErr
timer := time.AfterFunc(10*time.Second, streamLeft.Cancel)
defer timer.Stop()
streamLeftErrC <- store.RangeFeed(&req, streamLeft)
}()

// Establish a rangefeed on the right replica.
Expand All @@ -593,9 +597,9 @@ func TestReplicaRangefeedRetryErrors(t *testing.T) {
},
Span: rangefeedRightSpan,
}

pErr := store.RangeFeed(&req, streamRight)
streamRightErrC <- pErr
timer := time.AfterFunc(10*time.Second, streamRight.Cancel)
defer timer.Stop()
streamRightErrC <- store.RangeFeed(&req, streamRight)
}()

// Wait for the first checkpoint event on each stream.
Expand Down Expand Up @@ -647,12 +651,9 @@ func TestReplicaRangefeedRetryErrors(t *testing.T) {
},
Span: rangefeedSpan,
}

timer := time.AfterFunc(10*time.Second, stream.Cancel)
defer timer.Stop()

pErr := partitionStore.RangeFeed(&req, stream)
streamErrC <- pErr
streamErrC <- partitionStore.RangeFeed(&req, stream)
}()

// Wait for the first checkpoint event.
Expand Down Expand Up @@ -757,8 +758,9 @@ func TestReplicaRangefeedRetryErrors(t *testing.T) {
Span: rangefeedSpan,
}
kvserver.RangefeedEnabled.Override(ctx, &store.ClusterSettings().SV, true)
pErr := store.RangeFeed(&req, stream)
streamErrC <- pErr
timer := time.AfterFunc(10*time.Second, stream.Cancel)
defer timer.Stop()
streamErrC <- store.RangeFeed(&req, stream)
}()

// Wait for the first checkpoint event.
Expand Down

0 comments on commit bad623e

Please sign in to comment.