Skip to content

Commit

Permalink
Next bootstrapper gets called in all cases now even in the empty rang…
Browse files Browse the repository at this point in the history
…es and no remamining unfulfilled ranges case.
  • Loading branch information
notbdu committed Aug 6, 2020
1 parent a68e4c2 commit e96b5ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/dbnode/storage/bootstrap/bootstrapper/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ func TestBaseBootstrapperEmptyRangeWithIndex(t *testing.T) {
func testBaseBootstrapperEmptyRange(t *testing.T, withIndex bool) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
src, _, base := testBaseBootstrapper(t, ctrl)
src, next, base := testBaseBootstrapper(t, ctrl)
testNs := testNsMetadata(t, withIndex)

rngs := result.NewShardTimeRanges()
unfulfilled := xtime.NewRanges()
nsResults := testResult(testNs, withIndex, testShard, unfulfilled)
nextResult := testResult(testNs, withIndex, testShard, xtime.NewRanges())
shardRangeMatcher := bootstrap.ShardTimeRangesMatcher{Ranges: rngs}
src.EXPECT().AvailableData(testNs, shardRangeMatcher, testDefaultRunOpts).
Return(rngs, nil)
Expand All @@ -155,6 +156,7 @@ func testBaseBootstrapperEmptyRange(t *testing.T, withIndex bool) {
) (bootstrap.NamespaceResults, error) {
return nsResults, nil
})
next.EXPECT().Bootstrap(gomock.Any(), matcher).Return(nextResult, nil)

// Test non-nil empty range
tester.TestBootstrapWith(base)
Expand All @@ -176,11 +178,12 @@ func TestBaseBootstrapperCurrentNoUnfulfilledWithIndex(t *testing.T) {
func testBaseBootstrapperCurrentNoUnfulfilled(t *testing.T, withIndex bool) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
src, _, base := testBaseBootstrapper(t, ctrl)
src, next, base := testBaseBootstrapper(t, ctrl)
testNs := testNsMetadata(t, withIndex)

unfulfilled := xtime.NewRanges()
nsResults := testResult(testNs, withIndex, testShard, unfulfilled)
nextResult := testResult(testNs, withIndex, testShard, xtime.NewRanges())

targetRanges := testShardTimeRanges()
src.EXPECT().AvailableData(testNs, targetRanges, testDefaultRunOpts).
Expand All @@ -203,6 +206,7 @@ func testBaseBootstrapperCurrentNoUnfulfilled(t *testing.T, withIndex bool) {
) (bootstrap.NamespaceResults, error) {
return nsResults, nil
})
next.EXPECT().Bootstrap(gomock.Any(), matcher).Return(nextResult, nil)

tester.TestBootstrapWith(base)
assert.Equal(t, nsResults, tester.Results)
Expand Down

0 comments on commit e96b5ca

Please sign in to comment.