Skip to content

Commit a6ee859

Browse files
committed
chore: use WaitForCacheSync method after sharedInformerFactory Start
1 parent 14b34fc commit a6ee859

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

test/integration/servicecidr/migration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
8282
client1,
8383
).Run(tCtx, 5)
8484
informers1.Start(tCtx.Done())
85+
informers1.WaitForCacheSync(tCtx.Done())
8586

8687
// the default serviceCIDR should have a finalizer and ready condition set to true
8788
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
@@ -220,6 +221,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
220221
client2,
221222
).Run(tCtx2, 5)
222223
informers2.Start(tCtx2.Done())
224+
informers2.WaitForCacheSync(tCtx.Done())
223225

224226
// delete the kubernetes.default service so the old DefaultServiceCIDR can be deleted
225227
// and the new apiserver can take over

test/integration/servicecidr/servicecidr_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
6868
client,
6969
).Run(ctx, 5)
7070
informerFactory.Start(ctx.Done())
71+
informerFactory.WaitForCacheSync(ctx.Done())
7172

7273
// /29 = 6 services, kubernetes.default takes the first address
7374
// make 5 more services to take up all IPs
@@ -169,6 +170,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
169170
client,
170171
).Run(ctx, 5)
171172
informerFactory.Start(ctx.Done())
173+
informerFactory.WaitForCacheSync(ctx.Done())
172174

173175
// /29 = 6 services, kubernetes.default takes the first address
174176
// make 5 more services to take up all IPs

0 commit comments

Comments
 (0)