Commit 48771537 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26772 from jsafrane/flake-controller-cache-empty

Automatic merge from submit-queue Wait for all volumes/claims to get synced in unit test. Controller.HasSynced() returns true when all initial claims/volumes were sent to appropriate goroutines, not when the goroutine has actually processed them. Fixes #26712
parents 9dc06e85 962505ad
......@@ -111,8 +111,12 @@ func TestControllerSync(t *testing.T) {
defer ctrl.Stop()
go ctrl.Run()
// Wait for the controller to pass initial sync.
for !ctrl.volumeController.HasSynced() || !ctrl.claimController.HasSynced() {
// Wait for the controller to pass initial sync and fill its caches.
for !ctrl.volumeController.HasSynced() ||
!ctrl.claimController.HasSynced() ||
len(ctrl.claims.ListKeys()) < len(test.initialClaims) ||
len(ctrl.volumes.store.ListKeys()) < len(test.initialVolumes) {
time.Sleep(10 * time.Millisecond)
}
glog.V(4).Infof("controller synced, starting test")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment