Skip to content
Permalink
Browse files

Add service reachability polling to avoid flakiness

  • Loading branch information...
mgdevstack committed Aug 14, 2019
1 parent 125fb72 commit eddd7da46245ee0f63e088cd9d1a0be2efe0ee4a
Showing with 11 additions and 2 deletions.
  1. +3 −0 test/e2e/framework/service/const.go
  2. +8 −2 test/e2e/framework/service/jig.go
@@ -78,4 +78,7 @@ const (

// ServiceEndpointsTimeout is the maximum time in which endpoints for the service should be created.
ServiceEndpointsTimeout = 2 * time.Minute

// ServiceReachabilityShortPollTimeout is the maximum time in which service must be reachable during polling.
ServiceReachabilityShortPollTimeout = 2 * time.Minute
)
@@ -812,8 +812,14 @@ func testEndpointReachability(endpoint string, port int32, protocol v1.Protocol,
e2elog.Failf("Service reachablity check is not supported for %v", protocol)
}
if cmd != "" {
_, err := framework.RunHostCmd(execPod.Namespace, execPod.Name, cmd)
framework.ExpectNoError(err, "Service is not reachable on following endpoint %s over %s protocol", ep, protocol)
err := wait.PollImmediate(1*time.Second, ServiceReachabilityShortPollTimeout, func() (bool, error) {
if _, err := framework.RunHostCmd(execPod.Namespace, execPod.Name, cmd); err != nil {
e2elog.Logf("Service reachability failing with error: %v\nRetrying...", err)
return false, nil
}
return true, nil
})
framework.ExpectNoError(err, "Service is not reachable within %v timeout on endpoint %s over %s protocol", ServiceReachabilityShortPollTimeout, ep, protocol)
}
}

0 comments on commit eddd7da

Please sign in to comment.
You can’t perform that action at this time.