test/e2e: fix flake in kubelet expose should create services for rc

Add a loop to retry the request to account for the TLS Timeout and API
credential error responses outlined by the flakes in #29227.

Fixes #29227

Signed-off-by: Jess Frazelle <me@jessfraz.com>
pull/6/head
Jess Frazelle 2016-08-24 10:38:23 -07:00
parent 4f4c50223e
commit c2cf99c165
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3
1 changed files with 7 additions and 2 deletions

View File

@ -652,10 +652,15 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
err := wait.Poll(framework.Poll, timeout, func() (bool, error) {
endpoints, err := c.Endpoints(ns).Get(name)
if err != nil {
if apierrs.IsNotFound(err) {
// log the real error
framework.Logf("Get endpoints failed (interval %v): %v", framework.Poll, err)
// if the error is API not found or could not find default credentials or TLS handshake timeout, try again
if apierrs.IsNotFound(err) ||
apierrs.IsUnauthorized(err) ||
apierrs.IsServerTimeout(err) {
err = nil
}
framework.Logf("Get endpoints failed (interval %v): %v", framework.Poll, err)
return false, err
}