Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
eacf65dd
Commit
eacf65dd
authored
Nov 11, 2015
by
Kris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming HTTPClientFunc to CreateHTTPClient
parent
4a4d1954
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
58 additions
and
58 deletions
+58
-58
fake.go
pkg/client/unversioned/fake/fake.go
+2
-2
helper_blackbox_test.go
pkg/client/unversioned/helper_blackbox_test.go
+1
-1
annotate_test.go
pkg/kubectl/cmd/annotate_test.go
+3
-3
apply_test.go
pkg/kubectl/cmd/apply_test.go
+3
-3
attach_test.go
pkg/kubectl/cmd/attach_test.go
+3
-3
create_test.go
pkg/kubectl/cmd/create_test.go
+3
-3
delete_test.go
pkg/kubectl/cmd/delete_test.go
+12
-12
describe_test.go
pkg/kubectl/cmd/describe_test.go
+1
-1
exec_test.go
pkg/kubectl/cmd/exec_test.go
+2
-2
expose_test.go
pkg/kubectl/cmd/expose_test.go
+1
-1
get_test.go
pkg/kubectl/cmd/get_test.go
+10
-10
label_test.go
pkg/kubectl/cmd/label_test.go
+2
-2
log_test.go
pkg/kubectl/cmd/log_test.go
+1
-1
patch_test.go
pkg/kubectl/cmd/patch_test.go
+2
-2
portforward_test.go
pkg/kubectl/cmd/portforward_test.go
+2
-2
replace_test.go
pkg/kubectl/cmd/replace_test.go
+4
-4
run_test.go
pkg/kubectl/cmd/run_test.go
+1
-1
factory_test.go
pkg/kubectl/cmd/util/factory_test.go
+1
-1
builder_test.go
pkg/kubectl/resource/builder_test.go
+1
-1
helper_test.go
pkg/kubectl/resource/helper_test.go
+1
-1
rolling_updater_test.go
pkg/kubectl/rolling_updater_test.go
+2
-2
No files found.
pkg/client/unversioned/fake/fake.go
View file @
eacf65dd
...
@@ -28,9 +28,9 @@ import (
...
@@ -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
),
}
}
}
}
...
...
pkg/client/unversioned/helper_blackbox_test.go
View file @
eacf65dd
...
@@ -99,7 +99,7 @@ func TestNegotiateVersion(t *testing.T) {
...
@@ -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
}
}
...
...
pkg/kubectl/cmd/annotate_test.go
View file @
eacf65dd
...
@@ -423,7 +423,7 @@ func TestAnnotateObject(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
{
...
...
pkg/kubectl/cmd/apply_test.go
View file @
eacf65dd
...
@@ -177,7 +177,7 @@ func TestApplyObject(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
))
...
...
pkg/kubectl/cmd/attach_test.go
View file @
eacf65dd
...
@@ -83,7 +83,7 @@ func TestPodAndContainerAttach(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
)
...
...
pkg/kubectl/cmd/create_test.go
View file @
eacf65dd
...
@@ -44,7 +44,7 @@ func TestCreateObject(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
...
...
pkg/kubectl/cmd/delete_test.go
View file @
eacf65dd
...
@@ -36,7 +36,7 @@ func TestDeleteObjectByTuple(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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"
{
...
...
pkg/kubectl/cmd/describe_test.go
View file @
eacf65dd
...
@@ -56,7 +56,7 @@ func TestDescribeObject(t *testing.T) {
...
@@ -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
...
...
pkg/kubectl/cmd/exec_test.go
View file @
eacf65dd
...
@@ -126,7 +126,7 @@ func TestPodAndContainer(t *testing.T) {
...
@@ -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) {
...
@@ -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
)
...
...
pkg/kubectl/cmd/expose_test.go
View file @
eacf65dd
...
@@ -341,7 +341,7 @@ func TestRunExposeService(t *testing.T) {
...
@@ -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
...
...
pkg/kubectl/cmd/get_test.go
View file @
eacf65dd
...
@@ -179,7 +179,7 @@ func TestGetUnknownSchemaObjectListGeneric(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
...
...
pkg/kubectl/cmd/label_test.go
View file @
eacf65dd
...
@@ -329,7 +329,7 @@ func TestLabelForResourceFromFile(t *testing.T) {
...
@@ -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) {
...
@@ -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
{
...
...
pkg/kubectl/cmd/log_test.go
View file @
eacf65dd
...
@@ -49,7 +49,7 @@ func TestLog(t *testing.T) {
...
@@ -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
)
...
...
pkg/kubectl/cmd/patch_test.go
View file @
eacf65dd
...
@@ -31,7 +31,7 @@ func TestPatchObject(t *testing.T) {
...
@@ -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) {
...
@@ -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
...
...
pkg/kubectl/cmd/portforward_test.go
View file @
eacf65dd
...
@@ -70,7 +70,7 @@ func TestPortForward(t *testing.T) {
...
@@ -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) {
...
@@ -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
)
...
...
pkg/kubectl/cmd/replace_test.go
View file @
eacf65dd
...
@@ -32,7 +32,7 @@ func TestReplaceObject(t *testing.T) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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) {
...
@@ -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
...
...
pkg/kubectl/cmd/run_test.go
View file @
eacf65dd
...
@@ -203,7 +203,7 @@ func TestGenerateService(t *testing.T) {
...
@@ -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
...
...
pkg/kubectl/cmd/util/factory_test.go
View file @
eacf65dd
...
@@ -230,7 +230,7 @@ func TestValidateCachesSchema(t *testing.T) {
...
@@ -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
...
...
pkg/kubectl/resource/builder_test.go
View file @
eacf65dd
...
@@ -64,7 +64,7 @@ func fakeClientWith(testName string, t *testing.T, data map[string]string) Clien
...
@@ -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
{
...
...
pkg/kubectl/resource/helper_test.go
View file @
eacf65dd
...
@@ -417,7 +417,7 @@ func TestHelperReplace(t *testing.T) {
...
@@ -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
}
}
...
...
pkg/kubectl/rolling_updater_test.go
View file @
eacf65dd
...
@@ -1051,7 +1051,7 @@ func TestUpdateWithRetries(t *testing.T) {
...
@@ -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) {
...
@@ -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"
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment