Merge pull request #93655 from liggitt/deflake-test-controller-sync

Deflake TestControllerSync
This commit is contained in:
Kubernetes Prow Robot 2020-08-03 23:22:18 -07:00 committed by GitHub
commit 1a05ebe2c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ import (
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/informers"
@ -160,11 +161,15 @@ func TestControllerSync(t *testing.T) {
for len(ctrl.claims.ListKeys()) > 0 {
time.Sleep(10 * time.Millisecond)
}
// make sure the operation timestamp cache is NOT empty
if !ctrl.operationTimestamps.Has("volume5-6") {
return errors.New("failed checking timestamp cache: should not be empty")
}
return nil
// wait for volume delete operation to appear once volumeWorker() runs
return wait.PollImmediate(10*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
// make sure the operation timestamp cache is NOT empty
if ctrl.operationTimestamps.Has("volume5-6") {
return true, nil
}
t.Logf("missing volume5-6 from timestamp cache, will retry")
return false, nil
})
},
},
{