mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
kube-apiserver/leaderelection/test: fixing waiting for informer
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
This commit is contained in:
parent
cd69335542
commit
8c971c5c15
@ -115,9 +115,6 @@ func TestLeaseCandidateGCController(t *testing.T) {
|
|||||||
leaseCandidateInformer := informerFactory.Coordination().V1alpha1().LeaseCandidates()
|
leaseCandidateInformer := informerFactory.Coordination().V1alpha1().LeaseCandidates()
|
||||||
controller := NewLeaseCandidateGC(client, 10*time.Millisecond, leaseCandidateInformer)
|
controller := NewLeaseCandidateGC(client, 10*time.Millisecond, leaseCandidateInformer)
|
||||||
|
|
||||||
informerFactory.Start(ctx.Done())
|
|
||||||
informerFactory.WaitForCacheSync(ctx.Done())
|
|
||||||
|
|
||||||
// Create lease candidates
|
// Create lease candidates
|
||||||
for _, lc := range tc.leaseCandidates {
|
for _, lc := range tc.leaseCandidates {
|
||||||
_, err := client.CoordinationV1alpha1().LeaseCandidates(lc.Namespace).Create(ctx, lc, metav1.CreateOptions{})
|
_, err := client.CoordinationV1alpha1().LeaseCandidates(lc.Namespace).Create(ctx, lc, metav1.CreateOptions{})
|
||||||
@ -126,7 +123,8 @@ func TestLeaseCandidateGCController(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.WaitForCacheSync(ctx.Done(), controller.leaseCandidatesSynced)
|
informerFactory.Start(ctx.Done())
|
||||||
|
informerFactory.WaitForCacheSync(ctx.Done())
|
||||||
|
|
||||||
go controller.Run(ctx)
|
go controller.Run(ctx)
|
||||||
err := wait.PollUntilContextTimeout(ctx, 100*time.Millisecond, 600*time.Second, true, func(ctx context.Context) (done bool, err error) {
|
err := wait.PollUntilContextTimeout(ctx, 100*time.Millisecond, 600*time.Second, true, func(ctx context.Context) (done bool, err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user