Skip to content

Commit 8630dc9

Browse files
committed
Update test/e2e/framework/network/utils.go
add logging about min/max interval Co-authored-by: Antonio Ojea <[email protected]>
1 parent 56def96 commit 8630dc9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/e2e/framework/network/utils.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,12 @@ func (config *NetworkingTestConfig) GetHTTPCodeFromTestContainer(path, targetIP
380380
return code, nil
381381
}
382382

383-
// DialFromNode executes a tcp or udp curl/echo request based on protocol via kubectl exec
383+
// DialFromNode executes a tcp/udp curl/nc request based on protocol via kubectl exec
384384
// in a test container running with host networking.
385-
// - minTries is the minimum number of curl/echo attempts required before declaring
385+
// - minTries is the minimum number of curl/nc attempts required before declaring
386386
// success. If 0, then we return as soon as all endpoints succeed.
387387
// - There is no logical change to test results if faillures happen AFTER endpoints have succeeded,
388-
// hence over-padding minTries will NOT reverse a successfull result and is thus not very useful yet
388+
// hence over-padding minTries will NOT reverse a successful result and is thus not very useful yet
389389
// (See the TODO about checking probability, which isnt implemented yet).
390390
// - maxTries is the maximum number of curl/echo attempts before an error is returned. The
391391
// smaller this number is, the less 'slack' there is for declaring success.
@@ -411,6 +411,7 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
411411
eps := sets.NewString()
412412

413413
filterCmd := fmt.Sprintf("%s | grep -v '^\\s*$'", cmd)
414+
framework.Logf("Going to poll %v on port %v at least %v times, with a maximum of %v tries before failing", targetIP, targetPort, minTries, maxTries)
414415
for i := 0; i < maxTries; i++ {
415416
stdout, stderr, err := config.f.ExecShellInPodWithFullOutput(config.HostTestContainerPod.Name, filterCmd)
416417
if err != nil || len(stderr) > 0 {
@@ -427,7 +428,7 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
427428

428429
// Check against i+1 so we exit if minTries == maxTries.
429430
if eps.Equal(expectedEps) && i+1 >= minTries {
430-
framework.Logf("Found all %+v expected endpoints: %+v", len(eps.List()), eps.List())
431+
framework.Logf("Found all %d expected endpoints: %+v", eps.Len(), eps.List())
431432
return nil
432433
}
433434

@@ -438,7 +439,7 @@ func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targ
438439
}
439440

440441
config.diagnoseMissingEndpoints(eps)
441-
return fmt.Errorf("failed to find expected endpoints:\nTries %d\nCommand %v\nretrieved %v\nexpected %v\n", maxTries, cmd, eps, expectedEps)
442+
return fmt.Errorf("failed to find expected endpoints, \ntries %d\nCommand %v\nretrieved %v\nexpected %v", maxTries, cmd, eps, expectedEps)
442443
}
443444

444445
// GetSelfURL executes a curl against the given path via kubectl exec into a

0 commit comments

Comments
 (0)