mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Deflake TestControllerSync
This commit is contained in:
parent
ec560b9737
commit
c4c946d35d
@ -25,6 +25,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
storagev1 "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
@ -160,11 +161,15 @@ func TestControllerSync(t *testing.T) {
|
|||||||
for len(ctrl.claims.ListKeys()) > 0 {
|
for len(ctrl.claims.ListKeys()) > 0 {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
}
|
}
|
||||||
// make sure the operation timestamp cache is NOT empty
|
// wait for volume delete operation to appear once volumeWorker() runs
|
||||||
if !ctrl.operationTimestamps.Has("volume5-6") {
|
return wait.PollImmediate(10*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
|
||||||
return errors.New("failed checking timestamp cache: should not be empty")
|
// make sure the operation timestamp cache is NOT empty
|
||||||
}
|
if ctrl.operationTimestamps.Has("volume5-6") {
|
||||||
return nil
|
return true, nil
|
||||||
|
}
|
||||||
|
t.Logf("missing volume5-6 from timestamp cache, will retry")
|
||||||
|
return false, nil
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user