mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #18340 from wojtek-t/pod_intra_communication_test
Set timeout for clients created in e2e tests
This commit is contained in:
commit
f6f7725f90
@ -67,6 +67,10 @@ func DebugWrappers(rt http.RoundTripper) http.RoundTripper {
|
|||||||
return rt
|
return rt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type requestCanceler interface {
|
||||||
|
CancelRequest(*http.Request)
|
||||||
|
}
|
||||||
|
|
||||||
type userAgentRoundTripper struct {
|
type userAgentRoundTripper struct {
|
||||||
agent string
|
agent string
|
||||||
rt http.RoundTripper
|
rt http.RoundTripper
|
||||||
@ -85,6 +89,14 @@ func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
return rt.rt.RoundTrip(req)
|
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 {
|
type basicAuthRoundTripper struct {
|
||||||
username string
|
username string
|
||||||
password string
|
password string
|
||||||
@ -106,6 +118,14 @@ func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
return rt.rt.RoundTrip(req)
|
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 {
|
type bearerAuthRoundTripper struct {
|
||||||
bearer string
|
bearer string
|
||||||
rt http.RoundTripper
|
rt http.RoundTripper
|
||||||
@ -127,6 +147,14 @@ func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response,
|
|||||||
return rt.rt.RoundTrip(req)
|
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.
|
// cloneRequest returns a clone of the provided *http.Request.
|
||||||
// The clone is a shallow copy of the struct and its Header map.
|
// The clone is a shallow copy of the struct and its Header map.
|
||||||
func cloneRequest(r *http.Request) *http.Request {
|
func cloneRequest(r *http.Request) *http.Request {
|
||||||
|
@ -989,6 +989,9 @@ func loadClient() (*client.Client, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating client: %v", err.Error())
|
return nil, fmt.Errorf("error creating client: %v", err.Error())
|
||||||
}
|
}
|
||||||
|
if c.Client.Timeout == 0 {
|
||||||
|
c.Client.Timeout = singleCallTimeout
|
||||||
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user