diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index a800ae5b..27d3e5a8 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -344,7 +344,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "b704a2adc893" + "Rev": "f0152ed5fdbc" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/go.mod b/go.mod index 86abb35d..e0e345f0 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c google.golang.org/appengine v1.5.0 // indirect - k8s.io/api v0.0.0-20191106065814-b704a2adc893 + k8s.io/api v0.0.0-20191106225817-f0152ed5fdbc k8s.io/apimachinery v0.0.0-20191105185716-00d39968b57e k8s.io/klog v1.0.0 k8s.io/utils v0.0.0-20191030222137-2b95a09bc58d @@ -44,6 +44,6 @@ replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503 golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d - k8s.io/api => k8s.io/api v0.0.0-20191106065814-b704a2adc893 + k8s.io/api => k8s.io/api v0.0.0-20191106225817-f0152ed5fdbc k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191105185716-00d39968b57e ) diff --git a/go.sum b/go.sum index b8dd318e..cddde208 100644 --- a/go.sum +++ b/go.sum @@ -174,7 +174,7 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20191106065814-b704a2adc893/go.mod h1:P8GsfdPr4GFN3wwx7irwr6UNXEMI2CAh9x1dojhvY+g= +k8s.io/api v0.0.0-20191106225817-f0152ed5fdbc/go.mod h1:P8GsfdPr4GFN3wwx7irwr6UNXEMI2CAh9x1dojhvY+g= k8s.io/apimachinery v0.0.0-20191105185716-00d39968b57e/go.mod h1:gA1T9z4LIup7PIegBwxkF2UYXUNVKhOAPvQWWnAc34k= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/plugin/pkg/client/auth/gcp/gcp_test.go b/plugin/pkg/client/auth/gcp/gcp_test.go index c8fbb351..f49385a2 100644 --- a/plugin/pkg/client/auth/gcp/gcp_test.go +++ b/plugin/pkg/client/auth/gcp/gcp_test.go @@ -476,25 +476,25 @@ func Test_cmdTokenSource_roundTrip(t *testing.T) { }{ { "Unauthorized", - http.Response{StatusCode: 401}, + http.Response{StatusCode: http.StatusUnauthorized}, make(map[string]string), make(map[string]string), }, { "Unauthorized, nonempty defaultCache", - http.Response{StatusCode: 401}, + http.Response{StatusCode: http.StatusUnauthorized}, cmdCache, cmdCache, }, { "Authorized", - http.Response{StatusCode: 200}, + http.Response{StatusCode: http.StatusOK}, make(map[string]string), simpleCacheUpdated, }, { "Authorized, nonempty defaultCache", - http.Response{StatusCode: 200}, + http.Response{StatusCode: http.StatusOK}, cmdCache, cmdCacheUpdated, }, diff --git a/rest/request_test.go b/rest/request_test.go index 4c2481dc..dd8d789c 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -515,17 +515,17 @@ func TestTransformResponse(t *testing.T) { Error bool ErrFn func(err error) bool }{ - {Response: &http.Response{StatusCode: 200}, Data: []byte{}}, - {Response: &http.Response{StatusCode: 201}, Data: []byte{}, Created: true}, + {Response: &http.Response{StatusCode: http.StatusOK}, Data: []byte{}}, + {Response: &http.Response{StatusCode: http.StatusCreated}, Data: []byte{}, Created: true}, {Response: &http.Response{StatusCode: 199}, Error: true}, - {Response: &http.Response{StatusCode: 500}, Error: true}, - {Response: &http.Response{StatusCode: 422}, Error: true}, - {Response: &http.Response{StatusCode: 409}, Error: true}, - {Response: &http.Response{StatusCode: 404}, Error: true}, - {Response: &http.Response{StatusCode: 401}, Error: true}, + {Response: &http.Response{StatusCode: http.StatusInternalServerError}, Error: true}, + {Response: &http.Response{StatusCode: http.StatusUnprocessableEntity}, Error: true}, + {Response: &http.Response{StatusCode: http.StatusConflict}, Error: true}, + {Response: &http.Response{StatusCode: http.StatusNotFound}, Error: true}, + {Response: &http.Response{StatusCode: http.StatusUnauthorized}, Error: true}, { Response: &http.Response{ - StatusCode: 401, + StatusCode: http.StatusUnauthorized, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, @@ -536,7 +536,7 @@ func TestTransformResponse(t *testing.T) { }, { Response: &http.Response{ - StatusCode: 401, + StatusCode: http.StatusUnauthorized, Header: http.Header{"Content-Type": []string{"text/any"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, @@ -545,9 +545,9 @@ func TestTransformResponse(t *testing.T) { return strings.Contains(err.Error(), "server has asked for the client to provide") && apierrors.IsUnauthorized(err) }, }, - {Response: &http.Response{StatusCode: 403}, Error: true}, - {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, - {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, + {Response: &http.Response{StatusCode: http.StatusForbidden}, Error: true}, + {Response: &http.Response{StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, + {Response: &http.Response{StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, } for i, test := range testCases { r := NewRequest(nil, "", uri, "", defaultContentConfig(), defaultSerializers(t), nil, nil, 0) @@ -615,7 +615,7 @@ func TestTransformResponseNegotiate(t *testing.T) { { ContentType: "application/json", Response: &http.Response{ - StatusCode: 401, + StatusCode: http.StatusUnauthorized, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, @@ -627,7 +627,7 @@ func TestTransformResponseNegotiate(t *testing.T) { { ContentType: "application/json", Response: &http.Response{ - StatusCode: 401, + StatusCode: http.StatusUnauthorized, Header: http.Header{"Content-Type": []string{"application/protobuf"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, @@ -644,7 +644,7 @@ func TestTransformResponseNegotiate(t *testing.T) { { ContentType: "application/json", Response: &http.Response{ - StatusCode: 500, + StatusCode: http.StatusInternalServerError, Header: http.Header{"Content-Type": []string{"application/,others"}}, }, Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), @@ -657,7 +657,7 @@ func TestTransformResponseNegotiate(t *testing.T) { { // no negotiation when no content type specified Response: &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"text/any"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, @@ -667,7 +667,7 @@ func TestTransformResponseNegotiate(t *testing.T) { // no negotiation when no response content type specified ContentType: "text/any", Response: &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, Decoder: scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), @@ -676,7 +676,7 @@ func TestTransformResponseNegotiate(t *testing.T) { // unrecognized content type is not handled ContentType: "application/json", Response: &http.Response{ - StatusCode: 404, + StatusCode: http.StatusNotFound, Header: http.Header{"Content-Type": []string{"application/unrecognized"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, @@ -1178,7 +1178,7 @@ func (f *fakeUpgradeRoundTripper) RoundTrip(req *http.Request) (*http.Response, b := []byte{} body := ioutil.NopCloser(bytes.NewReader(b)) resp := &http.Response{ - StatusCode: 101, + StatusCode: http.StatusSwitchingProtocols, Body: body, } return resp, nil @@ -1367,7 +1367,7 @@ func TestConnectionResetByPeerIsRetried(t *testing.T) { count++ if count >= 3 { return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader([]byte{})), }, nil } diff --git a/scale/client_test.go b/scale/client_test.go index 0328ed63..433ff81e 100644 --- a/scale/client_test.go +++ b/scale/client_test.go @@ -180,7 +180,7 @@ func fakeScaleClient(t *testing.T) (ScalesGetter, []schema.GroupResource) { if err != nil { return nil, err } - return &http.Response{StatusCode: 200, Header: defaultHeaders(), Body: bytesBody(res)}, nil + return &http.Response{StatusCode: http.StatusOK, Header: defaultHeaders(), Body: bytesBody(res)}, nil case "PUT": decoder := codecs.UniversalDeserializer() body, err := ioutil.ReadAll(req.Body) @@ -198,7 +198,7 @@ func fakeScaleClient(t *testing.T) (ScalesGetter, []schema.GroupResource) { if err != nil { return nil, err } - return &http.Response{StatusCode: 200, Header: defaultHeaders(), Body: bytesBody(res)}, nil + return &http.Response{StatusCode: http.StatusOK, Header: defaultHeaders(), Body: bytesBody(res)}, nil case "PATCH": body, err := ioutil.ReadAll(req.Body) if err != nil { @@ -229,7 +229,7 @@ func fakeScaleClient(t *testing.T) (ScalesGetter, []schema.GroupResource) { default: return nil, fmt.Errorf("invalid patch type") } - return &http.Response{StatusCode: 200, Header: defaultHeaders(), Body: bytesBody(res)}, nil + return &http.Response{StatusCode: http.StatusOK, Header: defaultHeaders(), Body: bytesBody(res)}, nil default: return nil, fmt.Errorf("unexpected request for URL %q with method %q", req.URL.String(), req.Method) }