From 8e2eeffa792109356462437c4ad42e69cb3923bd Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Wed, 2 Jun 2021 13:31:12 +0200 Subject: [PATCH] PokeHTTP default timeout to avoid hanging connections --- test/e2e/framework/network/utils.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/framework/network/utils.go b/test/e2e/framework/network/utils.go index 082e7e5f0d8..0e19328103d 100644 --- a/test/e2e/framework/network/utils.go +++ b/test/e2e/framework/network/utils.go @@ -900,8 +900,8 @@ func (config *NetworkingTestConfig) getServiceClient() coreclientset.ServiceInte // HTTPPokeParams is a struct for HTTP poke parameters. type HTTPPokeParams struct { - Timeout time.Duration - ExpectCode int // default = 200 + Timeout time.Duration // default = 10 secs + ExpectCode int // default = 200 BodyContains string RetriableCodes []int EnableHTTPS bool @@ -981,6 +981,10 @@ func PokeHTTP(host string, port int, path string, params *HTTPPokeParams) HTTPPo params.ExpectCode = http.StatusOK } + if params.Timeout == 0 { + params.Timeout = 10 * time.Second + } + framework.Logf("Poking %q", url) resp, err := httpGetNoConnectionPoolTimeout(url, params.Timeout)