Skip to content

Commit

Permalink
Fixed possible race in unit test assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Linas Naginionis committed Oct 6, 2021
1 parent e09cc8b commit 52b554e
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 @@ -724,7 +724,7 @@ func TestDatabaseAddNamespaceBootstrapEnqueue(t *testing.T) {
// Usually this update should complete in a few seconds.
require.True(t, xclock.WaitUntil(func() bool {
return nsHooks.addCount() == 1
}, 10*time.Minute))
}, 1*time.Minute))
require.True(t, xclock.WaitUntil(func() bool {
return len(d.Namespaces()) == 3
}, 2*time.Second))
Expand Down Expand Up @@ -1752,6 +1752,12 @@ func assertFileOpsEnabled(t *testing.T, d *db) {
mediator := d.mediator.(*mediator)
coldFlushManager := mediator.databaseColdFlushManager.(*coldFlushManager)
fileSystemManager := mediator.databaseFileSystemManager.(*fileSystemManager)

coldFlushManager.RLock()
require.True(t, coldFlushManager.enabled)
coldFlushManager.RUnlock()

fileSystemManager.RLock()
require.True(t, fileSystemManager.enabled)
fileSystemManager.RUnlock()
}

0 comments on commit 52b554e

Please sign in to comment.