@@ -68,6 +68,7 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
68
68
client ,
69
69
).Run (ctx , 5 )
70
70
informerFactory .Start (ctx .Done ())
71
+ informerFactory .WaitForCacheSync (ctx .Done ())
71
72
72
73
// /29 = 6 services, kubernetes.default takes the first address
73
74
// make 5 more services to take up all IPs
@@ -169,6 +170,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
169
170
client ,
170
171
).Run (ctx , 5 )
171
172
informerFactory .Start (ctx .Done ())
173
+ informerFactory .WaitForCacheSync (ctx .Done ())
172
174
173
175
// /29 = 6 services, kubernetes.default takes the first address
174
176
// make 5 more services to take up all IPs
@@ -180,7 +182,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
180
182
// create a new ServiceCIDRs that overlaps the default one
181
183
_ , err = client .NetworkingV1beta1 ().ServiceCIDRs ().Create (ctx , makeServiceCIDR ("cidr1" , cidr1 , "" ), metav1.CreateOptions {})
182
184
if err != nil {
183
- t .Fatal (( err ) )
185
+ t .Fatal (err )
184
186
}
185
187
// Wait until is ready.
186
188
if err := wait .PollUntilContextTimeout (context .Background (), 250 * time .Millisecond , 30 * time .Second , false , func (ctx context.Context ) (bool , error ) {
@@ -195,7 +197,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
195
197
// we should be able to delete the ServiceCIDR despite it contains IP addresses as it overlaps with the default ServiceCIDR
196
198
err = client .NetworkingV1beta1 ().ServiceCIDRs ().Delete (ctx , "cidr1" , metav1.DeleteOptions {})
197
199
if err != nil {
198
- t .Fatal (( err ) )
200
+ t .Fatal (err )
199
201
}
200
202
201
203
if err := wait .PollUntilContextTimeout (context .Background (), 250 * time .Millisecond , 30 * time .Second , false , func (ctx context.Context ) (bool , error ) {
@@ -211,7 +213,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
211
213
// add a new ServiceCIDR with a new range
212
214
_ , err = client .NetworkingV1beta1 ().ServiceCIDRs ().Create (ctx , makeServiceCIDR ("cidr2" , cidr2 , "" ), metav1.CreateOptions {})
213
215
if err != nil {
214
- t .Fatal (( err ) )
216
+ t .Fatal (err )
215
217
}
216
218
// wait the allocator process the new ServiceCIDR
217
219
// Wait until is ready.
@@ -237,7 +239,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
237
239
// add a new ServiceCIDR that overlaps the existing one
238
240
_ , err = client .NetworkingV1beta1 ().ServiceCIDRs ().Create (ctx , makeServiceCIDR ("cidr3" , cidr3 , "" ), metav1.CreateOptions {})
239
241
if err != nil {
240
- t .Fatal (( err ) )
242
+ t .Fatal (err )
241
243
}
242
244
// Wait until is ready.
243
245
if err := wait .PollUntilContextTimeout (context .Background (), 250 * time .Millisecond , 30 * time .Second , false , func (ctx context.Context ) (bool , error ) {
@@ -252,7 +254,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
252
254
// we should be able to delete the ServiceCIDR2 despite it contains IP addresses as it is contained on ServiceCIDR3
253
255
err = client .NetworkingV1beta1 ().ServiceCIDRs ().Delete (ctx , "cidr2" , metav1.DeleteOptions {})
254
256
if err != nil {
255
- t .Fatal (( err ) )
257
+ t .Fatal (err )
256
258
}
257
259
258
260
if err := wait .PollUntilContextTimeout (context .Background (), 250 * time .Millisecond , 30 * time .Second , false , func (ctx context.Context ) (bool , error ) {
@@ -268,7 +270,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
268
270
// serviceCIDR3 will not be able to be deleted until the IPAddress is removed
269
271
err = client .NetworkingV1beta1 ().ServiceCIDRs ().Delete (ctx , "cidr3" , metav1.DeleteOptions {})
270
272
if err != nil {
271
- t .Fatal (( err ) )
273
+ t .Fatal (err )
272
274
}
273
275
// Wait until is not ready.
274
276
if err := wait .PollUntilContextTimeout (context .Background (), 250 * time .Millisecond , 30 * time .Second , false , func (ctx context.Context ) (bool , error ) {
0 commit comments