@@ -18,6 +18,7 @@ package network
18
18
19
19
import (
20
20
"context"
21
+ "encoding/json"
21
22
"fmt"
22
23
"time"
23
24
@@ -311,13 +312,12 @@ func expectEndpointsAndSlices(cs clientset.Interface, ns string, svc *v1.Service
311
312
if err := wait .PollImmediate (5 * time .Second , 2 * time .Minute , func () (bool , error ) {
312
313
endpointSlicesFound , hasMatchingSlices := hasMatchingEndpointSlices (cs , ns , svc .Name , len (pods ), numSlices )
313
314
if ! hasMatchingSlices {
314
- framework .Logf ("Matching EndpointSlices not found" )
315
315
return false , nil
316
316
}
317
317
endpointSlices = endpointSlicesFound
318
318
return true , nil
319
319
}); err != nil {
320
- framework .Failf ("Timed out waiting for matching EndpointSlices to exist : %v" , err )
320
+ framework .Failf ("Timed out waiting for EndpointSlices to match expectations : %v" , err )
321
321
}
322
322
323
323
endpoints := & v1.Endpoints {}
@@ -330,7 +330,7 @@ func expectEndpointsAndSlices(cs clientset.Interface, ns string, svc *v1.Service
330
330
endpoints = endpointsFound
331
331
return true , nil
332
332
}); err != nil {
333
- framework .Failf ("Timed out waiting for matching Endpoints to exist : %v" , err )
333
+ framework .Failf ("Timed out waiting for Endpoints to match expectations : %v" , err )
334
334
}
335
335
336
336
podsByIP := map [string ]* v1.Pod {}
@@ -494,7 +494,15 @@ func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEn
494
494
}
495
495
if len (esList .Items ) != numSlices {
496
496
framework .Logf ("Expected %d EndpointSlices for Service %s/%s, got %d" , numSlices , ns , svcName , len (esList .Items ))
497
- return []discoveryv1beta1.EndpointSlice {}, false
497
+ for i , epSlice := range esList .Items {
498
+ epsData , err := json .Marshal (epSlice )
499
+ if err != nil {
500
+ framework .Logf ("Error marshaling JSON for EndpointSlice: %v" , err )
501
+ } else {
502
+ framework .Logf ("%d - %v" , i , string (epsData ))
503
+ }
504
+ }
505
+ return esList .Items , false
498
506
}
499
507
500
508
actualNumEndpoints := 0
@@ -503,7 +511,7 @@ func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEn
503
511
}
504
512
if actualNumEndpoints != numEndpoints {
505
513
framework .Logf ("EndpointSlices for %s/%s Service have %d/%d endpoints" , ns , svcName , actualNumEndpoints , numEndpoints )
506
- return []discoveryv1beta1. EndpointSlice {} , false
514
+ return esList . Items , false
507
515
}
508
516
509
517
return esList .Items , true
0 commit comments