diff --git a/pkg/encryption/key_manager_test.go b/pkg/encryption/key_manager_test.go index e827a714a3a..539cc85d070 100644 --- a/pkg/encryption/key_manager_test.go +++ b/pkg/encryption/key_manager_test.go @@ -329,8 +329,7 @@ func TestWatcher(t *testing.T) { // Listen on watcher event reloadEvent := make(chan struct{}, 10) helper.eventAfterReloadByWatcher = func() { - var e struct{} - reloadEvent <- e + reloadEvent <- struct{}{} } // Use default config. config := &Config{} @@ -339,6 +338,7 @@ func TestWatcher(t *testing.T) { // Create the key manager. m, err := newKeyManagerImpl(client, config, helper) re.NoError(err) + re.NoError(m.loadKeys()) go m.StartBackgroundLoop(ctx) _, err = m.GetKey(123) re.Error(err)