diff --git a/test/e2e/examples.go b/test/e2e/examples.go index 1690edae4e..3df7e4d0b0 100644 --- a/test/e2e/examples.go +++ b/test/e2e/examples.go @@ -34,9 +34,10 @@ import ( ) const ( - podListTimeout = time.Minute - serverStartTimeout = podStartTimeout + 3*time.Minute - dnsReadyTimeout = time.Minute + podListTimeout = time.Minute + serverStartTimeout = podStartTimeout + 3*time.Minute + dnsReadyTimeout = time.Minute + endpointRegisterTimeout = time.Minute ) const queryDnsPythonTemplate string = ` @@ -161,7 +162,7 @@ var _ = Describe("Examples e2e", func() { forEachPod(c, ns, "component", "flower", func(pod api.Pod) { // Do nothing. just wait for it to be up and running. }) - content, err := makeHttpRequestToService(c, ns, "flower-service", "/") + content, err := makeHttpRequestToService(c, ns, "flower-service", "/", endpointRegisterTimeout) Expect(err).NotTo(HaveOccurred()) if !strings.Contains(content, "Celery Flower") { Failf("Flower HTTP request failed") @@ -388,7 +389,7 @@ var _ = Describe("Examples e2e", func() { err := waitForPodRunningInNamespace(c, "rethinkdb-admin", ns) Expect(err).NotTo(HaveOccurred()) checkDbInstances() - content, err := makeHttpRequestToService(c, ns, "rethinkdb-admin", "/") + content, err := makeHttpRequestToService(c, ns, "rethinkdb-admin", "/", endpointRegisterTimeout) Expect(err).NotTo(HaveOccurred()) if !strings.Contains(content, "RethinkDB Administration Console") { Failf("RethinkDB console is not running") @@ -522,15 +523,22 @@ var _ = Describe("Examples e2e", func() { }) }) -func makeHttpRequestToService(c *client.Client, ns, service, path string) (string, error) { - result, err := c.Get(). - Prefix("proxy"). - Namespace(ns). - Resource("services"). - Name(service). - Suffix(path). - Do(). - Raw() +func makeHttpRequestToService(c *client.Client, ns, service, path string, timeout time.Duration) (string, error) { + var result []byte + var err error + for t := time.Now(); time.Since(t) < timeout; time.Sleep(poll) { + result, err = c.Get(). + Prefix("proxy"). + Namespace(ns). + Resource("services"). + Name(service). + Suffix(path). + Do(). + Raw() + if err != nil { + break + } + } return string(result), err }