@@ -252,10 +252,7 @@ func TestVolumeBinding(t *testing.T) {
252
252
t .Fatal (err )
253
253
}
254
254
255
- // Start informer factory after initialization
256
- informerFactory .Start (ctx .Done ())
257
-
258
- // Feed testing data and wait for them to be synced
255
+ t .Log ("Feed testing data and wait for them to be synced" )
259
256
client .StorageV1 ().StorageClasses ().Create (ctx , immediateSC , metav1.CreateOptions {})
260
257
client .StorageV1 ().StorageClasses ().Create (ctx , waitSC , metav1.CreateOptions {})
261
258
if item .node != nil {
@@ -267,19 +264,21 @@ func TestVolumeBinding(t *testing.T) {
267
264
for _ , pv := range item .pvs {
268
265
client .CoreV1 ().PersistentVolumes ().Create (ctx , pv , metav1.CreateOptions {})
269
266
}
270
- caches := informerFactory .WaitForCacheSync (ctx .Done ())
271
- for _ , synced := range caches {
272
- if ! synced {
273
- t .Errorf ("error waiting for informer cache sync" )
274
- }
275
- }
276
267
277
- // Verify
268
+ t .Log ("Start informer factory after initialization" )
269
+ informerFactory .Start (ctx .Done ())
270
+
271
+ t .Log ("Wait for all started informers' cache were synced" )
272
+ informerFactory .WaitForCacheSync (ctx .Done ())
273
+
274
+ t .Log ("Verify" )
275
+
278
276
p := pl .(* VolumeBinding )
279
277
nodeInfo := framework .NewNodeInfo ()
280
278
nodeInfo .SetNode (item .node )
281
279
state := framework .NewCycleState ()
282
- t .Logf ("call PreFilter and check status" )
280
+
281
+ t .Logf ("Verify: call PreFilter and check status" )
283
282
gotPreFilterStatus := p .PreFilter (ctx , state , item .pod )
284
283
if ! reflect .DeepEqual (gotPreFilterStatus , item .wantPreFilterStatus ) {
285
284
t .Errorf ("filter prefilter status does not match: %v, want: %v" , gotPreFilterStatus , item .wantPreFilterStatus )
@@ -288,15 +287,17 @@ func TestVolumeBinding(t *testing.T) {
288
287
// scheduler framework will skip Filter if PreFilter fails
289
288
return
290
289
}
291
- t .Logf ("check state after prefilter phase" )
290
+
291
+ t .Logf ("Verify: check state after prefilter phase" )
292
292
stateData , err := getStateData (state )
293
293
if err != nil {
294
294
t .Fatal (err )
295
295
}
296
296
if ! reflect .DeepEqual (stateData , item .wantStateAfterPreFilter ) {
297
297
t .Errorf ("state got after prefilter does not match: %v, want: %v" , stateData , item .wantStateAfterPreFilter )
298
298
}
299
- t .Logf ("call Filter and check status" )
299
+
300
+ t .Logf ("Verify: call Filter and check status" )
300
301
gotStatus := p .Filter (ctx , state , item .pod , nodeInfo )
301
302
if ! reflect .DeepEqual (gotStatus , item .wantFilterStatus ) {
302
303
t .Errorf ("filter status does not match: %v, want: %v" , gotStatus , item .wantFilterStatus )
0 commit comments