diff --git a/pkg/plugins/client.go b/pkg/plugins/client.go index 14decd530e..a778677f7c 100644 --- a/pkg/plugins/client.go +++ b/pkg/plugins/client.go @@ -16,8 +16,7 @@ import ( ) const ( - defaultTimeOut = 30 - defaultHTTPTimeOut = 32 * time.Second + defaultTimeOut = 30 ) // NewClient creates a new plugin client (http). @@ -54,7 +53,6 @@ func NewClient(addr string, tlsConfig *tlsconfig.Options) (*Client, error) { func NewClientWithTransport(tr transport.Transport) *Client { return &Client{ http: &http.Client{ - Timeout: defaultHTTPTimeOut, Transport: tr, }, requestFactory: tr, diff --git a/pkg/plugins/client_test.go b/pkg/plugins/client_test.go index 6551d53697..9faad86a15 100644 --- a/pkg/plugins/client_test.go +++ b/pkg/plugins/client_test.go @@ -6,7 +6,6 @@ import ( "net/http/httptest" "net/url" "reflect" - "strings" "testing" "time" @@ -31,32 +30,6 @@ func teardownRemotePluginServer() { } } -func testHTTPTimeout(t *testing.T, timeout, epsilon time.Duration) { - addr := setupRemotePluginServer() - defer teardownRemotePluginServer() - stop := make(chan struct{}) // we need this variable to stop the http server - mux.HandleFunc("/hang", func(w http.ResponseWriter, r *http.Request) { - <-stop - }) - c, _ := NewClient(addr, &tlsconfig.Options{InsecureSkipVerify: true}) - c.http.Timeout = timeout - begin := time.Now() - _, err := c.callWithRetry("hang", nil, false) - close(stop) - if err == nil || !strings.Contains(err.Error(), "request canceled") { - t.Fatalf("The request should be canceled %v", err) - } - elapsed := time.Now().Sub(begin) - if elapsed < timeout-epsilon || elapsed > timeout+epsilon { - t.Fatalf("elapsed time: got %v, expected %v (epsilon=%v)", - elapsed, timeout, epsilon) - } -} - -func TestHTTPTimeout(t *testing.T) { - testHTTPTimeout(t, 5*time.Second, 500*time.Millisecond) -} - func TestFailedConnection(t *testing.T) { c, _ := NewClient("tcp://127.0.0.1:1", &tlsconfig.Options{InsecureSkipVerify: true}) _, err := c.callWithRetry("Service.Method", nil, false)