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
ef9baf31
Commit
ef9baf31
authored
May 13, 2019
by
nolancon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unit tests for TopologyHints - Topology Manager Policies
parent
e82fa41f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
policy_preferred_test.go
pkg/kubelet/cm/topologymanager/policy_preferred_test.go
+5
-7
policy_strict_test.go
pkg/kubelet/cm/topologymanager/policy_strict_test.go
+5
-7
No files found.
pkg/kubelet/cm/topologymanager/policy_preferred_test.go
View file @
ef9baf31
...
...
@@ -23,27 +23,25 @@ import (
func
TestCanAdmitPodResult1
(
t
*
testing
.
T
)
{
tcases
:=
[]
struct
{
name
string
a
ffinity
bool
a
dmit
bool
expected
bool
}{
{
name
:
"Affinity is set to false in topology hints"
,
a
ffinity
:
false
,
a
dmit
:
false
,
expected
:
true
,
},
{
name
:
"Affinity is set to true in topology hints"
,
a
ffinity
:
true
,
a
dmit
:
true
,
expected
:
true
,
},
}
for
_
,
tc
:=
range
tcases
{
policy
:=
NewPreferredPolicy
()
hints
:=
TopologyHints
{
Affinity
:
tc
.
affinity
,
}
result
:=
policy
.
CanAdmitPodResult
(
hints
)
admit
:=
tc
.
admit
result
:=
policy
.
CanAdmitPodResult
(
admit
)
if
result
.
Admit
!=
tc
.
expected
{
t
.
Errorf
(
"Expected Admit field in result to be %t, got %t"
,
tc
.
expected
,
result
.
Admit
)
...
...
pkg/kubelet/cm/topologymanager/policy_strict_test.go
View file @
ef9baf31
...
...
@@ -23,27 +23,25 @@ import (
func
TestCanAdmitPodResult
(
t
*
testing
.
T
)
{
tcases
:=
[]
struct
{
name
string
a
ffinity
bool
a
dmit
bool
expected
bool
}{
{
name
:
"Affinity is set to false in topology hints"
,
a
ffinity
:
false
,
a
dmit
:
false
,
expected
:
false
,
},
{
name
:
"Affinity is set to true in topology hints"
,
a
ffinity
:
true
,
a
dmit
:
true
,
expected
:
true
,
},
}
for
_
,
tc
:=
range
tcases
{
policy
:=
NewStrictPolicy
()
hints
:=
TopologyHints
{
Affinity
:
tc
.
affinity
,
}
result
:=
policy
.
CanAdmitPodResult
(
hints
)
admit
:=
tc
.
admit
result
:=
policy
.
CanAdmitPodResult
(
admit
)
if
result
.
Admit
!=
tc
.
expected
{
t
.
Errorf
(
"Expected Admit field in result to be %t, got %t"
,
tc
.
expected
,
result
.
Admit
)
...
...
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