diff --git a/pkg/client/transport/round_trippers.go b/pkg/client/transport/round_trippers.go index 56500226698..781a64850a6 100644 --- a/pkg/client/transport/round_trippers.go +++ b/pkg/client/transport/round_trippers.go @@ -67,6 +67,10 @@ func DebugWrappers(rt http.RoundTripper) http.RoundTripper { return rt } +type requestCanceler interface { + CancelRequest(*http.Request) +} + type userAgentRoundTripper struct { agent string rt http.RoundTripper @@ -85,6 +89,14 @@ func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, e return rt.rt.RoundTrip(req) } +func (rt *userAgentRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.rt.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + type basicAuthRoundTripper struct { username string password string @@ -106,6 +118,14 @@ func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, e return rt.rt.RoundTrip(req) } +func (rt *basicAuthRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.rt.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + type bearerAuthRoundTripper struct { bearer string rt http.RoundTripper @@ -127,6 +147,14 @@ func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, return rt.rt.RoundTrip(req) } +func (rt *bearerAuthRoundTripper) CancelRequest(req *http.Request) { + if canceler, ok := rt.rt.(requestCanceler); ok { + canceler.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented") + } +} + // cloneRequest returns a clone of the provided *http.Request. // The clone is a shallow copy of the struct and its Header map. func cloneRequest(r *http.Request) *http.Request { diff --git a/test/e2e/util.go b/test/e2e/util.go index cad6d93a272..4bf17a4f742 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -989,6 +989,9 @@ func loadClient() (*client.Client, error) { if err != nil { return nil, fmt.Errorf("error creating client: %v", err.Error()) } + if c.Client.Timeout == 0 { + c.Client.Timeout = singleCallTimeout + } return c, nil }