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
bf1a3f99
Commit
bf1a3f99
authored
Apr 21, 2016
by
zhouhaibing089
Committed by
haibzhou
Apr 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uncomment the code that cause by #19254
parent
c0020aff
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
167 additions
and
334 deletions
+167
-334
integration_test.go
contrib/mesos/pkg/scheduler/integration/integration_test.go
+1
-2
apiserver_test.go
pkg/apiserver/apiserver_test.go
+0
-0
handlers_test.go
pkg/apiserver/handlers_test.go
+3
-6
proxy_test.go
pkg/apiserver/proxy_test.go
+8
-16
watch_test.go
pkg/apiserver/watch_test.go
+5
-10
listwatch_test.go
pkg/client/cache/listwatch_test.go
+2
-4
chaosclient_test.go
pkg/client/chaosclient/chaosclient_test.go
+2
-4
client_test.go
pkg/client/restclient/client_test.go
+3
-6
request_test.go
pkg/client/restclient/request_test.go
+11
-22
client_test.go
pkg/client/typed/discovery/client_test.go
+6
-12
containerinfo_test.go
pkg/client/unversioned/containerinfo_test.go
+2
-4
helper_test.go
pkg/client/unversioned/helper_test.go
+1
-2
portforward_test.go
pkg/client/unversioned/portforward/portforward_test.go
+7
-14
remotecommand_test.go
pkg/client/unversioned/remotecommand/remotecommand_test.go
+3
-6
simple_testclient.go
...client/unversioned/testclient/simple/simple_testclient.go
+1
-2
client_test.go
pkg/cloudprovider/providers/mesos/client_test.go
+4
-8
controller_utils_test.go
pkg/controller/controller_utils_test.go
+1
-2
endpoints_controller_test.go
pkg/controller/endpoint/endpoints_controller_test.go
+12
-24
replication_controller_test.go
pkg/controller/replication/replication_controller_test.go
+4
-8
jwt_test.go
pkg/credentialprovider/gcp/jwt_test.go
+1
-2
metadata_test.go
pkg/credentialprovider/gcp/metadata_test.go
+6
-12
proxy_server_test.go
pkg/kubectl/proxy_server_test.go
+4
-8
builder_test.go
pkg/kubectl/resource/builder_test.go
+3
-6
kubelet_client_test.go
pkg/kubelet/client/kubelet_client_test.go
+1
-2
http_test.go
pkg/kubelet/config/http_test.go
+3
-6
master_test.go
pkg/master/master_test.go
+7
-14
tcp_test.go
pkg/probe/tcp/tcp_test.go
+1
-2
proxy_test.go
pkg/registry/generic/rest/proxy_test.go
+6
-12
streamer_test.go
pkg/registry/generic/rest/streamer_test.go
+1
-2
utils.go
pkg/storage/etcd/testing/utils.go
+1
-2
etcd_util_test.go
pkg/storage/etcd/util/etcd_util_test.go
+2
-4
configz_test.go
pkg/util/configz/configz_test.go
+1
-2
roundtripper_test.go
pkg/util/httpstream/spdy/roundtripper_test.go
+2
-4
upgrade_test.go
pkg/util/httpstream/spdy/upgrade_test.go
+1
-2
transport_test.go
pkg/util/proxy/transport_test.go
+1
-2
fake_handler_test.go
pkg/util/testing/fake_handler_test.go
+6
-12
conn_test.go
pkg/util/wsstream/conn_test.go
+4
-8
oidc_test.go
plugin/pkg/auth/authenticator/token/oidc/oidc_test.go
+4
-8
compatibility_test.go
...cheduler/algorithmprovider/defaults/compatibility_test.go
+1
-2
factory_test.go
plugin/pkg/scheduler/factory/factory_test.go
+6
-12
util.go
test/component/scheduler/perf/util.go
+1
-2
auth_test.go
test/integration/auth_test.go
+9
-18
client_test.go
test/integration/client_test.go
+3
-6
configmap_test.go
test/integration/configmap_test.go
+1
-2
extender_test.go
test/integration/extender_test.go
+3
-6
master_utils.go
test/integration/framework/master_utils.go
+1
-2
master_test.go
test/integration/master_test.go
+3
-6
metrics_test.go
test/integration/metrics_test.go
+2
-4
persistent_volumes_test.go
test/integration/persistent_volumes_test.go
+1
-2
pods.go
test/integration/pods.go
+2
-4
scheduler_test.go
test/integration/scheduler_test.go
+1
-2
secret_test.go
test/integration/secret_test.go
+1
-2
service_account_test.go
test/integration/service_account_test.go
+1
-2
No files found.
contrib/mesos/pkg/scheduler/integration/integration_test.go
View file @
bf1a3f99
...
@@ -623,8 +623,7 @@ func (lt lifecycleTest) Start() <-chan LaunchedTask {
...
@@ -623,8 +623,7 @@ func (lt lifecycleTest) Start() <-chan LaunchedTask {
}
}
func
(
lt
lifecycleTest
)
Close
()
{
func
(
lt
lifecycleTest
)
Close
()
{
// TODO: Uncomment when fix #19254
lt
.
apiServer
.
server
.
Close
()
// lt.apiServer.server.Close()
}
}
func
(
lt
lifecycleTest
)
End
()
<-
chan
struct
{}
{
func
(
lt
lifecycleTest
)
End
()
<-
chan
struct
{}
{
...
...
pkg/apiserver/apiserver_test.go
View file @
bf1a3f99
This diff is collapsed.
Click to expand it.
pkg/apiserver/handlers_test.go
View file @
bf1a3f99
...
@@ -112,8 +112,7 @@ func TestMaxInFlight(t *testing.T) {
...
@@ -112,8 +112,7 @@ func TestMaxInFlight(t *testing.T) {
}),
}),
),
),
)
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// These should hang, but not affect accounting. use a query param match
// These should hang, but not affect accounting. use a query param match
for
i
:=
0
;
i
<
AllowedInflightRequestsNo
;
i
++
{
for
i
:=
0
;
i
<
AllowedInflightRequestsNo
;
i
++
{
...
@@ -175,8 +174,7 @@ func TestReadOnly(t *testing.T) {
...
@@ -175,8 +174,7 @@ func TestReadOnly(t *testing.T) {
}
}
},
},
)))
)))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
for
_
,
verb
:=
range
[]
string
{
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
,
"CREATE"
}
{
for
_
,
verb
:=
range
[]
string
{
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
,
"CREATE"
}
{
req
,
err
:=
http
.
NewRequest
(
verb
,
server
.
URL
,
nil
)
req
,
err
:=
http
.
NewRequest
(
verb
,
server
.
URL
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -202,8 +200,7 @@ func TestTimeout(t *testing.T) {
...
@@ -202,8 +200,7 @@ func TestTimeout(t *testing.T) {
func
(
*
http
.
Request
)
(
<-
chan
time
.
Time
,
string
)
{
func
(
*
http
.
Request
)
(
<-
chan
time
.
Time
,
string
)
{
return
timeout
,
timeoutResp
return
timeout
,
timeoutResp
}))
}))
// TODO: Uncomment when fix #19254
defer
ts
.
Close
()
// defer ts.Close()
// No timeouts
// No timeouts
sendResponse
<-
struct
{}{}
sendResponse
<-
struct
{}{}
...
...
pkg/apiserver/proxy_test.go
View file @
bf1a3f99
...
@@ -194,8 +194,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
...
@@ -194,8 +194,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
// Write successful response
// Write successful response
w
.
Write
([]
byte
(
successfulResponse
))
w
.
Write
([]
byte
(
successfulResponse
))
}))
}))
// TODO: Uncomment when fix #19254
defer
downstreamServer
.
Close
()
// defer downstreamServer.Close()
// Start the proxy server
// Start the proxy server
serverURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
serverURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
...
@@ -206,8 +205,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
...
@@ -206,8 +205,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
}
}
namespaceHandler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
namespaceHandler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
server
:=
httptest
.
NewServer
(
namespaceHandler
)
server
:=
httptest
.
NewServer
(
namespaceHandler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Dial the proxy server
// Dial the proxy server
conn
,
err
:=
net
.
Dial
(
server
.
Listener
.
Addr
()
.
Network
(),
server
.
Listener
.
Addr
()
.
String
())
conn
,
err
:=
net
.
Dial
(
server
.
Listener
.
Addr
()
.
Network
(),
server
.
Listener
.
Addr
()
.
String
())
...
@@ -302,8 +300,7 @@ func TestProxy(t *testing.T) {
...
@@ -302,8 +300,7 @@ func TestProxy(t *testing.T) {
}
}
fmt
.
Fprint
(
out
,
item
.
respBody
)
fmt
.
Fprint
(
out
,
item
.
respBody
)
}))
}))
// TODO: Uncomment when fix #19254
defer
downstreamServer
.
Close
()
// defer downstreamServer.Close()
serverURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
serverURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
simpleStorage
:=
&
SimpleRESTStorage
{
simpleStorage
:=
&
SimpleRESTStorage
{
...
@@ -314,8 +311,7 @@ func TestProxy(t *testing.T) {
...
@@ -314,8 +311,7 @@ func TestProxy(t *testing.T) {
namespaceHandler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
namespaceHandler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
namespaceServer
:=
httptest
.
NewServer
(
namespaceHandler
)
namespaceServer
:=
httptest
.
NewServer
(
namespaceHandler
)
// TODO: Uncomment when fix #19254
defer
namespaceServer
.
Close
()
// defer namespaceServer.Close()
// test each supported URL pattern for finding the redirection resource in the proxy in a particular namespace
// test each supported URL pattern for finding the redirection resource in the proxy in a particular namespace
serverPatterns
:=
[]
struct
{
serverPatterns
:=
[]
struct
{
...
@@ -424,8 +420,7 @@ func TestProxyUpgrade(t *testing.T) {
...
@@ -424,8 +420,7 @@ func TestProxyUpgrade(t *testing.T) {
ws
.
Read
(
body
)
ws
.
Read
(
body
)
ws
.
Write
([]
byte
(
"hello "
+
string
(
body
)))
ws
.
Write
([]
byte
(
"hello "
+
string
(
body
)))
}))
}))
// TODO: Uncomment when fix #19254
defer
backendServer
.
Close
()
// defer backendServer.Close()
serverURL
,
_
:=
url
.
Parse
(
backendServer
.
URL
)
serverURL
,
_
:=
url
.
Parse
(
backendServer
.
URL
)
simpleStorage
:=
&
SimpleRESTStorage
{
simpleStorage
:=
&
SimpleRESTStorage
{
...
@@ -438,8 +433,7 @@ func TestProxyUpgrade(t *testing.T) {
...
@@ -438,8 +433,7 @@ func TestProxyUpgrade(t *testing.T) {
namespaceHandler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
namespaceHandler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
server
:=
httptest
.
NewServer
(
namespaceHandler
)
server
:=
httptest
.
NewServer
(
namespaceHandler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
ws
,
err
:=
websocket
.
Dial
(
"ws://"
+
server
.
Listener
.
Addr
()
.
String
()
+
"/"
+
prefix
+
"/"
+
newGroupVersion
.
Group
+
"/"
+
newGroupVersion
.
Version
+
"/proxy/namespaces/myns/foo/123"
,
""
,
"http://127.0.0.1/"
)
ws
,
err
:=
websocket
.
Dial
(
"ws://"
+
server
.
Listener
.
Addr
()
.
String
()
+
"/"
+
prefix
+
"/"
+
newGroupVersion
.
Group
+
"/"
+
newGroupVersion
.
Version
+
"/proxy/namespaces/myns/foo/123"
,
""
,
"http://127.0.0.1/"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -492,8 +486,7 @@ func TestRedirectOnMissingTrailingSlash(t *testing.T) {
...
@@ -492,8 +486,7 @@ func TestRedirectOnMissingTrailingSlash(t *testing.T) {
t
.
Errorf
(
"Unexpected query on url: %s, expected: %s"
,
req
.
URL
.
RawQuery
,
item
.
query
)
t
.
Errorf
(
"Unexpected query on url: %s, expected: %s"
,
req
.
URL
.
RawQuery
,
item
.
query
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
downstreamServer
.
Close
()
// defer downstreamServer.Close()
serverURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
serverURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
simpleStorage
:=
&
SimpleRESTStorage
{
simpleStorage
:=
&
SimpleRESTStorage
{
...
@@ -504,8 +497,7 @@ func TestRedirectOnMissingTrailingSlash(t *testing.T) {
...
@@ -504,8 +497,7 @@ func TestRedirectOnMissingTrailingSlash(t *testing.T) {
handler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
handler
:=
handleNamespaced
(
map
[
string
]
rest
.
Storage
{
"foo"
:
simpleStorage
})
server
:=
httptest
.
NewServer
(
handler
)
server
:=
httptest
.
NewServer
(
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
proxyTestPattern
:=
"/"
+
prefix
+
"/"
+
newGroupVersion
.
Group
+
"/"
+
newGroupVersion
.
Version
+
"/proxy/namespaces/ns/foo/id"
+
item
.
path
proxyTestPattern
:=
"/"
+
prefix
+
"/"
+
newGroupVersion
.
Group
+
"/"
+
newGroupVersion
.
Version
+
"/proxy/namespaces/ns/foo/id"
+
item
.
path
req
,
err
:=
http
.
NewRequest
(
req
,
err
:=
http
.
NewRequest
(
...
...
pkg/apiserver/watch_test.go
View file @
bf1a3f99
...
@@ -88,8 +88,7 @@ func TestWatchWebsocket(t *testing.T) {
...
@@ -88,8 +88,7 @@ func TestWatchWebsocket(t *testing.T) {
_
=
rest
.
Watcher
(
simpleStorage
)
// Give compile error if this doesn't work.
_
=
rest
.
Watcher
(
simpleStorage
)
// Give compile error if this doesn't work.
handler
:=
handle
(
map
[
string
]
rest
.
Storage
{
"simples"
:
simpleStorage
})
handler
:=
handle
(
map
[
string
]
rest
.
Storage
{
"simples"
:
simpleStorage
})
server
:=
httptest
.
NewServer
(
handler
)
server
:=
httptest
.
NewServer
(
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
dest
,
_
:=
url
.
Parse
(
server
.
URL
)
dest
,
_
:=
url
.
Parse
(
server
.
URL
)
dest
.
Scheme
=
"ws"
// Required by websocket, though the server never sees it.
dest
.
Scheme
=
"ws"
// Required by websocket, though the server never sees it.
...
@@ -142,8 +141,7 @@ func TestWatchRead(t *testing.T) {
...
@@ -142,8 +141,7 @@ func TestWatchRead(t *testing.T) {
_
=
rest
.
Watcher
(
simpleStorage
)
// Give compile error if this doesn't work.
_
=
rest
.
Watcher
(
simpleStorage
)
// Give compile error if this doesn't work.
handler
:=
handle
(
map
[
string
]
rest
.
Storage
{
"simples"
:
simpleStorage
})
handler
:=
handle
(
map
[
string
]
rest
.
Storage
{
"simples"
:
simpleStorage
})
server
:=
httptest
.
NewServer
(
handler
)
server
:=
httptest
.
NewServer
(
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
dest
,
_
:=
url
.
Parse
(
server
.
URL
)
dest
,
_
:=
url
.
Parse
(
server
.
URL
)
dest
.
Path
=
"/"
+
prefix
+
"/"
+
testGroupVersion
.
Group
+
"/"
+
testGroupVersion
.
Version
+
"/simples"
dest
.
Path
=
"/"
+
prefix
+
"/"
+
testGroupVersion
.
Group
+
"/"
+
testGroupVersion
.
Version
+
"/simples"
...
@@ -328,8 +326,7 @@ func TestWatchParamParsing(t *testing.T) {
...
@@ -328,8 +326,7 @@ func TestWatchParamParsing(t *testing.T) {
"simpleroots"
:
simpleStorage
,
"simpleroots"
:
simpleStorage
,
})
})
server
:=
httptest
.
NewServer
(
handler
)
server
:=
httptest
.
NewServer
(
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
dest
,
_
:=
url
.
Parse
(
server
.
URL
)
dest
,
_
:=
url
.
Parse
(
server
.
URL
)
...
@@ -436,8 +433,7 @@ func TestWatchProtocolSelection(t *testing.T) {
...
@@ -436,8 +433,7 @@ func TestWatchProtocolSelection(t *testing.T) {
simpleStorage
:=
&
SimpleRESTStorage
{}
simpleStorage
:=
&
SimpleRESTStorage
{}
handler
:=
handle
(
map
[
string
]
rest
.
Storage
{
"simples"
:
simpleStorage
})
handler
:=
handle
(
map
[
string
]
rest
.
Storage
{
"simples"
:
simpleStorage
})
server
:=
httptest
.
NewServer
(
handler
)
server
:=
httptest
.
NewServer
(
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
server
.
CloseClientConnections
()
defer
server
.
CloseClientConnections
()
client
:=
http
.
Client
{}
client
:=
http
.
Client
{}
...
@@ -520,8 +516,7 @@ func TestWatchHTTPTimeout(t *testing.T) {
...
@@ -520,8 +516,7 @@ func TestWatchHTTPTimeout(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
watchServer
.
ServeHTTP
(
w
,
req
)
watchServer
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
// Setup a client
// Setup a client
dest
,
_
:=
url
.
Parse
(
s
.
URL
)
dest
,
_
:=
url
.
Parse
(
s
.
URL
)
...
...
pkg/client/cache/listwatch_test.go
View file @
bf1a3f99
...
@@ -96,8 +96,7 @@ func TestListWatchesCanList(t *testing.T) {
...
@@ -96,8 +96,7 @@ func TestListWatchesCanList(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
lw
:=
NewListWatchFromClient
(
client
,
item
.
resource
,
item
.
namespace
,
item
.
fieldSelector
)
lw
:=
NewListWatchFromClient
(
client
,
item
.
resource
,
item
.
namespace
,
item
.
fieldSelector
)
// This test merely tests that the correct request is made.
// This test merely tests that the correct request is made.
...
@@ -163,8 +162,7 @@ func TestListWatchesCanWatch(t *testing.T) {
...
@@ -163,8 +162,7 @@ func TestListWatchesCanWatch(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
lw
:=
NewListWatchFromClient
(
client
,
item
.
resource
,
item
.
namespace
,
item
.
fieldSelector
)
lw
:=
NewListWatchFromClient
(
client
,
item
.
resource
,
item
.
namespace
,
item
.
fieldSelector
)
// This test merely tests that the correct request is made.
// This test merely tests that the correct request is made.
...
...
pkg/client/chaosclient/chaosclient_test.go
View file @
bf1a3f99
...
@@ -42,8 +42,7 @@ func TestChaos(t *testing.T) {
...
@@ -42,8 +42,7 @@ func TestChaos(t *testing.T) {
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
)
{
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
)
{
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
http
.
Client
{
client
:=
http
.
Client
{
Transport
:
NewChaosRoundTripper
(
http
.
DefaultTransport
,
TestLogChaos
{
t
},
ErrSimulatedConnectionResetByPeer
),
Transport
:
NewChaosRoundTripper
(
http
.
DefaultTransport
,
TestLogChaos
{
t
},
ErrSimulatedConnectionResetByPeer
),
}
}
...
@@ -60,8 +59,7 @@ func TestPartialChaos(t *testing.T) {
...
@@ -60,8 +59,7 @@ func TestPartialChaos(t *testing.T) {
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
)
{
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
)
{
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
seed
:=
NewSeed
(
1
)
seed
:=
NewSeed
(
1
)
client
:=
http
.
Client
{
client
:=
http
.
Client
{
Transport
:
NewChaosRoundTripper
(
Transport
:
NewChaosRoundTripper
(
...
...
pkg/client/restclient/client_test.go
View file @
bf1a3f99
...
@@ -42,8 +42,7 @@ func TestDoRequestSuccess(t *testing.T) {
...
@@ -42,8 +42,7 @@ func TestDoRequestSuccess(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
,
err
:=
RESTClientFor
(
&
Config
{
c
,
err
:=
RESTClientFor
(
&
Config
{
Host
:
testServer
.
URL
,
Host
:
testServer
.
URL
,
ContentConfig
:
ContentConfig
{
ContentConfig
:
ContentConfig
{
...
@@ -88,8 +87,7 @@ func TestDoRequestFailed(t *testing.T) {
...
@@ -88,8 +87,7 @@ func TestDoRequestFailed(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
,
err
:=
RESTClientFor
(
&
Config
{
c
,
err
:=
RESTClientFor
(
&
Config
{
Host
:
testServer
.
URL
,
Host
:
testServer
.
URL
,
ContentConfig
:
ContentConfig
{
ContentConfig
:
ContentConfig
{
...
@@ -127,8 +125,7 @@ func TestDoRequestCreated(t *testing.T) {
...
@@ -127,8 +125,7 @@ func TestDoRequestCreated(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
,
err
:=
RESTClientFor
(
&
Config
{
c
,
err
:=
RESTClientFor
(
&
Config
{
Host
:
testServer
.
URL
,
Host
:
testServer
.
URL
,
ContentConfig
:
ContentConfig
{
ContentConfig
:
ContentConfig
{
...
...
pkg/client/restclient/request_test.go
View file @
bf1a3f99
...
@@ -723,8 +723,7 @@ func TestDoRequestNewWay(t *testing.T) {
...
@@ -723,8 +723,7 @@ func TestDoRequestNewWay(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
Prefix
(
"foo"
,
"bar"
)
.
Prefix
(
"foo"
,
"bar"
)
.
...
@@ -760,8 +759,7 @@ func TestBackoffLifecycle(t *testing.T) {
...
@@ -760,8 +759,7 @@ func TestBackoffLifecycle(t *testing.T) {
return
return
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
// Test backoff recovery and increase. This correlates to the constants
// Test backoff recovery and increase. This correlates to the constants
...
@@ -806,8 +804,7 @@ func TestCheckRetryClosesBody(t *testing.T) {
...
@@ -806,8 +804,7 @@ func TestCheckRetryClosesBody(t *testing.T) {
w
.
Header
()
.
Set
(
"Retry-After"
,
"0"
)
w
.
Header
()
.
Set
(
"Retry-After"
,
"0"
)
w
.
WriteHeader
(
apierrors
.
StatusTooManyRequests
)
w
.
WriteHeader
(
apierrors
.
StatusTooManyRequests
)
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
_
,
err
:=
c
.
Verb
(
"POST"
)
.
_
,
err
:=
c
.
Verb
(
"POST"
)
.
...
@@ -839,8 +836,7 @@ func TestCheckRetryHandles429And5xx(t *testing.T) {
...
@@ -839,8 +836,7 @@ func TestCheckRetryHandles429And5xx(t *testing.T) {
w
.
WriteHeader
([]
int
{
apierrors
.
StatusTooManyRequests
,
500
,
501
,
504
}[
count
])
w
.
WriteHeader
([]
int
{
apierrors
.
StatusTooManyRequests
,
500
,
501
,
504
}[
count
])
count
++
count
++
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
_
,
err
:=
c
.
Verb
(
"POST"
)
.
_
,
err
:=
c
.
Verb
(
"POST"
)
.
...
@@ -869,8 +865,7 @@ func BenchmarkCheckRetryClosesBody(b *testing.B) {
...
@@ -869,8 +865,7 @@ func BenchmarkCheckRetryClosesBody(b *testing.B) {
w
.
Header
()
.
Set
(
"Retry-After"
,
"0"
)
w
.
Header
()
.
Set
(
"Retry-After"
,
"0"
)
w
.
WriteHeader
(
apierrors
.
StatusTooManyRequests
)
w
.
WriteHeader
(
apierrors
.
StatusTooManyRequests
)
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
b
,
testServer
)
c
:=
testRESTClient
(
b
,
testServer
)
r
:=
c
.
Verb
(
"POST"
)
.
r
:=
c
.
Verb
(
"POST"
)
.
...
@@ -901,8 +896,7 @@ func TestDoRequestNewWayReader(t *testing.T) {
...
@@ -901,8 +896,7 @@ func TestDoRequestNewWayReader(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
Resource
(
"bar"
)
.
Resource
(
"bar"
)
.
...
@@ -942,8 +936,7 @@ func TestDoRequestNewWayObj(t *testing.T) {
...
@@ -942,8 +936,7 @@ func TestDoRequestNewWayObj(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
Suffix
(
"baz"
)
.
Suffix
(
"baz"
)
.
...
@@ -998,8 +991,7 @@ func TestDoRequestNewWayFile(t *testing.T) {
...
@@ -998,8 +991,7 @@ func TestDoRequestNewWayFile(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
wasCreated
:=
true
wasCreated
:=
true
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
obj
,
err
:=
c
.
Verb
(
"POST"
)
.
...
@@ -1044,8 +1036,7 @@ func TestWasCreated(t *testing.T) {
...
@@ -1044,8 +1036,7 @@ func TestWasCreated(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
testRESTClient
(
t
,
testServer
)
c
:=
testRESTClient
(
t
,
testServer
)
wasCreated
:=
false
wasCreated
:=
false
obj
,
err
:=
c
.
Verb
(
"PUT"
)
.
obj
,
err
:=
c
.
Verb
(
"PUT"
)
.
...
@@ -1250,8 +1241,7 @@ func TestWatch(t *testing.T) {
...
@@ -1250,8 +1241,7 @@ func TestWatch(t *testing.T) {
flusher
.
Flush
()
flusher
.
Flush
()
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
s
:=
testRESTClient
(
t
,
testServer
)
s
:=
testRESTClient
(
t
,
testServer
)
watching
,
err
:=
s
.
Get
()
.
Prefix
(
"path/to/watch/thing"
)
.
Watch
()
watching
,
err
:=
s
.
Get
()
.
Prefix
(
"path/to/watch/thing"
)
.
Watch
()
...
@@ -1291,8 +1281,7 @@ func TestStream(t *testing.T) {
...
@@ -1291,8 +1281,7 @@ func TestStream(t *testing.T) {
w
.
Write
([]
byte
(
expectedBody
))
w
.
Write
([]
byte
(
expectedBody
))
flusher
.
Flush
()
flusher
.
Flush
()
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
s
:=
testRESTClient
(
t
,
testServer
)
s
:=
testRESTClient
(
t
,
testServer
)
readCloser
,
err
:=
s
.
Get
()
.
Prefix
(
"path/to/stream/thing"
)
.
Stream
()
readCloser
,
err
:=
s
.
Get
()
.
Prefix
(
"path/to/stream/thing"
)
.
Stream
()
...
...
pkg/client/typed/discovery/client_test.go
View file @
bf1a3f99
...
@@ -47,8 +47,7 @@ func TestGetServerVersion(t *testing.T) {
...
@@ -47,8 +47,7 @@ func TestGetServerVersion(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
(
output
)
w
.
Write
(
output
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
got
,
err
:=
client
.
ServerVersion
()
got
,
err
:=
client
.
ServerVersion
()
...
@@ -83,8 +82,7 @@ func TestGetServerGroupsWithV1Server(t *testing.T) {
...
@@ -83,8 +82,7 @@ func TestGetServerGroupsWithV1Server(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
(
output
)
w
.
Write
(
output
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
// ServerGroups should not return an error even if server returns error at /api and /apis
// ServerGroups should not return an error even if server returns error at /api and /apis
apiGroupList
,
err
:=
client
.
ServerGroups
()
apiGroupList
,
err
:=
client
.
ServerGroups
()
...
@@ -120,8 +118,7 @@ func TestGetServerResourcesWithV1Server(t *testing.T) {
...
@@ -120,8 +118,7 @@ func TestGetServerResourcesWithV1Server(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
(
output
)
w
.
Write
(
output
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
// ServerResources should not return an error even if server returns error at /api/v1.
// ServerResources should not return an error even if server returns error at /api/v1.
resourceMap
,
err
:=
client
.
ServerResources
()
resourceMap
,
err
:=
client
.
ServerResources
()
...
@@ -213,8 +210,7 @@ func TestGetServerResources(t *testing.T) {
...
@@ -213,8 +210,7 @@ func TestGetServerResources(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
(
output
)
w
.
Write
(
output
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
got
,
err
:=
client
.
ServerResourcesForGroupVersion
(
test
.
request
)
got
,
err
:=
client
.
ServerResourcesForGroupVersion
(
test
.
request
)
...
@@ -275,8 +271,7 @@ func TestGetSwaggerSchema(t *testing.T) {
...
@@ -275,8 +271,7 @@ func TestGetSwaggerSchema(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected encoding error: %v"
,
err
)
t
.
Errorf
(
"unexpected encoding error: %v"
,
err
)
}
}
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
got
,
err
:=
client
.
SwaggerSchema
(
v1
.
SchemeGroupVersion
)
got
,
err
:=
client
.
SwaggerSchema
(
v1
.
SchemeGroupVersion
)
...
@@ -295,8 +290,7 @@ func TestGetSwaggerSchemaFail(t *testing.T) {
...
@@ -295,8 +290,7 @@ func TestGetSwaggerSchemaFail(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected encoding error: %v"
,
err
)
t
.
Errorf
(
"unexpected encoding error: %v"
,
err
)
}
}
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
client
:=
NewDiscoveryClientForConfigOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
})
got
,
err
:=
client
.
SwaggerSchema
(
unversioned
.
GroupVersion
{
Group
:
"api.group"
,
Version
:
"v4"
})
got
,
err
:=
client
.
SwaggerSchema
(
unversioned
.
GroupVersion
{
Group
:
"api.group"
,
Version
:
"v4"
})
...
...
pkg/client/unversioned/containerinfo_test.go
View file @
bf1a3f99
...
@@ -70,8 +70,7 @@ func testHTTPContainerInfoGetter(
...
@@ -70,8 +70,7 @@ func testHTTPContainerInfoGetter(
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
ts
.
Close
()
// defer ts.Close()
hostURL
,
err
:=
url
.
Parse
(
ts
.
URL
)
hostURL
,
err
:=
url
.
Parse
(
ts
.
URL
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -172,8 +171,7 @@ func TestHTTPGetMachineInfo(t *testing.T) {
...
@@ -172,8 +171,7 @@ func TestHTTPGetMachineInfo(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
ts
.
Close
()
// defer ts.Close()
hostURL
,
err
:=
url
.
Parse
(
ts
.
URL
)
hostURL
,
err
:=
url
.
Parse
(
ts
.
URL
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
...
pkg/client/unversioned/helper_test.go
View file @
bf1a3f99
...
@@ -124,8 +124,7 @@ func TestHelperGetServerAPIVersions(t *testing.T) {
...
@@ -124,8 +124,7 @@ func TestHelperGetServerAPIVersions(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
(
output
)
w
.
Write
(
output
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
got
,
err
:=
restclient
.
ServerAPIVersions
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
&
unversioned
.
GroupVersion
{
Group
:
"invalid version"
,
Version
:
"one"
},
Codec
:
testapi
.
Default
.
Codec
()}})
got
,
err
:=
restclient
.
ServerAPIVersions
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
&
unversioned
.
GroupVersion
{
Group
:
"invalid version"
,
Version
:
"one"
},
Codec
:
testapi
.
Default
.
Codec
()}})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"unexpected encoding error: %v"
,
err
)
t
.
Fatalf
(
"unexpected encoding error: %v"
,
err
)
...
...
pkg/client/unversioned/portforward/portforward_test.go
View file @
bf1a3f99
...
@@ -320,8 +320,7 @@ func TestForwardPorts(t *testing.T) {
...
@@ -320,8 +320,7 @@ func TestForwardPorts(t *testing.T) {
clientConn
,
err
:=
net
.
Dial
(
"tcp"
,
fmt
.
Sprintf
(
"localhost:%d"
,
port
))
clientConn
,
err
:=
net
.
Dial
(
"tcp"
,
fmt
.
Sprintf
(
"localhost:%d"
,
port
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%s: error dialing %d: %s"
,
testName
,
port
,
err
)
t
.
Errorf
(
"%s: error dialing %d: %s"
,
testName
,
port
,
err
)
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
defer
clientConn
.
Close
()
defer
clientConn
.
Close
()
...
@@ -329,28 +328,24 @@ func TestForwardPorts(t *testing.T) {
...
@@ -329,28 +328,24 @@ func TestForwardPorts(t *testing.T) {
n
,
err
:=
clientConn
.
Write
([]
byte
(
data
))
n
,
err
:=
clientConn
.
Write
([]
byte
(
data
))
if
err
!=
nil
&&
err
!=
io
.
EOF
{
if
err
!=
nil
&&
err
!=
io
.
EOF
{
t
.
Errorf
(
"%s: Error sending data '%s': %s"
,
testName
,
data
,
err
)
t
.
Errorf
(
"%s: Error sending data '%s': %s"
,
testName
,
data
,
err
)
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
if
n
==
0
{
if
n
==
0
{
t
.
Errorf
(
"%s: unexpected write of 0 bytes"
,
testName
)
t
.
Errorf
(
"%s: unexpected write of 0 bytes"
,
testName
)
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
b
:=
make
([]
byte
,
4
)
b
:=
make
([]
byte
,
4
)
n
,
err
=
clientConn
.
Read
(
b
)
n
,
err
=
clientConn
.
Read
(
b
)
if
err
!=
nil
&&
err
!=
io
.
EOF
{
if
err
!=
nil
&&
err
!=
io
.
EOF
{
t
.
Errorf
(
"%s: Error reading data: %s"
,
testName
,
err
)
t
.
Errorf
(
"%s: Error reading data: %s"
,
testName
,
err
)
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
if
!
bytes
.
Equal
([]
byte
(
test
.
serverSends
[
port
]),
b
)
{
if
!
bytes
.
Equal
([]
byte
(
test
.
serverSends
[
port
]),
b
)
{
t
.
Errorf
(
"%s: expected to read '%s', got '%s'"
,
testName
,
test
.
serverSends
[
port
],
b
)
t
.
Errorf
(
"%s: expected to read '%s', got '%s'"
,
testName
,
test
.
serverSends
[
port
],
b
)
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
}
}
...
@@ -362,16 +357,14 @@ func TestForwardPorts(t *testing.T) {
...
@@ -362,16 +357,14 @@ func TestForwardPorts(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%s: unexpected error: %s"
,
testName
,
err
)
t
.
Errorf
(
"%s: unexpected error: %s"
,
testName
,
err
)
}
}
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
}
}
}
}
func
TestForwardPortsReturnsErrorWhenAllBindsFailed
(
t
*
testing
.
T
)
{
func
TestForwardPortsReturnsErrorWhenAllBindsFailed
(
t
*
testing
.
T
)
{
server
:=
httptest
.
NewServer
(
fakePortForwardServer
(
t
,
"allBindsFailed"
,
nil
,
nil
))
server
:=
httptest
.
NewServer
(
fakePortForwardServer
(
t
,
"allBindsFailed"
,
nil
,
nil
))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
url
,
_
:=
url
.
Parse
(
server
.
URL
)
url
,
_
:=
url
.
Parse
(
server
.
URL
)
exec
,
err
:=
remotecommand
.
NewExecutor
(
&
restclient
.
Config
{},
"POST"
,
url
)
exec
,
err
:=
remotecommand
.
NewExecutor
(
&
restclient
.
Config
{},
"POST"
,
url
)
...
...
pkg/client/unversioned/remotecommand/remotecommand_test.go
View file @
bf1a3f99
...
@@ -257,15 +257,13 @@ func TestStream(t *testing.T) {
...
@@ -257,15 +257,13 @@ func TestStream(t *testing.T) {
}
}
}
}
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
if
hasErr
{
if
hasErr
{
t
.
Errorf
(
"%s: unexpected error: %v"
,
name
,
err
)
t
.
Errorf
(
"%s: unexpected error: %v"
,
name
,
err
)
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
continue
continue
}
}
...
@@ -281,8 +279,7 @@ func TestStream(t *testing.T) {
...
@@ -281,8 +279,7 @@ func TestStream(t *testing.T) {
}
}
}
}
// TODO: Uncomment when fix #19254
server
.
Close
()
// server.Close()
}
}
}
}
}
}
...
...
pkg/client/unversioned/testclient/simple/simple_testclient.go
View file @
bf1a3f99
...
@@ -110,8 +110,7 @@ func (c *Client) Setup(t *testing.T) *Client {
...
@@ -110,8 +110,7 @@ func (c *Client) Setup(t *testing.T) *Client {
func
(
c
*
Client
)
Close
()
{
func
(
c
*
Client
)
Close
()
{
if
c
.
server
!=
nil
{
if
c
.
server
!=
nil
{
// TODO: Uncomment when fix #19254
c
.
server
.
Close
()
// c.server.Close()
}
}
}
}
...
...
pkg/cloudprovider/providers/mesos/client_test.go
View file @
bf1a3f99
...
@@ -214,10 +214,8 @@ func Test_parseMesosState(t *testing.T) {
...
@@ -214,10 +214,8 @@ func Test_parseMesosState(t *testing.T) {
func
Test_listSlaves
(
t
*
testing
.
T
)
{
func
Test_listSlaves
(
t
*
testing
.
T
)
{
defer
log
.
Flush
()
defer
log
.
Flush
()
md
:=
FakeMasterDetector
{}
md
:=
FakeMasterDetector
{}
// TODO: Uncomment next two lines and remove third line when fix #19254
httpServer
,
httpClient
,
httpTransport
:=
makeHttpMocks
()
// defer httpServer.Close()
defer
httpServer
.
Close
()
// httpServer, httpClient, httpTransport := makeHttpMocks()
_
,
httpClient
,
httpTransport
:=
makeHttpMocks
()
cacheTTL
:=
500
*
time
.
Millisecond
cacheTTL
:=
500
*
time
.
Millisecond
mesosClient
,
err
:=
createMesosClient
(
md
,
httpClient
,
httpTransport
,
cacheTTL
)
mesosClient
,
err
:=
createMesosClient
(
md
,
httpClient
,
httpTransport
,
cacheTTL
)
...
@@ -255,10 +253,8 @@ func Test_listSlaves(t *testing.T) {
...
@@ -255,10 +253,8 @@ func Test_listSlaves(t *testing.T) {
func
Test_clusterName
(
t
*
testing
.
T
)
{
func
Test_clusterName
(
t
*
testing
.
T
)
{
defer
log
.
Flush
()
defer
log
.
Flush
()
md
:=
FakeMasterDetector
{}
md
:=
FakeMasterDetector
{}
// TODO: Uncomment next two lines and remove third line when fix #19254
httpServer
,
httpClient
,
httpTransport
:=
makeHttpMocks
()
// defer httpServer.Close()
defer
httpServer
.
Close
()
// httpServer, httpClient, httpTransport := makeHttpMocks()
_
,
httpClient
,
httpTransport
:=
makeHttpMocks
()
cacheTTL
:=
500
*
time
.
Millisecond
cacheTTL
:=
500
*
time
.
Millisecond
mesosClient
,
err
:=
createMesosClient
(
md
,
httpClient
,
httpTransport
,
cacheTTL
)
mesosClient
,
err
:=
createMesosClient
(
md
,
httpClient
,
httpTransport
,
cacheTTL
)
...
...
pkg/controller/controller_utils_test.go
View file @
bf1a3f99
...
@@ -242,8 +242,7 @@ func TestCreatePods(t *testing.T) {
...
@@ -242,8 +242,7 @@ func TestCreatePods(t *testing.T) {
ResponseBody
:
string
(
body
),
ResponseBody
:
string
(
body
),
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
clientset
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
clientset
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
podControl
:=
RealPodControl
{
podControl
:=
RealPodControl
{
...
...
pkg/controller/endpoint/endpoints_controller_test.go
View file @
bf1a3f99
...
@@ -105,8 +105,7 @@ func TestSyncEndpointsItemsPreserveNoSelector(t *testing.T) {
...
@@ -105,8 +105,7 @@ func TestSyncEndpointsItemsPreserveNoSelector(t *testing.T) {
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
}},
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -139,8 +138,7 @@ func TestCheckLeftoverEndpoints(t *testing.T) {
...
@@ -139,8 +138,7 @@ func TestCheckLeftoverEndpoints(t *testing.T) {
}},
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -169,8 +167,7 @@ func TestSyncEndpointsProtocolTCP(t *testing.T) {
...
@@ -169,8 +167,7 @@ func TestSyncEndpointsProtocolTCP(t *testing.T) {
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
,
Protocol
:
"TCP"
}},
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
,
Protocol
:
"TCP"
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -213,8 +210,7 @@ func TestSyncEndpointsProtocolUDP(t *testing.T) {
...
@@ -213,8 +210,7 @@ func TestSyncEndpointsProtocolUDP(t *testing.T) {
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
,
Protocol
:
"UDP"
}},
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
,
Protocol
:
"UDP"
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -253,8 +249,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAll(t *testing.T) {
...
@@ -253,8 +249,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAll(t *testing.T) {
},
},
Subsets
:
[]
api
.
EndpointSubset
{},
Subsets
:
[]
api
.
EndpointSubset
{},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -292,8 +287,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAllNotReady(t *testing.T) {
...
@@ -292,8 +287,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAllNotReady(t *testing.T) {
},
},
Subsets
:
[]
api
.
EndpointSubset
{},
Subsets
:
[]
api
.
EndpointSubset
{},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -331,8 +325,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAllMixed(t *testing.T) {
...
@@ -331,8 +325,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAllMixed(t *testing.T) {
},
},
Subsets
:
[]
api
.
EndpointSubset
{},
Subsets
:
[]
api
.
EndpointSubset
{},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -374,8 +367,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
...
@@ -374,8 +367,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
}},
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -416,8 +408,7 @@ func TestSyncEndpointsItemsPreexistingIdentical(t *testing.T) {
...
@@ -416,8 +408,7 @@ func TestSyncEndpointsItemsPreexistingIdentical(t *testing.T) {
Ports
:
[]
api
.
EndpointPort
{{
Port
:
8080
,
Protocol
:
"TCP"
}},
Ports
:
[]
api
.
EndpointPort
{{
Port
:
8080
,
Protocol
:
"TCP"
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -437,8 +428,7 @@ func TestSyncEndpointsItems(t *testing.T) {
...
@@ -437,8 +428,7 @@ func TestSyncEndpointsItems(t *testing.T) {
ns
:=
"other"
ns
:=
"other"
testServer
,
endpointsHandler
:=
makeTestServer
(
t
,
ns
,
testServer
,
endpointsHandler
:=
makeTestServer
(
t
,
ns
,
serverResponse
{
http
.
StatusOK
,
&
api
.
Endpoints
{}})
serverResponse
{
http
.
StatusOK
,
&
api
.
Endpoints
{}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -481,8 +471,7 @@ func TestSyncEndpointsItemsWithLabels(t *testing.T) {
...
@@ -481,8 +471,7 @@ func TestSyncEndpointsItemsWithLabels(t *testing.T) {
ns
:=
"other"
ns
:=
"other"
testServer
,
endpointsHandler
:=
makeTestServer
(
t
,
ns
,
testServer
,
endpointsHandler
:=
makeTestServer
(
t
,
ns
,
serverResponse
{
http
.
StatusOK
,
&
api
.
Endpoints
{}})
serverResponse
{
http
.
StatusOK
,
&
api
.
Endpoints
{}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
@@ -543,8 +532,7 @@ func TestSyncEndpointsItemsPreexistingLabelsChange(t *testing.T) {
...
@@ -543,8 +532,7 @@ func TestSyncEndpointsItemsPreexistingLabelsChange(t *testing.T) {
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
}},
Ports
:
[]
api
.
EndpointPort
{{
Port
:
1000
}},
}},
}},
}})
}})
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
:=
NewEndpointControllerFromClient
(
client
,
controller
.
NoResyncPeriodFunc
)
endpoints
.
podStoreSynced
=
alwaysReady
endpoints
.
podStoreSynced
=
alwaysReady
...
...
pkg/controller/replication/replication_controller_test.go
View file @
bf1a3f99
...
@@ -222,8 +222,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
...
@@ -222,8 +222,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
ResponseBody
:
""
,
ResponseBody
:
""
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
manager
.
podStoreSynced
=
alwaysReady
manager
.
podStoreSynced
=
alwaysReady
...
@@ -264,8 +263,7 @@ func TestControllerUpdateReplicas(t *testing.T) {
...
@@ -264,8 +263,7 @@ func TestControllerUpdateReplicas(t *testing.T) {
ResponseBody
:
""
,
ResponseBody
:
""
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
manager
.
podStoreSynced
=
alwaysReady
manager
.
podStoreSynced
=
alwaysReady
...
@@ -309,8 +307,7 @@ func TestSyncReplicationControllerDormancy(t *testing.T) {
...
@@ -309,8 +307,7 @@ func TestSyncReplicationControllerDormancy(t *testing.T) {
ResponseBody
:
"{}"
,
ResponseBody
:
"{}"
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
fakePodControl
:=
controller
.
FakePodControl
{}
fakePodControl
:=
controller
.
FakePodControl
{}
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
...
@@ -564,8 +561,7 @@ func TestControllerUpdateRequeue(t *testing.T) {
...
@@ -564,8 +561,7 @@ func TestControllerUpdateRequeue(t *testing.T) {
ResponseBody
:
""
,
ResponseBody
:
""
,
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
c
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
manager
:=
NewReplicationManagerFromClient
(
c
,
controller
.
NoResyncPeriodFunc
,
BurstReplicas
,
0
)
...
...
pkg/credentialprovider/gcp/jwt_test.go
View file @
bf1a3f99
...
@@ -77,8 +77,7 @@ func TestJwtProvider(t *testing.T) {
...
@@ -77,8 +77,7 @@ func TestJwtProvider(t *testing.T) {
"expires_in": 3600
"expires_in": 3600
}`
,
token
)))
}`
,
token
)))
}))
}))
// TODO: Uncomment when fix #19254
defer
ts
.
Close
()
// defer ts.Close()
file
,
err
:=
ioutil
.
TempFile
(
os
.
TempDir
(),
"temp"
)
file
,
err
:=
ioutil
.
TempFile
(
os
.
TempDir
(),
"temp"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/credentialprovider/gcp/metadata_test.go
View file @
bf1a3f99
...
@@ -57,8 +57,7 @@ func TestDockerKeyringFromGoogleDockerConfigMetadata(t *testing.T) {
...
@@ -57,8 +57,7 @@ func TestDockerKeyringFromGoogleDockerConfigMetadata(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusNotFound
)
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Make a transport that reroutes all traffic to the example server
// Make a transport that reroutes all traffic to the example server
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
...
@@ -130,8 +129,7 @@ func TestDockerKeyringFromGoogleDockerConfigMetadataUrl(t *testing.T) {
...
@@ -130,8 +129,7 @@ func TestDockerKeyringFromGoogleDockerConfigMetadataUrl(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusNotFound
)
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Make a transport that reroutes all traffic to the example server
// Make a transport that reroutes all traffic to the example server
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
...
@@ -204,8 +202,7 @@ func TestContainerRegistryBasics(t *testing.T) {
...
@@ -204,8 +202,7 @@ func TestContainerRegistryBasics(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusNotFound
)
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Make a transport that reroutes all traffic to the example server
// Make a transport that reroutes all traffic to the example server
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
...
@@ -261,8 +258,7 @@ func TestContainerRegistryNoStorageScope(t *testing.T) {
...
@@ -261,8 +258,7 @@ func TestContainerRegistryNoStorageScope(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusNotFound
)
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Make a transport that reroutes all traffic to the example server
// Make a transport that reroutes all traffic to the example server
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
...
@@ -295,8 +291,7 @@ func TestComputePlatformScopeSubstitutesStorageScope(t *testing.T) {
...
@@ -295,8 +291,7 @@ func TestComputePlatformScopeSubstitutesStorageScope(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusNotFound
)
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
}
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Make a transport that reroutes all traffic to the example server
// Make a transport that reroutes all traffic to the example server
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
...
@@ -318,8 +313,7 @@ func TestAllProvidersNoMetadata(t *testing.T) {
...
@@ -318,8 +313,7 @@ func TestAllProvidersNoMetadata(t *testing.T) {
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
WriteHeader
(
http
.
StatusNotFound
)
w
.
WriteHeader
(
http
.
StatusNotFound
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Make a transport that reroutes all traffic to the example server
// Make a transport that reroutes all traffic to the example server
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
transport
:=
utilnet
.
SetTransportDefaults
(
&
http
.
Transport
{
...
...
pkg/kubectl/proxy_server_test.go
View file @
bf1a3f99
...
@@ -205,8 +205,7 @@ func TestFileServing(t *testing.T) {
...
@@ -205,8 +205,7 @@ func TestFileServing(t *testing.T) {
const
prefix
=
"/foo/"
const
prefix
=
"/foo/"
handler
:=
newFileHandler
(
prefix
,
dir
)
handler
:=
newFileHandler
(
prefix
,
dir
)
server
:=
httptest
.
NewServer
(
handler
)
server
:=
httptest
.
NewServer
(
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
url
:=
server
.
URL
+
prefix
+
fname
url
:=
server
.
URL
+
prefix
+
fname
res
,
err
:=
http
.
Get
(
url
)
res
,
err
:=
http
.
Get
(
url
)
...
@@ -236,8 +235,7 @@ func TestAPIRequests(t *testing.T) {
...
@@ -236,8 +235,7 @@ func TestAPIRequests(t *testing.T) {
}
}
fmt
.
Fprintf
(
w
,
"%s %s %s"
,
r
.
Method
,
r
.
RequestURI
,
string
(
b
))
fmt
.
Fprintf
(
w
,
"%s %s %s"
,
r
.
Method
,
r
.
RequestURI
,
string
(
b
))
}))
}))
// TODO: Uncomment when fix #19254
defer
ts
.
Close
()
// defer ts.Close()
// httptest.NewServer should always generate a valid URL.
// httptest.NewServer should always generate a valid URL.
target
,
_
:=
url
.
Parse
(
ts
.
URL
)
target
,
_
:=
url
.
Parse
(
ts
.
URL
)
...
@@ -273,8 +271,7 @@ func TestPathHandling(t *testing.T) {
...
@@ -273,8 +271,7 @@ func TestPathHandling(t *testing.T) {
ts
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
ts
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprint
(
w
,
r
.
URL
.
Path
)
fmt
.
Fprint
(
w
,
r
.
URL
.
Path
)
}))
}))
// TODO: Uncomment when fix #19254
defer
ts
.
Close
()
// defer ts.Close()
table
:=
[]
struct
{
table
:=
[]
struct
{
prefix
string
prefix
string
...
@@ -304,8 +301,7 @@ func TestPathHandling(t *testing.T) {
...
@@ -304,8 +301,7 @@ func TestPathHandling(t *testing.T) {
t
.
Fatalf
(
"%#v: %v"
,
item
,
err
)
t
.
Fatalf
(
"%#v: %v"
,
item
,
err
)
}
}
pts
:=
httptest
.
NewServer
(
p
.
handler
)
pts
:=
httptest
.
NewServer
(
p
.
handler
)
// TODO: Uncomment when fix #19254
defer
pts
.
Close
()
// defer pts.Close()
r
,
err
:=
http
.
Get
(
pts
.
URL
+
item
.
reqPath
)
r
,
err
:=
http
.
Get
(
pts
.
URL
+
item
.
reqPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/kubectl/resource/builder_test.go
View file @
bf1a3f99
...
@@ -452,8 +452,7 @@ func TestNamespaceOverride(t *testing.T) {
...
@@ -452,8 +452,7 @@ func TestNamespaceOverride(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test"
}})))
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test"
}})))
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
b
:=
NewBuilder
(
testapi
.
Default
.
RESTMapper
(),
api
.
Scheme
,
fakeClient
(),
testapi
.
Default
.
Codec
())
.
b
:=
NewBuilder
(
testapi
.
Default
.
RESTMapper
(),
api
.
Scheme
,
fakeClient
(),
testapi
.
Default
.
Codec
())
.
FilenameParam
(
false
,
false
,
s
.
URL
)
.
FilenameParam
(
false
,
false
,
s
.
URL
)
.
...
@@ -484,8 +483,7 @@ func TestURLBuilder(t *testing.T) {
...
@@ -484,8 +483,7 @@ func TestURLBuilder(t *testing.T) {
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test"
}})))
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test"
}})))
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test1"
}})))
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test1"
}})))
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
b
:=
NewBuilder
(
testapi
.
Default
.
RESTMapper
(),
api
.
Scheme
,
fakeClient
(),
testapi
.
Default
.
Codec
())
.
b
:=
NewBuilder
(
testapi
.
Default
.
RESTMapper
(),
api
.
Scheme
,
fakeClient
(),
testapi
.
Default
.
Codec
())
.
FilenameParam
(
false
,
false
,
s
.
URL
)
.
FilenameParam
(
false
,
false
,
s
.
URL
)
.
...
@@ -514,8 +512,7 @@ func TestURLBuilderRequireNamespace(t *testing.T) {
...
@@ -514,8 +512,7 @@ func TestURLBuilderRequireNamespace(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test"
}})))
w
.
Write
([]
byte
(
runtime
.
EncodeOrDie
(
testapi
.
Default
.
Codec
(),
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"foo"
,
Name
:
"test"
}})))
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
b
:=
NewBuilder
(
testapi
.
Default
.
RESTMapper
(),
api
.
Scheme
,
fakeClient
(),
testapi
.
Default
.
Codec
())
.
b
:=
NewBuilder
(
testapi
.
Default
.
RESTMapper
(),
api
.
Scheme
,
fakeClient
(),
testapi
.
Default
.
Codec
())
.
FilenameParam
(
false
,
false
,
s
.
URL
)
.
FilenameParam
(
false
,
false
,
s
.
URL
)
.
...
...
pkg/kubelet/client/kubelet_client_test.go
View file @
bf1a3f99
...
@@ -39,8 +39,7 @@ func TestHTTPKubeletClient(t *testing.T) {
...
@@ -39,8 +39,7 @@ func TestHTTPKubeletClient(t *testing.T) {
ResponseBody
:
string
(
body
),
ResponseBody
:
string
(
body
),
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
if
_
,
err
:=
url
.
Parse
(
testServer
.
URL
);
err
!=
nil
{
if
_
,
err
:=
url
.
Parse
(
testServer
.
URL
);
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v"
,
err
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
...
...
pkg/kubelet/config/http_test.go
View file @
bf1a3f99
...
@@ -111,8 +111,7 @@ func TestExtractInvalidPods(t *testing.T) {
...
@@ -111,8 +111,7 @@ func TestExtractInvalidPods(t *testing.T) {
ResponseBody
:
string
(
data
),
ResponseBody
:
string
(
data
),
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
ch
:=
make
(
chan
interface
{},
1
)
ch
:=
make
(
chan
interface
{},
1
)
c
:=
sourceURL
{
testServer
.
URL
,
http
.
Header
{},
"localhost"
,
ch
,
nil
,
0
,
http
.
DefaultClient
}
c
:=
sourceURL
{
testServer
.
URL
,
http
.
Header
{},
"localhost"
,
ch
,
nil
,
0
,
http
.
DefaultClient
}
if
err
:=
c
.
extractFromURL
();
err
==
nil
{
if
err
:=
c
.
extractFromURL
();
err
==
nil
{
...
@@ -290,8 +289,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
...
@@ -290,8 +289,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
ResponseBody
:
string
(
data
),
ResponseBody
:
string
(
data
),
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
ch
:=
make
(
chan
interface
{},
1
)
ch
:=
make
(
chan
interface
{},
1
)
c
:=
sourceURL
{
testServer
.
URL
,
http
.
Header
{},
hostname
,
ch
,
nil
,
0
,
http
.
DefaultClient
}
c
:=
sourceURL
{
testServer
.
URL
,
http
.
Header
{},
hostname
,
ch
,
nil
,
0
,
http
.
DefaultClient
}
if
err
:=
c
.
extractFromURL
();
err
!=
nil
{
if
err
:=
c
.
extractFromURL
();
err
!=
nil
{
...
@@ -336,8 +334,7 @@ func TestURLWithHeader(t *testing.T) {
...
@@ -336,8 +334,7 @@ func TestURLWithHeader(t *testing.T) {
ResponseBody
:
string
(
data
),
ResponseBody
:
string
(
data
),
}
}
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
testServer
:=
httptest
.
NewServer
(
&
fakeHandler
)
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
ch
:=
make
(
chan
interface
{},
1
)
ch
:=
make
(
chan
interface
{},
1
)
header
:=
make
(
http
.
Header
)
header
:=
make
(
http
.
Header
)
header
.
Set
(
"Metadata-Flavor"
,
"Google"
)
header
.
Set
(
"Metadata-Flavor"
,
"Google"
)
...
...
pkg/master/master_test.go
View file @
bf1a3f99
...
@@ -587,8 +587,7 @@ func testInstallThirdPartyAPIListVersion(t *testing.T, version string) {
...
@@ -587,8 +587,7 @@ func testInstallThirdPartyAPIListVersion(t *testing.T, version string) {
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
func
()
{
func
()
{
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
if
test
.
items
!=
nil
{
if
test
.
items
!=
nil
{
...
@@ -698,8 +697,7 @@ func TestInstallThirdPartyAPIGet(t *testing.T) {
...
@@ -698,8 +697,7 @@ func TestInstallThirdPartyAPIGet(t *testing.T) {
func
testInstallThirdPartyAPIGetVersion
(
t
*
testing
.
T
,
version
string
)
{
func
testInstallThirdPartyAPIGetVersion
(
t
*
testing
.
T
,
version
string
)
{
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
expectedObj
:=
Foo
{
expectedObj
:=
Foo
{
...
@@ -746,8 +744,7 @@ func TestInstallThirdPartyAPIPost(t *testing.T) {
...
@@ -746,8 +744,7 @@ func TestInstallThirdPartyAPIPost(t *testing.T) {
func
testInstallThirdPartyAPIPostForVersion
(
t
*
testing
.
T
,
version
string
)
{
func
testInstallThirdPartyAPIPostForVersion
(
t
*
testing
.
T
,
version
string
)
{
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
inputObj
:=
Foo
{
inputObj
:=
Foo
{
...
@@ -811,8 +808,7 @@ func TestInstallThirdPartyAPIDelete(t *testing.T) {
...
@@ -811,8 +808,7 @@ func TestInstallThirdPartyAPIDelete(t *testing.T) {
func
testInstallThirdPartyAPIDeleteVersion
(
t
*
testing
.
T
,
version
string
)
{
func
testInstallThirdPartyAPIDeleteVersion
(
t
*
testing
.
T
,
version
string
)
{
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
expectedObj
:=
Foo
{
expectedObj
:=
Foo
{
...
@@ -889,8 +885,7 @@ func TestInstallThirdPartyAPIListOptions(t *testing.T) {
...
@@ -889,8 +885,7 @@ func TestInstallThirdPartyAPIListOptions(t *testing.T) {
func
testInstallThirdPartyAPIListOptionsForVersion
(
t
*
testing
.
T
,
version
string
)
{
func
testInstallThirdPartyAPIListOptionsForVersion
(
t
*
testing
.
T
,
version
string
)
{
_
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
_
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
// send a GET request with query parameter
// send a GET request with query parameter
...
@@ -922,8 +917,7 @@ func TestInstallThirdPartyResourceRemove(t *testing.T) {
...
@@ -922,8 +917,7 @@ func TestInstallThirdPartyResourceRemove(t *testing.T) {
func
testInstallThirdPartyResourceRemove
(
t
*
testing
.
T
,
version
string
)
{
func
testInstallThirdPartyResourceRemove
(
t
*
testing
.
T
,
version
string
)
{
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
master
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
expectedObj
:=
Foo
{
expectedObj
:=
Foo
{
...
@@ -1012,8 +1006,7 @@ func TestThirdPartyDiscovery(t *testing.T) {
...
@@ -1012,8 +1006,7 @@ func TestThirdPartyDiscovery(t *testing.T) {
func
testThirdPartyDiscovery
(
t
*
testing
.
T
,
version
string
)
{
func
testThirdPartyDiscovery
(
t
*
testing
.
T
,
version
string
)
{
_
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
_
,
etcdserver
,
server
,
assert
:=
initThirdParty
(
t
,
version
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
defer
etcdserver
.
Terminate
(
t
)
defer
etcdserver
.
Terminate
(
t
)
resp
,
err
:=
http
.
Get
(
server
.
URL
+
"/apis/company.com/"
)
resp
,
err
:=
http
.
Get
(
server
.
URL
+
"/apis/company.com/"
)
...
...
pkg/probe/tcp/tcp_test.go
View file @
bf1a3f99
...
@@ -42,8 +42,7 @@ func TestTcpHealthChecker(t *testing.T) {
...
@@ -42,8 +42,7 @@ func TestTcpHealthChecker(t *testing.T) {
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
server
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
tHost
,
tPortStr
,
err
:=
net
.
SplitHostPort
(
server
.
Listener
.
Addr
()
.
String
())
tHost
,
tPortStr
,
err
:=
net
.
SplitHostPort
(
server
.
Listener
.
Addr
()
.
String
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v"
,
err
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
...
...
pkg/registry/generic/rest/proxy_test.go
View file @
bf1a3f99
...
@@ -208,8 +208,7 @@ func TestServeHTTP(t *testing.T) {
...
@@ -208,8 +208,7 @@ func TestServeHTTP(t *testing.T) {
responseHeader
:
backendResponseHeader
,
responseHeader
:
backendResponseHeader
,
}
}
backendServer
:=
httptest
.
NewServer
(
backendHandler
)
backendServer
:=
httptest
.
NewServer
(
backendHandler
)
// TODO: Uncomment when fix #19254
defer
backendServer
.
Close
()
// defer backendServer.Close()
responder
:=
&
fakeResponder
{}
responder
:=
&
fakeResponder
{}
backendURL
,
_
:=
url
.
Parse
(
backendServer
.
URL
)
backendURL
,
_
:=
url
.
Parse
(
backendServer
.
URL
)
...
@@ -220,8 +219,7 @@ func TestServeHTTP(t *testing.T) {
...
@@ -220,8 +219,7 @@ func TestServeHTTP(t *testing.T) {
UpgradeRequired
:
test
.
upgradeRequired
,
UpgradeRequired
:
test
.
upgradeRequired
,
}
}
proxyServer
:=
httptest
.
NewServer
(
proxyHandler
)
proxyServer
:=
httptest
.
NewServer
(
proxyHandler
)
// TODO: Uncomment when fix #19254
defer
proxyServer
.
Close
()
// defer proxyServer.Close()
proxyURL
,
_
:=
url
.
Parse
(
proxyServer
.
URL
)
proxyURL
,
_
:=
url
.
Parse
(
proxyServer
.
URL
)
proxyURL
.
Path
=
test
.
requestPath
proxyURL
.
Path
=
test
.
requestPath
paramValues
:=
url
.
Values
{}
paramValues
:=
url
.
Values
{}
...
@@ -377,8 +375,7 @@ func TestProxyUpgrade(t *testing.T) {
...
@@ -377,8 +375,7 @@ func TestProxyUpgrade(t *testing.T) {
ws
.
Read
(
body
)
ws
.
Read
(
body
)
ws
.
Write
([]
byte
(
"hello "
+
string
(
body
)))
ws
.
Write
([]
byte
(
"hello "
+
string
(
body
)))
}))
}))
// TODO: Uncomment when fix #19254
defer
backendServer
.
Close
()
// defer backendServer.Close()
serverURL
,
_
:=
url
.
Parse
(
backendServer
.
URL
)
serverURL
,
_
:=
url
.
Parse
(
backendServer
.
URL
)
proxyHandler
:=
&
UpgradeAwareProxyHandler
{
proxyHandler
:=
&
UpgradeAwareProxyHandler
{
...
@@ -386,8 +383,7 @@ func TestProxyUpgrade(t *testing.T) {
...
@@ -386,8 +383,7 @@ func TestProxyUpgrade(t *testing.T) {
Transport
:
tc
.
ProxyTransport
,
Transport
:
tc
.
ProxyTransport
,
}
}
proxy
:=
httptest
.
NewServer
(
proxyHandler
)
proxy
:=
httptest
.
NewServer
(
proxyHandler
)
// TODO: Uncomment when fix #19254
defer
proxy
.
Close
()
// defer proxy.Close()
ws
,
err
:=
websocket
.
Dial
(
"ws://"
+
proxy
.
Listener
.
Addr
()
.
String
()
+
"/some/path"
,
""
,
"http://127.0.0.1/"
)
ws
,
err
:=
websocket
.
Dial
(
"ws://"
+
proxy
.
Listener
.
Addr
()
.
String
()
+
"/some/path"
,
""
,
"http://127.0.0.1/"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -621,8 +617,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
...
@@ -621,8 +617,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
// Write successful response
// Write successful response
w
.
Write
([]
byte
(
successfulResponse
))
w
.
Write
([]
byte
(
successfulResponse
))
}))
}))
// TODO: Uncomment when fix #19254
defer
downstreamServer
.
Close
()
// defer downstreamServer.Close()
responder
:=
&
fakeResponder
{}
responder
:=
&
fakeResponder
{}
backendURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
backendURL
,
_
:=
url
.
Parse
(
downstreamServer
.
URL
)
...
@@ -632,8 +627,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
...
@@ -632,8 +627,7 @@ func TestProxyRequestContentLengthAndTransferEncoding(t *testing.T) {
UpgradeRequired
:
false
,
UpgradeRequired
:
false
,
}
}
proxyServer
:=
httptest
.
NewServer
(
proxyHandler
)
proxyServer
:=
httptest
.
NewServer
(
proxyHandler
)
// TODO: Uncomment when fix #19254
defer
proxyServer
.
Close
()
// defer proxyServer.Close()
// Dial the proxy server
// Dial the proxy server
conn
,
err
:=
net
.
Dial
(
proxyServer
.
Listener
.
Addr
()
.
Network
(),
proxyServer
.
Listener
.
Addr
()
.
String
())
conn
,
err
:=
net
.
Dial
(
proxyServer
.
Listener
.
Addr
()
.
Network
(),
proxyServer
.
Listener
.
Addr
()
.
String
())
...
...
pkg/registry/generic/rest/streamer_test.go
View file @
bf1a3f99
...
@@ -36,8 +36,7 @@ func TestInputStreamReader(t *testing.T) {
...
@@ -36,8 +36,7 @@ func TestInputStreamReader(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
w
.
Write
([]
byte
(
resultString
))
w
.
Write
([]
byte
(
resultString
))
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
u
,
err
:=
url
.
Parse
(
s
.
URL
)
u
,
err
:=
url
.
Parse
(
s
.
URL
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error parsing server URL: %v"
,
err
)
t
.
Errorf
(
"Error parsing server URL: %v"
,
err
)
...
...
pkg/storage/etcd/testing/utils.go
View file @
bf1a3f99
...
@@ -212,8 +212,7 @@ func (m *EtcdTestServer) Terminate(t *testing.T) {
...
@@ -212,8 +212,7 @@ func (m *EtcdTestServer) Terminate(t *testing.T) {
time
.
Sleep
(
250
*
time
.
Millisecond
)
time
.
Sleep
(
250
*
time
.
Millisecond
)
for
_
,
hs
:=
range
m
.
hss
{
for
_
,
hs
:=
range
m
.
hss
{
hs
.
CloseClientConnections
()
hs
.
CloseClientConnections
()
// TODO: Uncomment when fix #19254
hs
.
Close
()
// hs.Close()
}
}
if
err
:=
os
.
RemoveAll
(
m
.
ServerConfig
.
DataDir
);
err
!=
nil
{
if
err
:=
os
.
RemoveAll
(
m
.
ServerConfig
.
DataDir
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
...
pkg/storage/etcd/util/etcd_util_test.go
View file @
bf1a3f99
...
@@ -47,8 +47,7 @@ func TestGetEtcdVersion_ValidVersion(t *testing.T) {
...
@@ -47,8 +47,7 @@ func TestGetEtcdVersion_ValidVersion(t *testing.T) {
testServer
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testServer
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprint
(
w
,
validEtcdVersion
)
fmt
.
Fprint
(
w
,
validEtcdVersion
)
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
var
version
string
var
version
string
var
err
error
var
err
error
...
@@ -63,8 +62,7 @@ func TestGetEtcdVersion_ErrorStatus(t *testing.T) {
...
@@ -63,8 +62,7 @@ func TestGetEtcdVersion_ErrorStatus(t *testing.T) {
testServer
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testServer
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
WriteHeader
(
http
.
StatusServiceUnavailable
)
w
.
WriteHeader
(
http
.
StatusServiceUnavailable
)
}))
}))
// TODO: Uncomment when fix #19254
defer
testServer
.
Close
()
// defer testServer.Close()
_
,
err
:=
GetEtcdVersion
(
testServer
.
URL
)
_
,
err
:=
GetEtcdVersion
(
testServer
.
URL
)
assert
.
NotNil
(
t
,
err
)
assert
.
NotNil
(
t
,
err
)
...
...
pkg/util/configz/configz_test.go
View file @
bf1a3f99
...
@@ -32,8 +32,7 @@ func TestConfigz(t *testing.T) {
...
@@ -32,8 +32,7 @@ func TestConfigz(t *testing.T) {
v
.
Set
(
"blah"
)
v
.
Set
(
"blah"
)
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
handle
))
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
handle
))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
resp
,
err
:=
http
.
Get
(
s
.
URL
+
"/configz"
)
resp
,
err
:=
http
.
Get
(
s
.
URL
+
"/configz"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/util/httpstream/spdy/roundtripper_test.go
View file @
bf1a3f99
...
@@ -264,8 +264,7 @@ func TestRoundTripAndNewConnection(t *testing.T) {
...
@@ -264,8 +264,7 @@ func TestRoundTripAndNewConnection(t *testing.T) {
stream
:=
<-
streamCh
stream
:=
<-
streamCh
io
.
Copy
(
stream
,
stream
)
io
.
Copy
(
stream
,
stream
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
serverURL
,
err
:=
url
.
Parse
(
server
.
URL
)
serverURL
,
err
:=
url
.
Parse
(
server
.
URL
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -305,8 +304,7 @@ func TestRoundTripAndNewConnection(t *testing.T) {
...
@@ -305,8 +304,7 @@ func TestRoundTripAndNewConnection(t *testing.T) {
proxyURL
.
User
=
testCase
.
proxyAuth
proxyURL
.
User
=
testCase
.
proxyAuth
return
proxyURL
,
nil
return
proxyURL
,
nil
}
}
// TODO: Uncomment when fix #19254
defer
proxy
.
Close
()
// defer proxy.Close()
}
}
client
:=
&
http
.
Client
{
Transport
:
spdyTransport
}
client
:=
&
http
.
Client
{
Transport
:
spdyTransport
}
...
...
pkg/util/httpstream/spdy/upgrade_test.go
View file @
bf1a3f99
...
@@ -66,8 +66,7 @@ func TestUpgradeResponse(t *testing.T) {
...
@@ -66,8 +66,7 @@ func TestUpgradeResponse(t *testing.T) {
}
}
defer
conn
.
Close
()
defer
conn
.
Close
()
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
req
,
err
:=
http
.
NewRequest
(
"GET"
,
server
.
URL
,
nil
)
req
,
err
:=
http
.
NewRequest
(
"GET"
,
server
.
URL
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/util/proxy/transport_test.go
View file @
bf1a3f99
...
@@ -219,8 +219,7 @@ func TestProxyTransport(t *testing.T) {
...
@@ -219,8 +219,7 @@ func TestProxyTransport(t *testing.T) {
w
.
Header
()
.
Set
(
"Content-Type"
,
item
.
contentType
)
w
.
Header
()
.
Set
(
"Content-Type"
,
item
.
contentType
)
fmt
.
Fprint
(
w
,
item
.
input
)
fmt
.
Fprint
(
w
,
item
.
input
)
}))
}))
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
// Replace source URL with our test server address.
// Replace source URL with our test server address.
sourceURL
:=
parseURLOrDie
(
item
.
sourceURL
)
sourceURL
:=
parseURLOrDie
(
item
.
sourceURL
)
...
...
pkg/util/testing/fake_handler_test.go
View file @
bf1a3f99
...
@@ -26,8 +26,7 @@ import (
...
@@ -26,8 +26,7 @@ import (
func
TestFakeHandlerPath
(
t
*
testing
.
T
)
{
func
TestFakeHandlerPath
(
t
*
testing
.
T
)
{
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
method
:=
"GET"
method
:=
"GET"
path
:=
"/foo/bar"
path
:=
"/foo/bar"
body
:=
"somebody"
body
:=
"somebody"
...
@@ -49,8 +48,7 @@ func TestFakeHandlerPath(t *testing.T) {
...
@@ -49,8 +48,7 @@ func TestFakeHandlerPath(t *testing.T) {
func
TestFakeHandlerPathNoBody
(
t
*
testing
.
T
)
{
func
TestFakeHandlerPathNoBody
(
t
*
testing
.
T
)
{
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
method
:=
"GET"
method
:=
"GET"
path
:=
"/foo/bar"
path
:=
"/foo/bar"
...
@@ -81,8 +79,7 @@ func (f *fakeError) Logf(format string, args ...interface{}) {}
...
@@ -81,8 +79,7 @@ func (f *fakeError) Logf(format string, args ...interface{}) {}
func
TestFakeHandlerWrongPath
(
t
*
testing
.
T
)
{
func
TestFakeHandlerWrongPath
(
t
*
testing
.
T
)
{
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
method
:=
"GET"
method
:=
"GET"
path
:=
"/foo/bar"
path
:=
"/foo/bar"
fakeT
:=
fakeError
{}
fakeT
:=
fakeError
{}
...
@@ -107,8 +104,7 @@ func TestFakeHandlerWrongPath(t *testing.T) {
...
@@ -107,8 +104,7 @@ func TestFakeHandlerWrongPath(t *testing.T) {
func
TestFakeHandlerWrongMethod
(
t
*
testing
.
T
)
{
func
TestFakeHandlerWrongMethod
(
t
*
testing
.
T
)
{
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
method
:=
"GET"
method
:=
"GET"
path
:=
"/foo/bar"
path
:=
"/foo/bar"
fakeT
:=
fakeError
{}
fakeT
:=
fakeError
{}
...
@@ -133,8 +129,7 @@ func TestFakeHandlerWrongMethod(t *testing.T) {
...
@@ -133,8 +129,7 @@ func TestFakeHandlerWrongMethod(t *testing.T) {
func
TestFakeHandlerWrongBody
(
t
*
testing
.
T
)
{
func
TestFakeHandlerWrongBody
(
t
*
testing
.
T
)
{
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
method
:=
"GET"
method
:=
"GET"
path
:=
"/foo/bar"
path
:=
"/foo/bar"
body
:=
"somebody"
body
:=
"somebody"
...
@@ -161,8 +156,7 @@ func TestFakeHandlerWrongBody(t *testing.T) {
...
@@ -161,8 +156,7 @@ func TestFakeHandlerWrongBody(t *testing.T) {
func
TestFakeHandlerNilBody
(
t
*
testing
.
T
)
{
func
TestFakeHandlerNilBody
(
t
*
testing
.
T
)
{
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
handler
:=
FakeHandler
{
StatusCode
:
http
.
StatusOK
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
method
:=
"GET"
method
:=
"GET"
path
:=
"/foo/bar"
path
:=
"/foo/bar"
body
:=
"somebody"
body
:=
"somebody"
...
...
pkg/util/wsstream/conn_test.go
View file @
bf1a3f99
...
@@ -36,10 +36,8 @@ func newServer(handler websocket.Handler) (*httptest.Server, string) {
...
@@ -36,10 +36,8 @@ func newServer(handler websocket.Handler) (*httptest.Server, string) {
func
TestRawConn
(
t
*
testing
.
T
)
{
func
TestRawConn
(
t
*
testing
.
T
)
{
conn
:=
NewConn
(
ReadWriteChannel
,
ReadWriteChannel
,
IgnoreChannel
,
ReadChannel
,
WriteChannel
)
conn
:=
NewConn
(
ReadWriteChannel
,
ReadWriteChannel
,
IgnoreChannel
,
ReadChannel
,
WriteChannel
)
// TODO: Uncomment next two lines and remove third line when fix #19254
s
,
addr
:=
newServer
(
conn
.
handle
)
// s, addr := newServer(conn.handle)
defer
s
.
Close
()
// defer s.Close()
_
,
addr
:=
newServer
(
conn
.
handle
)
client
,
err
:=
websocket
.
Dial
(
"ws://"
+
addr
,
""
,
"http://localhost/"
)
client
,
err
:=
websocket
.
Dial
(
"ws://"
+
addr
,
""
,
"http://localhost/"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -115,10 +113,8 @@ func TestRawConn(t *testing.T) {
...
@@ -115,10 +113,8 @@ func TestRawConn(t *testing.T) {
func
TestBase64Conn
(
t
*
testing
.
T
)
{
func
TestBase64Conn
(
t
*
testing
.
T
)
{
conn
:=
NewConn
(
ReadWriteChannel
,
ReadWriteChannel
)
conn
:=
NewConn
(
ReadWriteChannel
,
ReadWriteChannel
)
// TODO: Uncomment next two lines and remove third line when fix #19254
s
,
addr
:=
newServer
(
conn
.
handle
)
// s, addr := newServer(conn.handle)
defer
s
.
Close
()
// defer s.Close()
_
,
addr
:=
newServer
(
conn
.
handle
)
config
,
err
:=
websocket
.
NewConfig
(
"ws://"
+
addr
,
"http://localhost/"
)
config
,
err
:=
websocket
.
NewConfig
(
"ws://"
+
addr
,
"http://localhost/"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/pkg/auth/authenticator/token/oidc/oidc_test.go
View file @
bf1a3f99
...
@@ -227,8 +227,7 @@ func TestOIDCDiscoveryNoKeyEndpoint(t *testing.T) {
...
@@ -227,8 +227,7 @@ func TestOIDCDiscoveryNoKeyEndpoint(t *testing.T) {
t
.
Fatalf
(
"Cannot load cert/key pair: %v"
,
err
)
t
.
Fatalf
(
"Cannot load cert/key pair: %v"
,
err
)
}
}
srv
.
StartTLS
()
srv
.
StartTLS
()
// TODO: Uncomment when fix #19254
defer
srv
.
Close
()
// defer srv.Close()
op
.
pcfg
=
oidc
.
ProviderConfig
{
op
.
pcfg
=
oidc
.
ProviderConfig
{
Issuer
:
mustParseURL
(
t
,
srv
.
URL
),
// An invalid ProviderConfig. Keys endpoint is required.
Issuer
:
mustParseURL
(
t
,
srv
.
URL
),
// An invalid ProviderConfig. Keys endpoint is required.
...
@@ -244,8 +243,7 @@ func TestOIDCDiscoverySecureConnection(t *testing.T) {
...
@@ -244,8 +243,7 @@ func TestOIDCDiscoverySecureConnection(t *testing.T) {
// Verify that plain HTTP issuer URL is forbidden.
// Verify that plain HTTP issuer URL is forbidden.
op
:=
newOIDCProvider
(
t
)
op
:=
newOIDCProvider
(
t
)
srv
:=
httptest
.
NewServer
(
op
.
mux
)
srv
:=
httptest
.
NewServer
(
op
.
mux
)
// TODO: Uncomment when fix #19254
defer
srv
.
Close
()
// defer srv.Close()
op
.
pcfg
=
oidc
.
ProviderConfig
{
op
.
pcfg
=
oidc
.
ProviderConfig
{
Issuer
:
mustParseURL
(
t
,
srv
.
URL
),
Issuer
:
mustParseURL
(
t
,
srv
.
URL
),
...
@@ -281,8 +279,7 @@ func TestOIDCDiscoverySecureConnection(t *testing.T) {
...
@@ -281,8 +279,7 @@ func TestOIDCDiscoverySecureConnection(t *testing.T) {
t
.
Fatalf
(
"Cannot load cert/key pair: %v"
,
err
)
t
.
Fatalf
(
"Cannot load cert/key pair: %v"
,
err
)
}
}
tlsSrv
.
StartTLS
()
tlsSrv
.
StartTLS
()
// TODO: Uncomment when fix #19254
defer
tlsSrv
.
Close
()
// defer tlsSrv.Close()
op
.
pcfg
=
oidc
.
ProviderConfig
{
op
.
pcfg
=
oidc
.
ProviderConfig
{
Issuer
:
mustParseURL
(
t
,
tlsSrv
.
URL
),
Issuer
:
mustParseURL
(
t
,
tlsSrv
.
URL
),
...
@@ -317,8 +314,7 @@ func TestOIDCAuthentication(t *testing.T) {
...
@@ -317,8 +314,7 @@ func TestOIDCAuthentication(t *testing.T) {
t
.
Fatalf
(
"Cannot load cert/key pair: %v"
,
err
)
t
.
Fatalf
(
"Cannot load cert/key pair: %v"
,
err
)
}
}
srv
.
StartTLS
()
srv
.
StartTLS
()
// TODO: Uncomment when fix #19254
defer
srv
.
Close
()
// defer srv.Close()
// A provider config with all required fields.
// A provider config with all required fields.
op
.
pcfg
=
oidc
.
ProviderConfig
{
op
.
pcfg
=
oidc
.
ProviderConfig
{
...
...
plugin/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go
View file @
bf1a3f99
...
@@ -113,8 +113,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -113,8 +113,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
if
_
,
err
:=
factory
.
NewConfigFactory
(
client
,
"some-scheduler-name"
)
.
CreateFromConfig
(
policy
);
err
!=
nil
{
if
_
,
err
:=
factory
.
NewConfigFactory
(
client
,
"some-scheduler-name"
)
.
CreateFromConfig
(
policy
);
err
!=
nil
{
...
...
plugin/pkg/scheduler/factory/factory_test.go
View file @
bf1a3f99
...
@@ -45,8 +45,7 @@ func TestCreate(t *testing.T) {
...
@@ -45,8 +45,7 @@ func TestCreate(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
factory
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
factory
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
factory
.
Create
()
factory
.
Create
()
...
@@ -64,8 +63,7 @@ func TestCreateFromConfig(t *testing.T) {
...
@@ -64,8 +63,7 @@ func TestCreateFromConfig(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
factory
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
factory
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
...
@@ -106,8 +104,7 @@ func TestCreateFromEmptyConfig(t *testing.T) {
...
@@ -106,8 +104,7 @@ func TestCreateFromEmptyConfig(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
factory
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
factory
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
...
@@ -150,8 +147,7 @@ func TestDefaultErrorFunc(t *testing.T) {
...
@@ -150,8 +147,7 @@ func TestDefaultErrorFunc(t *testing.T) {
// FakeHandler musn't be sent requests other than the one you want to test.
// FakeHandler musn't be sent requests other than the one you want to test.
mux
.
Handle
(
testapi
.
Default
.
ResourcePath
(
"pods"
,
"bar"
,
"foo"
),
&
handler
)
mux
.
Handle
(
testapi
.
Default
.
ResourcePath
(
"pods"
,
"bar"
,
"foo"
),
&
handler
)
server
:=
httptest
.
NewServer
(
mux
)
server
:=
httptest
.
NewServer
(
mux
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
factory
:=
NewConfigFactory
(
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}}),
api
.
DefaultSchedulerName
)
factory
:=
NewConfigFactory
(
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}}),
api
.
DefaultSchedulerName
)
queue
:=
cache
.
NewFIFO
(
cache
.
MetaNamespaceKeyFunc
)
queue
:=
cache
.
NewFIFO
(
cache
.
MetaNamespaceKeyFunc
)
podBackoff
:=
podBackoff
{
podBackoff
:=
podBackoff
{
...
@@ -234,8 +230,7 @@ func TestBind(t *testing.T) {
...
@@ -234,8 +230,7 @@ func TestBind(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
b
:=
binder
{
client
}
b
:=
binder
{
client
}
...
@@ -320,8 +315,7 @@ func TestResponsibleForPod(t *testing.T) {
...
@@ -320,8 +315,7 @@ func TestResponsibleForPod(t *testing.T) {
T
:
t
,
T
:
t
,
}
}
server
:=
httptest
.
NewServer
(
&
handler
)
server
:=
httptest
.
NewServer
(
&
handler
)
// TODO: Uncomment when fix #19254
defer
server
.
Close
()
// defer server.Close()
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
server
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
// factory of "default-scheduler"
// factory of "default-scheduler"
factoryDefaultScheduler
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
factoryDefaultScheduler
:=
NewConfigFactory
(
client
,
api
.
DefaultSchedulerName
)
...
...
test/component/scheduler/perf/util.go
View file @
bf1a3f99
...
@@ -75,8 +75,7 @@ func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destro
...
@@ -75,8 +75,7 @@ func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destro
destroyFunc
=
func
()
{
destroyFunc
=
func
()
{
glog
.
Infof
(
"destroying"
)
glog
.
Infof
(
"destroying"
)
close
(
schedulerConfig
.
StopEverything
)
close
(
schedulerConfig
.
StopEverything
)
// TODO: Uncomment when fix #19254
s
.
Close
()
// s.Close()
glog
.
Infof
(
"destroyed"
)
glog
.
Infof
(
"destroyed"
)
}
}
return
return
...
...
test/integration/auth_test.go
View file @
bf1a3f99
...
@@ -391,8 +391,7 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
...
@@ -391,8 +391,7 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
m
,
err
:=
master
.
New
(
masterConfig
)
m
,
err
:=
master
.
New
(
masterConfig
)
...
@@ -497,8 +496,7 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
...
@@ -497,8 +496,7 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authorizer
=
apiserver
.
NewAlwaysDenyAuthorizer
()
masterConfig
.
Authorizer
=
apiserver
.
NewAlwaysDenyAuthorizer
()
...
@@ -555,8 +553,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
...
@@ -555,8 +553,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
@@ -634,8 +631,7 @@ func TestBobIsForbidden(t *testing.T) {
...
@@ -634,8 +631,7 @@ func TestBobIsForbidden(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
@@ -686,8 +682,7 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
...
@@ -686,8 +682,7 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
@@ -844,8 +839,7 @@ func TestAuthorizationAttributeDetermination(t *testing.T) {
...
@@ -844,8 +839,7 @@ func TestAuthorizationAttributeDetermination(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
@@ -917,8 +911,7 @@ func TestNamespaceAuthorization(t *testing.T) {
...
@@ -917,8 +911,7 @@ func TestNamespaceAuthorization(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
@@ -1023,8 +1016,7 @@ func TestKindAuthorization(t *testing.T) {
...
@@ -1023,8 +1016,7 @@ func TestKindAuthorization(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
@@ -1116,8 +1108,7 @@ func TestReadOnlyAuthorization(t *testing.T) {
...
@@ -1116,8 +1108,7 @@ func TestReadOnlyAuthorization(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
masterConfig
.
Authenticator
=
getTestTokenAuth
()
...
...
test/integration/client_test.go
View file @
bf1a3f99
...
@@ -40,8 +40,7 @@ import (
...
@@ -40,8 +40,7 @@ import (
func
TestClient
(
t
*
testing
.
T
)
{
func
TestClient
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
framework
.
DeleteAllEtcdKeys
()
framework
.
DeleteAllEtcdKeys
()
...
@@ -111,8 +110,7 @@ func TestClient(t *testing.T) {
...
@@ -111,8 +110,7 @@ func TestClient(t *testing.T) {
func
TestSingleWatch
(
t
*
testing
.
T
)
{
func
TestSingleWatch
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
ns
:=
"blargh"
ns
:=
"blargh"
deleteAllEtcdKeys
()
deleteAllEtcdKeys
()
...
@@ -197,8 +195,7 @@ func TestMultiWatch(t *testing.T) {
...
@@ -197,8 +195,7 @@ func TestMultiWatch(t *testing.T) {
framework
.
DeleteAllEtcdKeys
()
framework
.
DeleteAllEtcdKeys
()
defer
framework
.
DeleteAllEtcdKeys
()
defer
framework
.
DeleteAllEtcdKeys
()
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
ns
:=
api
.
NamespaceDefault
ns
:=
api
.
NamespaceDefault
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
s
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
client
:=
client
.
NewOrDie
(
&
restclient
.
Config
{
Host
:
s
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()}})
...
...
test/integration/configmap_test.go
View file @
bf1a3f99
...
@@ -39,8 +39,7 @@ func TestConfigMap(t *testing.T) {
...
@@ -39,8 +39,7 @@ func TestConfigMap(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
m
,
err
:=
master
.
New
(
masterConfig
)
m
,
err
:=
master
.
New
(
masterConfig
)
...
...
test/integration/extender_test.go
View file @
bf1a3f99
...
@@ -191,8 +191,7 @@ func TestSchedulerExtender(t *testing.T) {
...
@@ -191,8 +191,7 @@ func TestSchedulerExtender(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
m
,
err
:=
master
.
New
(
masterConfig
)
m
,
err
:=
master
.
New
(
masterConfig
)
...
@@ -210,8 +209,7 @@ func TestSchedulerExtender(t *testing.T) {
...
@@ -210,8 +209,7 @@ func TestSchedulerExtender(t *testing.T) {
es1
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
es1
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
extender1
.
serveHTTP
(
t
,
w
,
req
)
extender1
.
serveHTTP
(
t
,
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
es1
.
Close
()
// defer es1.Close()
extender2
:=
&
Extender
{
extender2
:=
&
Extender
{
name
:
"extender2"
,
name
:
"extender2"
,
...
@@ -221,8 +219,7 @@ func TestSchedulerExtender(t *testing.T) {
...
@@ -221,8 +219,7 @@ func TestSchedulerExtender(t *testing.T) {
es2
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
es2
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
extender2
.
serveHTTP
(
t
,
w
,
req
)
extender2
.
serveHTTP
(
t
,
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
es2
.
Close
()
// defer es2.Close()
policy
:=
schedulerapi
.
Policy
{
policy
:=
schedulerapi
.
Policy
{
ExtenderConfigs
:
[]
schedulerapi
.
ExtenderConfig
{
ExtenderConfigs
:
[]
schedulerapi
.
ExtenderConfig
{
...
...
test/integration/framework/master_utils.go
View file @
bf1a3f99
...
@@ -210,8 +210,7 @@ func (m *MasterComponents) Stop(apiServer, rcManager bool) {
...
@@ -210,8 +210,7 @@ func (m *MasterComponents) Stop(apiServer, rcManager bool) {
m
.
once
.
Do
(
m
.
stopRCManager
)
m
.
once
.
Do
(
m
.
stopRCManager
)
}
}
if
apiServer
{
if
apiServer
{
// TODO: Uncomment when fix #19254
m
.
ApiServer
.
Close
()
// m.ApiServer.Close()
}
}
}
}
...
...
test/integration/master_test.go
View file @
bf1a3f99
...
@@ -35,8 +35,7 @@ import (
...
@@ -35,8 +35,7 @@ import (
func
testPrefix
(
t
*
testing
.
T
,
prefix
string
)
{
func
testPrefix
(
t
*
testing
.
T
,
prefix
string
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
resp
,
err
:=
http
.
Get
(
s
.
URL
+
prefix
)
resp
,
err
:=
http
.
Get
(
s
.
URL
+
prefix
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -65,8 +64,7 @@ func TestExtensionsPrefix(t *testing.T) {
...
@@ -65,8 +64,7 @@ func TestExtensionsPrefix(t *testing.T) {
func
TestWatchSucceedsWithoutArgs
(
t
*
testing
.
T
)
{
func
TestWatchSucceedsWithoutArgs
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
resp
,
err
:=
http
.
Get
(
s
.
URL
+
"/api/v1/namespaces?watch=1"
)
resp
,
err
:=
http
.
Get
(
s
.
URL
+
"/api/v1/namespaces?watch=1"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -306,8 +304,7 @@ func TestBatchGroupBackwardCompatibility(t *testing.T) {
...
@@ -306,8 +304,7 @@ func TestBatchGroupBackwardCompatibility(t *testing.T) {
func
TestAccept
(
t
*
testing
.
T
)
{
func
TestAccept
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
resp
,
err
:=
http
.
Get
(
s
.
URL
+
"/api/"
)
resp
,
err
:=
http
.
Get
(
s
.
URL
+
"/api/"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
test/integration/metrics_test.go
View file @
bf1a3f99
...
@@ -87,8 +87,7 @@ func checkForExpectedMetrics(t *testing.T, metrics []*prometheuspb.MetricFamily,
...
@@ -87,8 +87,7 @@ func checkForExpectedMetrics(t *testing.T, metrics []*prometheuspb.MetricFamily,
func
TestMasterProcessMetrics
(
t
*
testing
.
T
)
{
func
TestMasterProcessMetrics
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
metrics
,
err
:=
scrapeMetrics
(
s
)
metrics
,
err
:=
scrapeMetrics
(
s
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -105,8 +104,7 @@ func TestMasterProcessMetrics(t *testing.T) {
...
@@ -105,8 +104,7 @@ func TestMasterProcessMetrics(t *testing.T) {
func
TestApiserverMetrics
(
t
*
testing
.
T
)
{
func
TestApiserverMetrics
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
// Make a request to the apiserver to ensure there's at least one data point
// Make a request to the apiserver to ensure there's at least one data point
// for the metrics we're expecting -- otherwise, they won't be exported.
// for the metrics we're expecting -- otherwise, they won't be exported.
...
...
test/integration/persistent_volumes_test.go
View file @
bf1a3f99
...
@@ -44,8 +44,7 @@ func init() {
...
@@ -44,8 +44,7 @@ func init() {
func
TestPersistentVolumeRecycler
(
t
*
testing
.
T
)
{
func
TestPersistentVolumeRecycler
(
t
*
testing
.
T
)
{
_
,
s
:=
framework
.
RunAMaster
(
t
)
_
,
s
:=
framework
.
RunAMaster
(
t
)
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
deleteAllEtcdKeys
()
deleteAllEtcdKeys
()
// Use higher QPS and Burst, there is a test for race condition below, which
// Use higher QPS and Burst, there is a test for race condition below, which
...
...
test/integration/pods.go
View file @
bf1a3f99
...
@@ -37,8 +37,7 @@ func TestPodUpdateActiveDeadlineSeconds(t *testing.T) {
...
@@ -37,8 +37,7 @@ func TestPodUpdateActiveDeadlineSeconds(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
ns
:=
"pod-activedeadline-update"
ns
:=
"pod-activedeadline-update"
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
...
@@ -168,8 +167,7 @@ func TestPodReadOnlyFilesystem(t *testing.T) {
...
@@ -168,8 +167,7 @@ func TestPodReadOnlyFilesystem(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
isReadOnly
:=
true
isReadOnly
:=
true
ns
:=
"pod-readonly-root"
ns
:=
"pod-readonly-root"
...
...
test/integration/scheduler_test.go
View file @
bf1a3f99
...
@@ -58,8 +58,7 @@ func TestUnschedulableNodes(t *testing.T) {
...
@@ -58,8 +58,7 @@ func TestUnschedulableNodes(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
m
,
err
:=
master
.
New
(
masterConfig
)
m
,
err
:=
master
.
New
(
masterConfig
)
...
...
test/integration/secret_test.go
View file @
bf1a3f99
...
@@ -45,8 +45,7 @@ func TestSecrets(t *testing.T) {
...
@@ -45,8 +45,7 @@ func TestSecrets(t *testing.T) {
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
s
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
m
.
Handler
.
ServeHTTP
(
w
,
req
)
m
.
Handler
.
ServeHTTP
(
w
,
req
)
}))
}))
// TODO: Uncomment when fix #19254
defer
s
.
Close
()
// defer s.Close()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
masterConfig
:=
framework
.
NewIntegrationTestMasterConfig
()
m
,
err
:=
master
.
New
(
masterConfig
)
m
,
err
:=
master
.
New
(
masterConfig
)
...
...
test/integration/service_account_test.go
View file @
bf1a3f99
...
@@ -426,8 +426,7 @@ func startServiceAccountTestServer(t *testing.T) (*clientset.Clientset, restclie
...
@@ -426,8 +426,7 @@ func startServiceAccountTestServer(t *testing.T) (*clientset.Clientset, restclie
tokenController
.
Stop
()
tokenController
.
Stop
()
serviceAccountController
.
Stop
()
serviceAccountController
.
Stop
()
serviceAccountAdmission
.
Stop
()
serviceAccountAdmission
.
Stop
()
// TODO: Uncomment when fix #19254
apiServer
.
Close
()
// apiServer.Close()
}
}
return
rootClientset
,
clientConfig
,
stop
return
rootClientset
,
clientConfig
,
stop
...
...
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