mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Renaming HTTPClientFunc to CreateHTTPClient
This commit is contained in:
		@@ -28,9 +28,9 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/runtime"
 | 
						"k8s.io/kubernetes/pkg/runtime"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func HTTPClientFunc(f func(*http.Request) (*http.Response, error)) *http.Client {
 | 
					func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client {
 | 
				
			||||||
	return &http.Client{
 | 
						return &http.Client{
 | 
				
			||||||
		Transport: roundTripperFunc(f),
 | 
							Transport: roundTripperFunc(roundTripper),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,7 @@ func TestNegotiateVersion(t *testing.T) {
 | 
				
			|||||||
				StatusCode: 200,
 | 
									StatusCode: 200,
 | 
				
			||||||
				Body:       objBody(&unversionedapi.APIVersions{Versions: test.serverVersions}),
 | 
									Body:       objBody(&unversionedapi.APIVersions{Versions: test.serverVersions}),
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				if test.sendErr != nil {
 | 
									if test.sendErr != nil {
 | 
				
			||||||
					return nil, test.sendErr
 | 
										return nil, test.sendErr
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -423,7 +423,7 @@ func TestAnnotateObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.Method {
 | 
								switch req.Method {
 | 
				
			||||||
			case "GET":
 | 
								case "GET":
 | 
				
			||||||
				switch req.URL.Path {
 | 
									switch req.URL.Path {
 | 
				
			||||||
@@ -470,7 +470,7 @@ func TestAnnotateObjectFromFile(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.Method {
 | 
								switch req.Method {
 | 
				
			||||||
			case "GET":
 | 
								case "GET":
 | 
				
			||||||
				switch req.URL.Path {
 | 
									switch req.URL.Path {
 | 
				
			||||||
@@ -518,7 +518,7 @@ func TestAnnotateMultipleObjects(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.Method {
 | 
								switch req.Method {
 | 
				
			||||||
			case "GET":
 | 
								case "GET":
 | 
				
			||||||
				switch req.URL.Path {
 | 
									switch req.URL.Path {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -177,7 +177,7 @@ func TestApplyObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == pathRC && m == "GET":
 | 
								case p == pathRC && m == "GET":
 | 
				
			||||||
				bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC))
 | 
									bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC))
 | 
				
			||||||
@@ -216,7 +216,7 @@ func TestApplyNonExistObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == pathNameRC && m == "GET":
 | 
								case p == pathNameRC && m == "GET":
 | 
				
			||||||
				return &http.Response{StatusCode: 404, Body: ioutil.NopCloser(bytes.NewReader(nil))}, nil
 | 
									return &http.Response{StatusCode: 404, Body: ioutil.NopCloser(bytes.NewReader(nil))}, nil
 | 
				
			||||||
@@ -255,7 +255,7 @@ func TestApplyMultipleObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == pathRC && m == "GET":
 | 
								case p == pathRC && m == "GET":
 | 
				
			||||||
				bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC))
 | 
									bodyRC := ioutil.NopCloser(bytes.NewReader(currentRC))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,7 +83,7 @@ func TestPodAndContainerAttach(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec:  codec,
 | 
								Codec:  codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { return nil, nil }),
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { return nil, nil }),
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		tf.Namespace = "test"
 | 
							tf.Namespace = "test"
 | 
				
			||||||
		tf.ClientConfig = &client.Config{}
 | 
							tf.ClientConfig = &client.Config{}
 | 
				
			||||||
@@ -136,7 +136,7 @@ func TestAttach(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.podPath && m == "GET":
 | 
									case p == test.podPath && m == "GET":
 | 
				
			||||||
					body := objBody(codec, test.pod)
 | 
										body := objBody(codec, test.pod)
 | 
				
			||||||
@@ -214,7 +214,7 @@ func TestAttachWarnings(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.podPath && m == "GET":
 | 
									case p == test.podPath && m == "GET":
 | 
				
			||||||
					body := objBody(codec, test.pod)
 | 
										body := objBody(codec, test.pod)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ func TestCreateObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers" && m == "POST":
 | 
								case p == "/namespaces/test/replicationcontrollers" && m == "POST":
 | 
				
			||||||
				return &http.Response{StatusCode: 201, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 201, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -75,7 +75,7 @@ func TestCreateMultipleObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/services" && m == "POST":
 | 
								case p == "/namespaces/test/services" && m == "POST":
 | 
				
			||||||
				return &http.Response{StatusCode: 201, Body: objBody(codec, &svc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 201, Body: objBody(codec, &svc.Items[0])}, nil
 | 
				
			||||||
@@ -110,7 +110,7 @@ func TestCreateDirectory(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/services" && m == "POST":
 | 
								case p == "/namespaces/test/services" && m == "POST":
 | 
				
			||||||
				return &http.Response{StatusCode: 201, Body: objBody(codec, &svc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 201, Body: objBody(codec, &svc.Items[0])}, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ func TestDeleteObjectByTuple(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master-controller" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master-controller" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -68,7 +68,7 @@ func TestDeleteNamedObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master-controller" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master-controller" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -100,7 +100,7 @@ func TestDeleteObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -130,7 +130,7 @@ func TestDeleteObjectNotFound(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
									return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
				
			||||||
@@ -160,7 +160,7 @@ func TestDeleteObjectIgnoreNotFound(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
									return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
				
			||||||
@@ -197,7 +197,7 @@ func TestDeleteAllNotFound(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/services" && m == "GET":
 | 
								case p == "/namespaces/test/services" && m == "GET":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil
 | 
				
			||||||
@@ -239,7 +239,7 @@ func TestDeleteAllIgnoreNotFound(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/services" && m == "GET":
 | 
								case p == "/namespaces/test/services" && m == "GET":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, svc)}, nil
 | 
				
			||||||
@@ -274,7 +274,7 @@ func TestDeleteMultipleObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -308,7 +308,7 @@ func TestDeleteMultipleObjectContinueOnMissing(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
									return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
				
			||||||
@@ -345,7 +345,7 @@ func TestDeleteMultipleResourcesWithTheSameName(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/baz" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/baz" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -381,7 +381,7 @@ func TestDeleteDirectory(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case strings.HasPrefix(p, "/namespaces/test/services/") && m == "DELETE":
 | 
								case strings.HasPrefix(p, "/namespaces/test/services/") && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
				
			||||||
@@ -414,7 +414,7 @@ func TestDeleteMultipleSelector(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/pods" && m == "GET":
 | 
								case p == "/namespaces/test/pods" && m == "GET":
 | 
				
			||||||
				if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" {
 | 
									if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,7 @@ func TestDescribeObject(t *testing.T) {
 | 
				
			|||||||
	tf.Describer = d
 | 
						tf.Describer = d
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "GET":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "GET":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,7 +126,7 @@ func TestPodAndContainer(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec:  codec,
 | 
								Codec:  codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) { return nil, nil }),
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { return nil, nil }),
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		tf.Namespace = "test"
 | 
							tf.Namespace = "test"
 | 
				
			||||||
		tf.ClientConfig = &client.Config{}
 | 
							tf.ClientConfig = &client.Config{}
 | 
				
			||||||
@@ -182,7 +182,7 @@ func TestExec(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.podPath && m == "GET":
 | 
									case p == test.podPath && m == "GET":
 | 
				
			||||||
					body := objBody(codec, test.pod)
 | 
										body := objBody(codec, test.pod)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -341,7 +341,7 @@ func TestRunExposeService(t *testing.T) {
 | 
				
			|||||||
		tf.Printer = &kubectl.JSONPrinter{}
 | 
							tf.Printer = &kubectl.JSONPrinter{}
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.calls[m] && m == "GET":
 | 
									case p == test.calls[m] && m == "GET":
 | 
				
			||||||
					return &http.Response{StatusCode: test.status, Body: objBody(codec, test.input)}, nil
 | 
										return &http.Response{StatusCode: test.status, Body: objBody(codec, test.input)}, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -179,7 +179,7 @@ func TestGetUnknownSchemaObjectListGeneric(t *testing.T) {
 | 
				
			|||||||
		apiCodec := runtime.CodecFor(api.Scheme, testapi.Default.Version())
 | 
							apiCodec := runtime.CodecFor(api.Scheme, testapi.Default.Version())
 | 
				
			||||||
		regularClient := &fake.RESTClient{
 | 
							regularClient := &fake.RESTClient{
 | 
				
			||||||
			Codec: apiCodec,
 | 
								Codec: apiCodec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(apiCodec, &api.ReplicationController{ObjectMeta: api.ObjectMeta{Name: "foo"}})}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(apiCodec, &api.ReplicationController{ObjectMeta: api.ObjectMeta{Name: "foo"}})}, nil
 | 
				
			||||||
			}),
 | 
								}),
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -188,7 +188,7 @@ func TestGetUnknownSchemaObjectListGeneric(t *testing.T) {
 | 
				
			|||||||
		tf.Printer = &testPrinter{}
 | 
							tf.Printer = &testPrinter{}
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &internalType{Name: "foo"})}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &internalType{Name: "foo"})}, nil
 | 
				
			||||||
			}),
 | 
								}),
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -407,7 +407,7 @@ func TestGetMultipleTypeObjects(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.URL.Path {
 | 
								switch req.URL.Path {
 | 
				
			||||||
			case "/namespaces/test/pods":
 | 
								case "/namespaces/test/pods":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil
 | 
				
			||||||
@@ -446,7 +446,7 @@ func TestGetMultipleTypeObjectsAsList(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.URL.Path {
 | 
								switch req.URL.Path {
 | 
				
			||||||
			case "/namespaces/test/pods":
 | 
								case "/namespaces/test/pods":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, pods)}, nil
 | 
				
			||||||
@@ -506,7 +506,7 @@ func TestGetMultipleTypeObjectsWithSelector(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" {
 | 
								if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" {
 | 
				
			||||||
				t.Fatalf("unexpected request: %#v\n%#v", req.URL, req)
 | 
									t.Fatalf("unexpected request: %#v\n%#v", req.URL, req)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -558,7 +558,7 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.URL.Path {
 | 
								switch req.URL.Path {
 | 
				
			||||||
			case "/nodes/foo":
 | 
								case "/nodes/foo":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, node)}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, node)}, nil
 | 
				
			||||||
@@ -632,7 +632,7 @@ func TestWatchSelector(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" {
 | 
								if req.URL.Query().Get(unversioned.LabelSelectorQueryParam(testapi.Default.Version())) != "a=b" {
 | 
				
			||||||
				t.Fatalf("unexpected request: %#v\n%#v", req.URL, req)
 | 
									t.Fatalf("unexpected request: %#v\n%#v", req.URL, req)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -674,7 +674,7 @@ func TestWatchResource(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.URL.Path {
 | 
								switch req.URL.Path {
 | 
				
			||||||
			case "/namespaces/test/pods/foo":
 | 
								case "/namespaces/test/pods/foo":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil
 | 
				
			||||||
@@ -712,7 +712,7 @@ func TestWatchResourceIdentifiedByFile(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.URL.Path {
 | 
								switch req.URL.Path {
 | 
				
			||||||
			case "/namespaces/test/pods/cassandra":
 | 
								case "/namespaces/test/pods/cassandra":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil
 | 
				
			||||||
@@ -751,7 +751,7 @@ func TestWatchOnlyResource(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.URL.Path {
 | 
								switch req.URL.Path {
 | 
				
			||||||
			case "/namespaces/test/pods/foo":
 | 
								case "/namespaces/test/pods/foo":
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &pods[0])}, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -329,7 +329,7 @@ func TestLabelForResourceFromFile(t *testing.T) {
 | 
				
			|||||||
	f, tf, codec := NewAPIFactory()
 | 
						f, tf, codec := NewAPIFactory()
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.Method {
 | 
								switch req.Method {
 | 
				
			||||||
			case "GET":
 | 
								case "GET":
 | 
				
			||||||
				switch req.URL.Path {
 | 
									switch req.URL.Path {
 | 
				
			||||||
@@ -376,7 +376,7 @@ func TestLabelMultipleObjects(t *testing.T) {
 | 
				
			|||||||
	f, tf, codec := NewAPIFactory()
 | 
						f, tf, codec := NewAPIFactory()
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch req.Method {
 | 
								switch req.Method {
 | 
				
			||||||
			case "GET":
 | 
								case "GET":
 | 
				
			||||||
				switch req.URL.Path {
 | 
									switch req.URL.Path {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,7 +49,7 @@ func TestLog(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.podPath && m == "GET":
 | 
									case p == test.podPath && m == "GET":
 | 
				
			||||||
					body := objBody(codec, test.pod)
 | 
										body := objBody(codec, test.pod)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ func TestPatchObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/services/frontend" && (m == "PATCH" || m == "GET"):
 | 
								case p == "/namespaces/test/services/frontend" && (m == "PATCH" || m == "GET"):
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
				
			||||||
@@ -63,7 +63,7 @@ func TestPatchObjectFromFile(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/services/frontend" && (m == "PATCH" || m == "GET"):
 | 
								case p == "/namespaces/test/services/frontend" && (m == "PATCH" || m == "GET"):
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@ func TestPortForward(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.podPath && m == "GET":
 | 
									case p == test.podPath && m == "GET":
 | 
				
			||||||
					body := objBody(codec, test.pod)
 | 
										body := objBody(codec, test.pod)
 | 
				
			||||||
@@ -140,7 +140,7 @@ func TestPortForwardWithPFlag(t *testing.T) {
 | 
				
			|||||||
		f, tf, codec := NewAPIFactory()
 | 
							f, tf, codec := NewAPIFactory()
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case p == test.podPath && m == "GET":
 | 
									case p == test.podPath && m == "GET":
 | 
				
			||||||
					body := objBody(codec, test.pod)
 | 
										body := objBody(codec, test.pod)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ func TestReplaceObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && (m == "GET" || m == "PUT" || m == "DELETE"):
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && (m == "GET" || m == "PUT" || m == "DELETE"):
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -75,7 +75,7 @@ func TestReplaceMultipleObject(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && (m == "GET" || m == "PUT" || m == "DELETE"):
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && (m == "GET" || m == "PUT" || m == "DELETE"):
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &rc.Items[0])}, nil
 | 
				
			||||||
@@ -122,7 +122,7 @@ func TestReplaceDirectory(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case strings.HasPrefix(p, "/namespaces/test/services/") && (m == "GET" || m == "PUT" || m == "DELETE"):
 | 
								case strings.HasPrefix(p, "/namespaces/test/services/") && (m == "GET" || m == "PUT" || m == "DELETE"):
 | 
				
			||||||
				return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
									return &http.Response{StatusCode: 200, Body: objBody(codec, &svc.Items[0])}, nil
 | 
				
			||||||
@@ -169,7 +169,7 @@ func TestForceReplaceObjectNotFound(t *testing.T) {
 | 
				
			|||||||
	tf.Printer = &testPrinter{}
 | 
						tf.Printer = &testPrinter{}
 | 
				
			||||||
	tf.Client = &fake.RESTClient{
 | 
						tf.Client = &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
								case p == "/namespaces/test/replicationcontrollers/redis-master" && m == "DELETE":
 | 
				
			||||||
				return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
									return &http.Response{StatusCode: 404, Body: stringBody("")}, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -203,7 +203,7 @@ func TestGenerateService(t *testing.T) {
 | 
				
			|||||||
		tf.ClientConfig = &client.Config{Version: testapi.Default.Version()}
 | 
							tf.ClientConfig = &client.Config{Version: testapi.Default.Version()}
 | 
				
			||||||
		tf.Client = &fake.RESTClient{
 | 
							tf.Client = &fake.RESTClient{
 | 
				
			||||||
			Codec: codec,
 | 
								Codec: codec,
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				switch p, m := req.URL.Path, req.Method; {
 | 
									switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
				case test.expectPOST && m == "POST" && p == "/namespaces/namespace/services":
 | 
									case test.expectPOST && m == "POST" && p == "/namespaces/namespace/services":
 | 
				
			||||||
					sawPOST = true
 | 
										sawPOST = true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -230,7 +230,7 @@ func TestValidateCachesSchema(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	c := &fake.RESTClient{
 | 
						c := &fake.RESTClient{
 | 
				
			||||||
		Codec: testapi.Default.Codec(),
 | 
							Codec: testapi.Default.Codec(),
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case strings.HasPrefix(p, "/swaggerapi") && m == "GET":
 | 
								case strings.HasPrefix(p, "/swaggerapi") && m == "GET":
 | 
				
			||||||
				requests[p] = requests[p] + 1
 | 
									requests[p] = requests[p] + 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,7 +64,7 @@ func fakeClientWith(testName string, t *testing.T, data map[string]string) Clien
 | 
				
			|||||||
	return ClientMapperFunc(func(*meta.RESTMapping) (RESTClient, error) {
 | 
						return ClientMapperFunc(func(*meta.RESTMapping) (RESTClient, error) {
 | 
				
			||||||
		return &fake.RESTClient{
 | 
							return &fake.RESTClient{
 | 
				
			||||||
			Codec: testapi.Default.Codec(),
 | 
								Codec: testapi.Default.Codec(),
 | 
				
			||||||
			Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				p := req.URL.Path
 | 
									p := req.URL.Path
 | 
				
			||||||
				q := req.URL.RawQuery
 | 
									q := req.URL.RawQuery
 | 
				
			||||||
				if len(q) != 0 {
 | 
									if len(q) != 0 {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -417,7 +417,7 @@ func TestHelperReplace(t *testing.T) {
 | 
				
			|||||||
				Spec:       apitesting.DeepEqualSafePodSpec(),
 | 
									Spec:       apitesting.DeepEqualSafePodSpec(),
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Overwrite: true,
 | 
								Overwrite: true,
 | 
				
			||||||
			HTTPClient: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
								HTTPClient: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
				if req.Method == "PUT" {
 | 
									if req.Method == "PUT" {
 | 
				
			||||||
					return &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})}, nil
 | 
										return &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})}, nil
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1051,7 +1051,7 @@ func TestUpdateWithRetries(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	fakeClient := &fake.RESTClient{
 | 
						fakeClient := &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == testapi.Default.ResourcePath("replicationcontrollers", "default", "rc") && m == "PUT":
 | 
								case p == testapi.Default.ResourcePath("replicationcontrollers", "default", "rc") && m == "PUT":
 | 
				
			||||||
				update := updates[0]
 | 
									update := updates[0]
 | 
				
			||||||
@@ -1142,7 +1142,7 @@ func TestAddDeploymentHash(t *testing.T) {
 | 
				
			|||||||
	updatedRc := false
 | 
						updatedRc := false
 | 
				
			||||||
	fakeClient := &fake.RESTClient{
 | 
						fakeClient := &fake.RESTClient{
 | 
				
			||||||
		Codec: codec,
 | 
							Codec: codec,
 | 
				
			||||||
		Client: fake.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
 | 
							Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
 | 
				
			||||||
			switch p, m := req.URL.Path, req.Method; {
 | 
								switch p, m := req.URL.Path, req.Method; {
 | 
				
			||||||
			case p == testapi.Default.ResourcePath("pods", "default", "") && m == "GET":
 | 
								case p == testapi.Default.ResourcePath("pods", "default", "") && m == "GET":
 | 
				
			||||||
				if req.URL.RawQuery != "labelSelector=foo%3Dbar" {
 | 
									if req.URL.RawQuery != "labelSelector=foo%3Dbar" {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user