From a19aa1069a7ce9b10557235e991ae56c5ecbc56a Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Sat, 11 Jan 2020 00:03:21 +0000 Subject: [PATCH] Remove duplicated ServiceStartTimeout ServiceStartTimeout is defined at e2e core framework and the one of the core is used at many places, but the one of this endpoints/ports.go is not used at the other places. So this removes the one of endpoints/ports.go for the cleanup. --- test/e2e/framework/endpoints/ports.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/e2e/framework/endpoints/ports.go b/test/e2e/framework/endpoints/ports.go index 7abed812b97..6701b71673b 100644 --- a/test/e2e/framework/endpoints/ports.go +++ b/test/e2e/framework/endpoints/ports.go @@ -35,9 +35,6 @@ import ( "k8s.io/kubernetes/test/e2e/framework" ) -// ServiceStartTimeout is how long to wait for a service endpoint to be resolvable. -const ServiceStartTimeout = 3 * time.Minute - // PortsByPodName is a map that maps pod name to container ports. type PortsByPodName map[string][]int @@ -98,9 +95,9 @@ func validatePorts(ep PortsByPodUID, expectedEndpoints PortsByPodUID) error { // ValidateEndpointsPorts validates that the given service exists and is served by the given expectedEndpoints. func ValidateEndpointsPorts(c clientset.Interface, namespace, serviceName string, expectedEndpoints PortsByPodName) error { - ginkgo.By(fmt.Sprintf("waiting up to %v for service %s in namespace %s to expose endpoints %v", ServiceStartTimeout, serviceName, namespace, expectedEndpoints)) + ginkgo.By(fmt.Sprintf("waiting up to %v for service %s in namespace %s to expose endpoints %v", framework.ServiceStartTimeout, serviceName, namespace, expectedEndpoints)) i := 1 - for start := time.Now(); time.Since(start) < ServiceStartTimeout; time.Sleep(1 * time.Second) { + for start := time.Now(); time.Since(start) < framework.ServiceStartTimeout; time.Sleep(1 * time.Second) { ep, err := c.CoreV1().Endpoints(namespace).Get(serviceName, metav1.GetOptions{}) if err != nil { framework.Logf("Get endpoints failed (%v elapsed, ignoring for 5s): %v", time.Since(start), err) @@ -132,5 +129,5 @@ func ValidateEndpointsPorts(c clientset.Interface, namespace, serviceName string } else { framework.Logf("Can't list pod debug info: %v", err) } - return fmt.Errorf("Timed out waiting for service %s in namespace %s to expose endpoints %v (%v elapsed)", serviceName, namespace, expectedEndpoints, ServiceStartTimeout) + return fmt.Errorf("Timed out waiting for service %s in namespace %s to expose endpoints %v (%v elapsed)", serviceName, namespace, expectedEndpoints, framework.ServiceStartTimeout) }