From 6f4862659f7f86e1637fe579343bc878f499d9bf Mon Sep 17 00:00:00 2001 From: Frank Wessels Date: Mon, 12 Jun 2017 17:20:29 -0700 Subject: [PATCH] Investigate issue #4461 (#4521) * Code to investigate issue #4461 (rare test failure in TestListenAndServeTLS) * Use UTCNow() instead of time.Now().UTC() --- cmd/server-mux_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/server-mux_test.go b/cmd/server-mux_test.go index 614621b2f..4a4007710 100644 --- a/cmd/server-mux_test.go +++ b/cmd/server-mux_test.go @@ -390,11 +390,17 @@ func TestServerListenAndServeTLS(t *testing.T) { Transport: tr, } // Keep trying the server until it's accepting connections + start := UTCNow() for { res, _ := client.Get("https://" + addr) if res != nil && res.StatusCode == http.StatusOK { break } + // Explicit check to terminate loop after 5 minutes + // (for investigational purpose of issue #4461) + if UTCNow().Sub(start) >= 5*time.Minute { + t.Fatalf("Failed to establish connection after 5 minutes") + } } // Once a request succeeds, subsequent requests should