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
feb67d46
Commit
feb67d46
authored
Apr 13, 2017
by
Jamie Hannaford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bump kubelet/networks test coverage
parent
3b0b7399
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
BUILD
pkg/kubelet/BUILD
+1
-0
networks_test.go
pkg/kubelet/networks_test.go
+91
-0
No files found.
pkg/kubelet/BUILD
View file @
feb67d46
...
@@ -153,6 +153,7 @@ go_test(
...
@@ -153,6 +153,7 @@ go_test(
"kubelet_resources_test.go",
"kubelet_resources_test.go",
"kubelet_test.go",
"kubelet_test.go",
"kubelet_volumes_test.go",
"kubelet_volumes_test.go",
"networks_test.go",
"oom_watcher_test.go",
"oom_watcher_test.go",
"pod_container_deletor_test.go",
"pod_container_deletor_test.go",
"pod_workers_test.go",
"pod_workers_test.go",
...
...
pkg/kubelet/networks_test.go
0 → 100644
View file @
feb67d46
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
kubelet
import
(
"testing"
)
func
TestNetworkHostGetsPodNotFound
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
,
true
)
defer
testKubelet
.
Cleanup
()
nh
:=
networkHost
{
testKubelet
.
kubelet
}
actualPod
,
_
:=
nh
.
GetPodByName
(
""
,
""
)
if
actualPod
!=
nil
{
t
.
Fatalf
(
"Was expected nil, received %v instead"
,
actualPod
)
}
}
func
TestNetworkHostGetsKubeClient
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
,
true
)
defer
testKubelet
.
Cleanup
()
nh
:=
networkHost
{
testKubelet
.
kubelet
}
if
nh
.
GetKubeClient
()
!=
testKubelet
.
fakeKubeClient
{
t
.
Fatalf
(
"NetworkHost client does not match testKubelet's client"
)
}
}
func
TestNetworkHostGetsRuntime
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
,
true
)
defer
testKubelet
.
Cleanup
()
nh
:=
networkHost
{
testKubelet
.
kubelet
}
if
nh
.
GetRuntime
()
!=
testKubelet
.
fakeRuntime
{
t
.
Fatalf
(
"NetworkHost runtime does not match testKubelet's runtime"
)
}
}
func
TestNetworkHostSupportsLegacyFeatures
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
,
true
)
defer
testKubelet
.
Cleanup
()
nh
:=
networkHost
{
testKubelet
.
kubelet
}
if
nh
.
SupportsLegacyFeatures
()
==
false
{
t
.
Fatalf
(
"SupportsLegacyFeatures should not be false"
)
}
}
func
TestNoOpHostGetsName
(
t
*
testing
.
T
)
{
nh
:=
NoOpLegacyHost
{}
pod
,
err
:=
nh
.
GetPodByName
(
""
,
""
)
if
pod
!=
nil
&&
err
!=
true
{
t
.
Fatalf
(
"noOpLegacyHost getpodbyname expected to be nil and true"
)
}
}
func
TestNoOpHostGetsKubeClient
(
t
*
testing
.
T
)
{
nh
:=
NoOpLegacyHost
{}
if
nh
.
GetKubeClient
()
!=
nil
{
t
.
Fatalf
(
"noOpLegacyHost client expected to be nil"
)
}
}
func
TestNoOpHostGetsRuntime
(
t
*
testing
.
T
)
{
nh
:=
NoOpLegacyHost
{}
if
nh
.
GetRuntime
()
!=
nil
{
t
.
Fatalf
(
"noOpLegacyHost runtime expected to be nil"
)
}
}
func
TestNoOpHostSupportsLegacyFeatures
(
t
*
testing
.
T
)
{
nh
:=
NoOpLegacyHost
{}
if
nh
.
SupportsLegacyFeatures
()
!=
false
{
t
.
Fatalf
(
"noOpLegacyHost legacy features expected to be false"
)
}
}
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