@@ -167,17 +167,17 @@ type NetexecDialResponse struct {
167
167
}
168
168
169
169
// DialFromEndpointContainer executes a curl via kubectl exec in an endpoint container.
170
- func (config * NetworkingTestConfig ) DialFromEndpointContainer (protocol , targetIP string , targetPort , maxTries , minTries int , expectedEps sets.String ) error {
171
- return config .DialFromContainer (protocol , echoHostname , config .EndpointPods [0 ].Status .PodIP , targetIP , EndpointHTTPPort , targetPort , maxTries , minTries , expectedEps )
170
+ func (config * NetworkingTestConfig ) DialFromEndpointContainer (protocol , targetIP string , targetPort , maxTries , minTries int , expectedEps sets.String ) {
171
+ config .DialFromContainer (protocol , echoHostname , config .EndpointPods [0 ].Status .PodIP , targetIP , EndpointHTTPPort , targetPort , maxTries , minTries , expectedEps )
172
172
}
173
173
174
174
// DialFromTestContainer executes a curl via kubectl exec in a test container.
175
- func (config * NetworkingTestConfig ) DialFromTestContainer (protocol , targetIP string , targetPort , maxTries , minTries int , expectedEps sets.String ) error {
176
- return config .DialFromContainer (protocol , echoHostname , config .TestContainerPod .Status .PodIP , targetIP , testContainerHTTPPort , targetPort , maxTries , minTries , expectedEps )
175
+ func (config * NetworkingTestConfig ) DialFromTestContainer (protocol , targetIP string , targetPort , maxTries , minTries int , expectedEps sets.String ) {
176
+ config .DialFromContainer (protocol , echoHostname , config .TestContainerPod .Status .PodIP , targetIP , testContainerHTTPPort , targetPort , maxTries , minTries , expectedEps )
177
177
}
178
178
179
179
// DialEchoFromTestContainer executes a curl via kubectl exec in a test container. The response is expected to match the echoMessage.
180
- func (config * NetworkingTestConfig ) DialEchoFromTestContainer (protocol , targetIP string , targetPort , maxTries , minTries int , echoMessage string ) error {
180
+ func (config * NetworkingTestConfig ) DialEchoFromTestContainer (protocol , targetIP string , targetPort , maxTries , minTries int , echoMessage string ) {
181
181
expectedResponse := sets .NewString ()
182
182
expectedResponse .Insert (echoMessage )
183
183
var dialCommand string
@@ -191,7 +191,7 @@ func (config *NetworkingTestConfig) DialEchoFromTestContainer(protocol, targetIP
191
191
} else {
192
192
dialCommand = fmt .Sprintf ("echo%%20%s" , echoMessage )
193
193
}
194
- return config .DialFromContainer (protocol , dialCommand , config .TestContainerPod .Status .PodIP , targetIP , testContainerHTTPPort , targetPort , maxTries , minTries , expectedResponse )
194
+ config .DialFromContainer (protocol , dialCommand , config .TestContainerPod .Status .PodIP , targetIP , testContainerHTTPPort , targetPort , maxTries , minTries , expectedResponse )
195
195
}
196
196
197
197
// diagnoseMissingEndpoints prints debug information about the endpoints that
@@ -248,8 +248,7 @@ func makeCURLDialCommand(ipPort, dialCmd, protocol, targetIP string, targetPort
248
248
// maxTries == minTries will confirm that we see the expected endpoints and no
249
249
// more for maxTries. Use this if you want to eg: fail a readiness check on a
250
250
// pod and confirm it doesn't show up as an endpoint.
251
- // Returns nil if no error, or error message if failed after trying maxTries.
252
- func (config * NetworkingTestConfig ) DialFromContainer (protocol , dialCommand , containerIP , targetIP string , containerHTTPPort , targetPort , maxTries , minTries int , expectedResponses sets.String ) error {
251
+ func (config * NetworkingTestConfig ) DialFromContainer (protocol , dialCommand , containerIP , targetIP string , containerHTTPPort , targetPort , maxTries , minTries int , expectedResponses sets.String ) {
253
252
ipPort := net .JoinHostPort (containerIP , strconv .Itoa (containerHTTPPort ))
254
253
cmd := makeCURLDialCommand (ipPort , dialCommand , protocol , targetIP , targetPort )
255
254
@@ -274,19 +273,16 @@ func (config *NetworkingTestConfig) DialFromContainer(protocol, dialCommand, con
274
273
275
274
// Check against i+1 so we exit if minTries == maxTries.
276
275
if (responses .Equal (expectedResponses ) || responses .Len () == 0 && expectedResponses .Len () == 0 ) && i + 1 >= minTries {
277
- framework .Logf ("reached %v after %v/%v tries" , targetIP , i , maxTries )
278
- return nil
276
+ return
279
277
}
280
278
// TODO: get rid of this delay #36281
281
279
time .Sleep (hitEndpointRetryDelay )
282
280
}
281
+
283
282
if dialCommand == echoHostname {
284
283
config .diagnoseMissingEndpoints (responses )
285
284
}
286
- returnMsg := fmt .Errorf ("did not find expected responses... \n Tries %d\n Command %v\n retrieved %v\n expected %v" , maxTries , cmd , responses , expectedResponses )
287
- framework .Logf ("encountered error during dial (%v)" , returnMsg )
288
- return returnMsg
289
-
285
+ framework .Failf ("Failed to find expected responses:\n Tries %d\n Command %v\n retrieved %v\n expected %v\n " , maxTries , cmd , responses , expectedResponses )
290
286
}
291
287
292
288
// GetEndpointsFromTestContainer executes a curl via kubectl exec in a test container.
@@ -681,7 +677,6 @@ func (config *NetworkingTestConfig) setupCore(selector map[string]string) {
681
677
682
678
epCount := len (config .EndpointPods )
683
679
config .MaxTries = epCount * epCount + testTries
684
- framework .Logf ("Setting MaxTries for pod polling to %v for networking test based on endpoint count %v" , config .MaxTries , epCount )
685
680
}
686
681
687
682
// setup includes setupCore and also sets up services
0 commit comments