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.
Этот коммит содержится в:
Agniva De Sarker
2019-11-13 13:41:26 +05:30
коммит произвёл Saturnino Abril
родитель 0c8b580458
Коммит 2db6823f5d
5 изменённых файлов: 30 добавлений и 62 удалений

Просмотреть файл

@@ -215,11 +215,7 @@ func TestMemoryStoreSet(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, oldCfg, retCfg)
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")
})
}
@@ -268,11 +264,7 @@ func TestMemoryStoreLoad(t *testing.T) {
err = ms.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")
})
}