From 94d98f487fb6cd0bbc656b3a1a756ceab4ac85e0 Mon Sep 17 00:00:00 2001 From: shashidharatd Date: Tue, 14 Feb 2017 12:50:42 +0530 Subject: [PATCH] Fix prematurely exiting testcase while waiting for clustered service --- test/e2e_federation/federation-util.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/e2e_federation/federation-util.go b/test/e2e_federation/federation-util.go index e6160835082..0a423243357 100644 --- a/test/e2e_federation/federation-util.go +++ b/test/e2e_federation/federation-util.go @@ -217,7 +217,6 @@ func getRegisteredClusters(userAgentName string, f *fedframework.Framework) (map */ func waitForServiceOrFail(clientset *kubeclientset.Clientset, namespace string, service *v1.Service, present bool, timeout time.Duration) { By(fmt.Sprintf("Fetching a federated service shard of service %q in namespace %q from cluster", service.Name, namespace)) - var clusterService *v1.Service err := wait.PollImmediate(framework.Poll, timeout, func() (bool, error) { clusterService, err := clientset.Services(namespace).Get(service.Name, metav1.GetOptions{}) if (!present) && errors.IsNotFound(err) { // We want it gone, and it's gone. @@ -225,17 +224,16 @@ func waitForServiceOrFail(clientset *kubeclientset.Clientset, namespace string, return true, nil // Success } if present && err == nil { // We want it present, and the Get succeeded, so we're all good. - By(fmt.Sprintf("Success: shard of federated service %q in namespace %q in cluster is present", service.Name, namespace)) - return true, nil // Success + if equivalent(*clusterService, *service) { + By(fmt.Sprintf("Success: shard of federated service %q in namespace %q in cluster is present", service.Name, namespace)) + return true, nil // Success + } + return false, nil } By(fmt.Sprintf("Service %q in namespace %q in cluster. Found: %v, waiting for Found: %v, trying again in %s (err=%v)", service.Name, namespace, clusterService != nil && err == nil, present, framework.Poll, err)) return false, nil }) framework.ExpectNoError(err, "Failed to verify service %q in namespace %q in cluster: Present=%v", service.Name, namespace, present) - - if present && clusterService != nil { - Expect(equivalent(*clusterService, *service)) - } } /*