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
12732129
Commit
12732129
authored
Jan 14, 2019
by
Bobby (Babak) Salamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and improve preemption test to work with the new logic
parent
e3f4e1e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
generic_scheduler_test.go
pkg/scheduler/core/generic_scheduler_test.go
+6
-1
No files found.
pkg/scheduler/core/generic_scheduler_test.go
View file @
12732129
...
@@ -1407,6 +1407,7 @@ func TestPreempt(t *testing.T) {
...
@@ -1407,6 +1407,7 @@ func TestPreempt(t *testing.T) {
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Logf
(
"===== Running test %v"
,
t
.
Name
())
stop
:=
make
(
chan
struct
{})
stop
:=
make
(
chan
struct
{})
cache
:=
schedulerinternalcache
.
New
(
time
.
Duration
(
0
),
stop
)
cache
:=
schedulerinternalcache
.
New
(
time
.
Duration
(
0
),
stop
)
for
_
,
pod
:=
range
test
.
pods
{
for
_
,
pod
:=
range
test
.
pods
{
...
@@ -1443,14 +1444,18 @@ func TestPreempt(t *testing.T) {
...
@@ -1443,14 +1444,18 @@ func TestPreempt(t *testing.T) {
false
,
false
,
false
,
false
,
schedulerapi
.
DefaultPercentageOfNodesToScore
)
schedulerapi
.
DefaultPercentageOfNodesToScore
)
scheduler
.
(
*
genericScheduler
)
.
snapshot
()
// Call Preempt and check the expected results.
// Call Preempt and check the expected results.
node
,
victims
,
_
,
err
:=
scheduler
.
Preempt
(
test
.
pod
,
schedulertesting
.
FakeNodeLister
(
makeNodeList
(
nodeNames
)),
error
(
&
FitError
{
Pod
:
test
.
pod
,
FailedPredicates
:
failedPredMap
}))
node
,
victims
,
_
,
err
:=
scheduler
.
Preempt
(
test
.
pod
,
schedulertesting
.
FakeNodeLister
(
makeNodeList
(
nodeNames
)),
error
(
&
FitError
{
Pod
:
test
.
pod
,
FailedPredicates
:
failedPredMap
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error in preemption: %v"
,
err
)
t
.
Errorf
(
"unexpected error in preemption: %v"
,
err
)
}
}
if
(
node
!=
nil
&&
node
.
Name
!=
test
.
expectedNode
)
||
(
node
==
nil
&&
len
(
test
.
expectedNode
)
!=
0
)
{
if
node
!=
nil
&&
node
.
Name
!=
test
.
expectedNode
{
t
.
Errorf
(
"expected node: %v, got: %v"
,
test
.
expectedNode
,
node
.
GetName
())
t
.
Errorf
(
"expected node: %v, got: %v"
,
test
.
expectedNode
,
node
.
GetName
())
}
}
if
node
==
nil
&&
len
(
test
.
expectedNode
)
!=
0
{
t
.
Errorf
(
"expected node: %v, got: nothing"
,
test
.
expectedNode
)
}
if
len
(
victims
)
!=
len
(
test
.
expectedPods
)
{
if
len
(
victims
)
!=
len
(
test
.
expectedPods
)
{
t
.
Errorf
(
"expected %v pods, got %v."
,
len
(
test
.
expectedPods
),
len
(
victims
))
t
.
Errorf
(
"expected %v pods, got %v."
,
len
(
test
.
expectedPods
),
len
(
victims
))
}
}
...
...
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