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
d51962e1
Unverified
Commit
d51962e1
authored
Aug 15, 2016
by
Jess Frazelle
Committed by
Jess Frazelle
Oct 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vet fixes
Signed-off-by:
Jess Frazelle
<
me@jessfraz.com
>
parent
3803fee9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
kubelet_test.go
pkg/kubelet/kubelet_test.go
+3
-3
validate_test.go
pkg/security/apparmor/validate_test.go
+4
-3
mustmatchpatterns_test.go
...curity/podsecuritypolicy/sysctl/mustmatchpatterns_test.go
+1
-1
priorities_test.go
plugin/pkg/scheduler/algorithm/priorities/priorities_test.go
+5
-5
No files found.
pkg/kubelet/kubelet_test.go
View file @
d51962e1
...
...
@@ -705,7 +705,7 @@ func TestValidateContainerLogStatus(t *testing.T) {
podStatus
:=
&
api
.
PodStatus
{
ContainerStatuses
:
tc
.
statuses
}
_
,
err
:=
kubelet
.
validateContainerLogStatus
(
"podName"
,
podStatus
,
containerName
,
previous
)
if
!
tc
.
success
{
assert
.
Error
(
t
,
err
,
"[case %d] error"
,
i
)
assert
.
Error
(
t
,
err
,
fmt
.
Sprintf
(
"[case %d] error"
,
i
)
)
}
else
{
assert
.
NoError
(
t
,
err
,
"[case %d] error"
,
i
)
}
...
...
@@ -713,13 +713,13 @@ func TestValidateContainerLogStatus(t *testing.T) {
previous
=
true
_
,
err
=
kubelet
.
validateContainerLogStatus
(
"podName"
,
podStatus
,
containerName
,
previous
)
if
!
tc
.
pSuccess
{
assert
.
Error
(
t
,
err
,
"[case %d] error"
,
i
)
assert
.
Error
(
t
,
err
,
fmt
.
Sprintf
(
"[case %d] error"
,
i
)
)
}
else
{
assert
.
NoError
(
t
,
err
,
"[case %d] error"
,
i
)
}
// Access the log of a container that's not in the pod
_
,
err
=
kubelet
.
validateContainerLogStatus
(
"podName"
,
podStatus
,
"blah"
,
false
)
assert
.
Error
(
t
,
err
,
"[case %d] invalid container name should cause an error"
,
i
)
assert
.
Error
(
t
,
err
,
fmt
.
Sprintf
(
"[case %d] invalid container name should cause an error"
,
i
)
)
}
}
...
...
pkg/security/apparmor/validate_test.go
View file @
d51962e1
...
...
@@ -18,6 +18,7 @@ package apparmor
import
(
"errors"
"fmt"
"testing"
"k8s.io/kubernetes/pkg/api"
...
...
@@ -73,7 +74,7 @@ func TestValidateProfile(t *testing.T) {
if
test
.
expectValid
{
assert
.
NoError
(
t
,
err
,
"Profile %s should be valid"
,
test
.
profile
)
}
else
{
assert
.
Error
(
t
,
err
,
"Profile %s should not be valid"
,
test
.
profile
)
assert
.
Error
(
t
,
err
,
fmt
.
Sprintf
(
"Profile %s should not be valid"
,
test
.
profile
)
)
}
}
}
...
...
@@ -127,7 +128,7 @@ func TestValidateValidHost(t *testing.T) {
if
test
.
expectValid
{
assert
.
NoError
(
t
,
err
,
"Pod with profile %q should be valid"
,
test
.
profile
)
}
else
{
assert
.
Error
(
t
,
err
,
"Pod with profile %q should trigger a validation error"
,
test
.
profile
)
assert
.
Error
(
t
,
err
,
fmt
.
Sprintf
(
"Pod with profile %q should trigger a validation error"
,
test
.
profile
)
)
}
}
...
...
@@ -154,7 +155,7 @@ func TestValidateValidHost(t *testing.T) {
assert
.
NoError
(
t
,
v
.
Validate
(
pod
),
"Multi-container pod should validate"
)
for
k
,
val
:=
range
pod
.
Annotations
{
pod
.
Annotations
[
k
]
=
val
+
"-bad"
assert
.
Error
(
t
,
v
.
Validate
(
pod
),
"Multi-container pod with invalid profile %s:%s"
,
k
,
pod
.
Annotations
[
k
]
)
assert
.
Error
(
t
,
v
.
Validate
(
pod
),
fmt
.
Sprintf
(
"Multi-container pod with invalid profile %s:%s"
,
k
,
pod
.
Annotations
[
k
])
)
pod
.
Annotations
[
k
]
=
val
// Restore.
}
}
...
...
pkg/security/podsecuritypolicy/sysctl/mustmatchpatterns_test.go
View file @
d51962e1
...
...
@@ -85,7 +85,7 @@ func TestValidate(t *testing.T) {
testDisallowed
:=
func
(
key
string
,
category
string
)
{
for
_
,
s
:=
range
v
.
disallowed
{
pod
.
Annotations
=
map
[
string
]
string
{
key
:
api
.
PodAnnotationsFromSysctls
([]
api
.
Sysctl
{{
s
,
"dummy"
}}),
key
:
api
.
PodAnnotationsFromSysctls
([]
api
.
Sysctl
{{
Name
:
s
,
Value
:
"dummy"
}}),
}
errs
=
strategy
.
Validate
(
pod
)
if
len
(
errs
)
==
0
{
...
...
plugin/pkg/scheduler/algorithm/priorities/priorities_test.go
View file @
d51962e1
...
...
@@ -382,7 +382,7 @@ func TestMostRequested(t *testing.T) {
*/
pod
:
&
api
.
Pod
{
Spec
:
noResources
},
nodes
:
[]
*
api
.
Node
{
makeNode
(
"machine1"
,
4000
,
10000
),
makeNode
(
"machine2"
,
4000
,
10000
)},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
"machine1"
,
0
},
{
"machine2"
,
0
}},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
Host
:
"machine1"
,
Score
:
0
},
{
Host
:
"machine2"
,
Score
:
0
}},
test
:
"nothing scheduled, nothing requested"
,
},
{
...
...
@@ -399,7 +399,7 @@ func TestMostRequested(t *testing.T) {
*/
pod
:
&
api
.
Pod
{
Spec
:
cpuAndMemory
},
nodes
:
[]
*
api
.
Node
{
makeNode
(
"machine1"
,
4000
,
10000
),
makeNode
(
"machine2"
,
6000
,
10000
)},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
"machine1"
,
6
},
{
"machine2"
,
5
}},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
Host
:
"machine1"
,
Score
:
6
},
{
Host
:
"machine2"
,
Score
:
5
}},
test
:
"nothing scheduled, resources requested, differently sized machines"
,
},
{
...
...
@@ -416,7 +416,7 @@ func TestMostRequested(t *testing.T) {
*/
pod
:
&
api
.
Pod
{
Spec
:
noResources
},
nodes
:
[]
*
api
.
Node
{
makeNode
(
"machine1"
,
10000
,
20000
),
makeNode
(
"machine2"
,
10000
,
20000
)},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
"machine1"
,
3
},
{
"machine2"
,
4
}},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
Host
:
"machine1"
,
Score
:
3
},
{
Host
:
"machine2"
,
Score
:
4
}},
test
:
"no resources requested, pods scheduled with resources"
,
pods
:
[]
*
api
.
Pod
{
{
Spec
:
cpuOnly
,
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
labels2
}},
...
...
@@ -439,7 +439,7 @@ func TestMostRequested(t *testing.T) {
*/
pod
:
&
api
.
Pod
{
Spec
:
cpuAndMemory
},
nodes
:
[]
*
api
.
Node
{
makeNode
(
"machine1"
,
10000
,
20000
),
makeNode
(
"machine2"
,
10000
,
20000
)},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
"machine1"
,
4
},
{
"machine2"
,
5
}},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
Host
:
"machine1"
,
Score
:
4
},
{
Host
:
"machine2"
,
Score
:
5
}},
test
:
"resources requested, pods scheduled with resources"
,
pods
:
[]
*
api
.
Pod
{
{
Spec
:
cpuOnly
},
...
...
@@ -1142,7 +1142,7 @@ func TestNodePreferAvoidPriority(t *testing.T) {
},
},
nodes
:
testNodes
,
expectedList
:
[]
schedulerapi
.
HostPriority
{{
"machine1"
,
10
},
{
"machine2"
,
0
},
{
"machine3"
,
10
}},
expectedList
:
[]
schedulerapi
.
HostPriority
{{
Host
:
"machine1"
,
Score
:
10
},
{
Host
:
"machine2"
,
Score
:
0
},
{
Host
:
"machine3"
,
Score
:
10
}},
test
:
"pod managed by ReplicaSet should avoid a node, this node get lowest priority score"
,
},
}
...
...
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