Refactor more code to use testutils.WasCalled (#13054)
* Refactor more code to use testutils.WasCalled * incorporate review comments * Revert watcher_test.go changes The file is in config package and the other tests use config_test. So it is not visible.
Этот коммит содержится в:
коммит произвёл
Saturnino Abril
родитель
0c8b580458
Коммит
2db6823f5d
@@ -513,11 +513,7 @@ func TestDatabaseStoreSet(t *testing.T) {
|
||||
id, _ := getActualDatabaseConfig(t)
|
||||
assert.NotEqual(t, activeId, id, "new record should have been written")
|
||||
|
||||
select {
|
||||
case <-called:
|
||||
case <-time.After(5 * time.Second):
|
||||
require.Fail(t, "callback should have been called when config written")
|
||||
}
|
||||
require.True(t, wasCalled(called, 5*time.Second), "callback should have been called when config written")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -754,11 +750,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
|
||||
err = ds.Load()
|
||||
require.NoError(t, err)
|
||||
|
||||
select {
|
||||
case <-called:
|
||||
case <-time.After(5 * time.Second):
|
||||
require.Fail(t, "callback should have been called when config loaded")
|
||||
}
|
||||
require.True(t, wasCalled(called, 5*time.Second), "callback should have been called when config loaded")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user