Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Artoul committed Sep 4, 2019
1 parent f570a8c commit 0052fb2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dbnode/storage/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func TestDatabaseAssignShardSet(t *testing.T) {
wg.Wait()
}

func TestDatabaseAssignShardSetDoesNotUpdateLastReceivedNewShardsIfNoNewShards(t *testing.T) {
func TestDatabaseAssignShardSetBehaviorNoNewShards(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()

Expand All @@ -413,6 +413,11 @@ func TestDatabaseAssignShardSetDoesNotUpdateLastReceivedNewShardsIfNoNewShards(t
close(mapCh)
}()

// Set a mock mediator to be certain that bootstrap is not called when
// no new shards are assigned.
mediator := NewMockdatabaseMediator(ctrl)
d.mediator = mediator

var ns []*MockdatabaseNamespace
ns = append(ns, dbAddNewMockNamespace(ctrl, d, "testns1"))
ns = append(ns, dbAddNewMockNamespace(ctrl, d, "testns2"))
Expand All @@ -427,6 +432,7 @@ func TestDatabaseAssignShardSetDoesNotUpdateLastReceivedNewShardsIfNoNewShards(t

t1 := d.lastReceivedNewShards
d.AssignShardSet(d.shardSet)
// Ensure that lastReceivedNewShards is not updated if no new shards are assigned.
require.True(t, d.lastReceivedNewShards.Equal(t1))

wg.Wait()
Expand Down

0 comments on commit 0052fb2

Please sign in to comment.