Skip to content

Commit 8c971c5

Browse files
stttsJefftree
authored andcommitted
kube-apiserver/leaderelection/test: fixing waiting for informer
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
1 parent cd69335 commit 8c971c5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/controlplane/controller/leaderelection/leasecandidategc_controller_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ func TestLeaseCandidateGCController(t *testing.T) {
115115
leaseCandidateInformer := informerFactory.Coordination().V1alpha1().LeaseCandidates()
116116
controller := NewLeaseCandidateGC(client, 10*time.Millisecond, leaseCandidateInformer)
117117

118-
informerFactory.Start(ctx.Done())
119-
informerFactory.WaitForCacheSync(ctx.Done())
120-
121118
// Create lease candidates
122119
for _, lc := range tc.leaseCandidates {
123120
_, err := client.CoordinationV1alpha1().LeaseCandidates(lc.Namespace).Create(ctx, lc, metav1.CreateOptions{})
@@ -126,7 +123,8 @@ func TestLeaseCandidateGCController(t *testing.T) {
126123
}
127124
}
128125

129-
cache.WaitForCacheSync(ctx.Done(), controller.leaseCandidatesSynced)
126+
informerFactory.Start(ctx.Done())
127+
informerFactory.WaitForCacheSync(ctx.Done())
130128

131129
go controller.Run(ctx)
132130
err := wait.PollUntilContextTimeout(ctx, 100*time.Millisecond, 600*time.Second, true, func(ctx context.Context) (done bool, err error) {

0 commit comments

Comments
 (0)