Merge pull request #51042 from soltysh/request_timeout

Automatic merge from submit-queue (batch tested with PRs 59276, 51042, 58973, 59377, 59472). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Allow passing request-timeout from NewRequest all the way down

**What this PR does / why we need it**:
Currently if you pass `--request-timeout` it's not passed all the way down to the actual request object. There's a separate field on the `Request` object that allows setting that timeout, but it's not taken from that flag.

@smarterclayton @deads2k ptal, this is coming from https://github.com/openshift/origin/pull/13701

Kubernetes-commit: 1f6251444b7dad7f5d924acbfb366541f2a6fb99
This commit is contained in:
Kubernetes Publisher 2018-02-07 12:00:44 -08:00
commit 33bd23f75b
5 changed files with 94 additions and 93 deletions

164
Godeps/Godeps.json generated
View File

@ -284,331 +284,331 @@
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/apps/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/authentication/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/authorization/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/batch/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/core/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/networking/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/rbac/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/storage/v1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "65f67c9cb59d466d2eb758ad9d5ad016eb43c2aa"
"Rev": "beab4da9671e79815b7876363175af45aa180eb5"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "caa3b27b0fdaa84adc020cd7663afd62777ec9bd"
"Rev": "6212319467788d635606616d5c6d87ded0321d8c"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",

View File

@ -222,9 +222,9 @@ func (c *RESTClient) Verb(verb string) *Request {
backoff := c.createBackoffMgr()
if c.Client == nil {
return NewRequest(nil, verb, c.base, c.versionedAPIPath, c.contentConfig, c.serializers, backoff, c.Throttle)
return NewRequest(nil, verb, c.base, c.versionedAPIPath, c.contentConfig, c.serializers, backoff, c.Throttle, 0)
}
return NewRequest(c.Client, verb, c.base, c.versionedAPIPath, c.contentConfig, c.serializers, backoff, c.Throttle)
return NewRequest(c.Client, verb, c.base, c.versionedAPIPath, c.contentConfig, c.serializers, backoff, c.Throttle, c.Client.Timeout)
}
// Post begins a POST request. Short for c.Verb("POST").

View File

@ -107,7 +107,7 @@ func (c *RESTClient) request(verb string) *restclient.Request {
serializers.StreamingSerializer = info.StreamSerializer.Serializer
serializers.Framer = info.StreamSerializer.Framer
}
return restclient.NewRequest(c, verb, &url.URL{Host: "localhost"}, c.VersionedAPIPath, config, serializers, nil, nil)
return restclient.NewRequest(c, verb, &url.URL{Host: "localhost"}, c.VersionedAPIPath, config, serializers, nil, nil, 0)
}
func (c *RESTClient) Do(req *http.Request) (*http.Response, error) {

View File

@ -112,7 +112,7 @@ type Request struct {
}
// NewRequest creates a new request helper object for accessing runtime.Objects on a server.
func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPath string, content ContentConfig, serializers Serializers, backoff BackoffManager, throttle flowcontrol.RateLimiter) *Request {
func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPath string, content ContentConfig, serializers Serializers, backoff BackoffManager, throttle flowcontrol.RateLimiter, timeout time.Duration) *Request {
if backoff == nil {
glog.V(2).Infof("Not implementing request backoff strategy.")
backoff = &NoBackoff{}
@ -131,6 +131,7 @@ func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPa
serializers: serializers,
backoffMgr: backoff,
throttle: throttle,
timeout: timeout,
}
switch {
case len(content.AcceptContentTypes) > 0:

View File

@ -57,11 +57,11 @@ import (
)
func TestNewRequestSetsAccept(t *testing.T) {
r := NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{}, Serializers{}, nil, nil)
r := NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{}, Serializers{}, nil, nil, 0)
if r.headers.Get("Accept") != "" {
t.Errorf("unexpected headers: %#v", r.headers)
}
r = NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{ContentType: "application/other"}, Serializers{}, nil, nil)
r = NewRequest(nil, "get", &url.URL{Path: "/path/"}, "", ContentConfig{ContentType: "application/other"}, Serializers{}, nil, nil, 0)
if r.headers.Get("Accept") != "application/other, */*" {
t.Errorf("unexpected headers: %#v", r.headers)
}
@ -86,7 +86,7 @@ func TestRequestSetsHeaders(t *testing.T) {
config := defaultContentConfig()
config.ContentType = "application/other"
serializers := defaultSerializers(t)
r := NewRequest(server, "get", &url.URL{Path: "/path"}, "", config, serializers, nil, nil)
r := NewRequest(server, "get", &url.URL{Path: "/path"}, "", config, serializers, nil, nil, 0)
// Check if all "issue" methods are setting headers.
_ = r.Do()
@ -341,7 +341,7 @@ func TestResultIntoWithNoBodyReturnsErr(t *testing.T) {
func TestURLTemplate(t *testing.T) {
uri, _ := url.Parse("http://localhost")
r := NewRequest(nil, "POST", uri, "", ContentConfig{GroupVersion: &schema.GroupVersion{Group: "test"}}, Serializers{}, nil, nil)
r := NewRequest(nil, "POST", uri, "", ContentConfig{GroupVersion: &schema.GroupVersion{Group: "test"}}, Serializers{}, nil, nil, 0)
r.Prefix("pre1").Resource("r1").Namespace("ns").Name("nm").Param("p0", "v0")
full := r.URL()
if full.String() != "http://localhost/pre1/namespaces/ns/r1/nm?p0=v0" {
@ -403,7 +403,7 @@ func TestTransformResponse(t *testing.T) {
{Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid},
}
for i, test := range testCases {
r := NewRequest(nil, "", uri, "", defaultContentConfig(), defaultSerializers(t), nil, nil)
r := NewRequest(nil, "", uri, "", defaultContentConfig(), defaultSerializers(t), nil, nil, 0)
if test.Response.Body == nil {
test.Response.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
}
@ -554,7 +554,7 @@ func TestTransformResponseNegotiate(t *testing.T) {
serializers.RenegotiatedDecoder = negotiator.invoke
contentConfig := defaultContentConfig()
contentConfig.ContentType = test.ContentType
r := NewRequest(nil, "", uri, "", contentConfig, serializers, nil, nil)
r := NewRequest(nil, "", uri, "", contentConfig, serializers, nil, nil, 0)
if test.Response.Body == nil {
test.Response.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
}
@ -1480,7 +1480,7 @@ func TestAbsPath(t *testing.T) {
{"/p1/api/p2", "/api/r1", "/api/", "/p1/api/p2/api/"},
} {
u, _ := url.Parse("http://localhost:123" + tc.configPrefix)
r := NewRequest(nil, "POST", u, "", ContentConfig{GroupVersion: &schema.GroupVersion{Group: "test"}}, Serializers{}, nil, nil).Prefix(tc.resourcePrefix).AbsPath(tc.absPath)
r := NewRequest(nil, "POST", u, "", ContentConfig{GroupVersion: &schema.GroupVersion{Group: "test"}}, Serializers{}, nil, nil, 0).Prefix(tc.resourcePrefix).AbsPath(tc.absPath)
if r.pathPrefix != tc.wantsAbsPath {
t.Errorf("test case %d failed, unexpected path: %q, expected %q", i, r.pathPrefix, tc.wantsAbsPath)
}