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
0f1a3587
Commit
0f1a3587
authored
Jul 20, 2016
by
k8s-merge-robot
Committed by
GitHub
Jul 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29279 from mksalawa/schedulertest
Automatic merge from submit-queue Fix generic scheduler test
parents
3af6f472
fea8d0ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
generic_scheduler_test.go
plugin/pkg/scheduler/generic_scheduler_test.go
+29
-14
No files found.
plugin/pkg/scheduler/generic_scheduler_test.go
View file @
0f1a3587
...
@@ -193,8 +193,14 @@ func TestGenericScheduler(t *testing.T) {
...
@@ -193,8 +193,14 @@ func TestGenericScheduler(t *testing.T) {
prioritizers
:
[]
algorithm
.
PriorityConfig
{{
Function
:
EqualPriority
,
Weight
:
1
}},
prioritizers
:
[]
algorithm
.
PriorityConfig
{{
Function
:
EqualPriority
,
Weight
:
1
}},
nodes
:
[]
string
{
"machine1"
,
"machine2"
},
nodes
:
[]
string
{
"machine1"
,
"machine2"
},
expectsErr
:
true
,
expectsErr
:
true
,
pod
:
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"2"
}},
name
:
"test 1"
,
name
:
"test 1"
,
wErr
:
algorithmpredicates
.
ErrFakePredicate
,
wErr
:
&
FitError
{
Pod
:
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"2"
}},
FailedPredicates
:
FailedPredicateMap
{
"machine1"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
"machine2"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
}},
},
},
{
{
predicates
:
map
[
string
]
algorithm
.
FitPredicate
{
"true"
:
truePredicate
},
predicates
:
map
[
string
]
algorithm
.
FitPredicate
{
"true"
:
truePredicate
},
...
@@ -244,9 +250,17 @@ func TestGenericScheduler(t *testing.T) {
...
@@ -244,9 +250,17 @@ func TestGenericScheduler(t *testing.T) {
predicates
:
map
[
string
]
algorithm
.
FitPredicate
{
"true"
:
truePredicate
,
"false"
:
falsePredicate
},
predicates
:
map
[
string
]
algorithm
.
FitPredicate
{
"true"
:
truePredicate
,
"false"
:
falsePredicate
},
prioritizers
:
[]
algorithm
.
PriorityConfig
{{
Function
:
numericPriority
,
Weight
:
1
}},
prioritizers
:
[]
algorithm
.
PriorityConfig
{{
Function
:
numericPriority
,
Weight
:
1
}},
nodes
:
[]
string
{
"3"
,
"2"
,
"1"
},
nodes
:
[]
string
{
"3"
,
"2"
,
"1"
},
pod
:
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"2"
}},
expectsErr
:
true
,
expectsErr
:
true
,
name
:
"test 7"
,
name
:
"test 7"
,
wErr
:
nil
,
wErr
:
&
FitError
{
Pod
:
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"2"
}},
FailedPredicates
:
FailedPredicateMap
{
"3"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
"2"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
"1"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
},
},
},
},
{
{
predicates
:
map
[
string
]
algorithm
.
FitPredicate
{
predicates
:
map
[
string
]
algorithm
.
FitPredicate
{
...
@@ -270,7 +284,13 @@ func TestGenericScheduler(t *testing.T) {
...
@@ -270,7 +284,13 @@ func TestGenericScheduler(t *testing.T) {
nodes
:
[]
string
{
"1"
,
"2"
},
nodes
:
[]
string
{
"1"
,
"2"
},
expectsErr
:
true
,
expectsErr
:
true
,
name
:
"test 8"
,
name
:
"test 8"
,
wErr
:
nil
,
wErr
:
&
FitError
{
Pod
:
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"2"
}},
FailedPredicates
:
FailedPredicateMap
{
"1"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
"2"
:
algorithmpredicates
.
ErrFakePredicate
.
PredicateName
,
},
},
},
},
}
}
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
...
@@ -283,17 +303,12 @@ func TestGenericScheduler(t *testing.T) {
...
@@ -283,17 +303,12 @@ func TestGenericScheduler(t *testing.T) {
}
}
scheduler
:=
NewGenericScheduler
(
cache
,
test
.
predicates
,
test
.
prioritizers
,
[]
algorithm
.
SchedulerExtender
{})
scheduler
:=
NewGenericScheduler
(
cache
,
test
.
predicates
,
test
.
prioritizers
,
[]
algorithm
.
SchedulerExtender
{})
machine
,
err
:=
scheduler
.
Schedule
(
test
.
pod
,
algorithm
.
FakeNodeLister
(
makeNodeList
(
test
.
nodes
)))
machine
,
err
:=
scheduler
.
Schedule
(
test
.
pod
,
algorithm
.
FakeNodeLister
(
makeNodeList
(
test
.
nodes
)))
if
test
.
expectsErr
{
if
err
==
nil
{
if
!
reflect
.
DeepEqual
(
err
,
test
.
wErr
)
{
t
.
Errorf
(
"Unexpected non-error at %s"
,
test
.
name
)
t
.
Errorf
(
"Failed : %s, Unexpected error: %v, expected: %v"
,
test
.
name
,
err
,
test
.
wErr
)
}
}
}
else
{
if
test
.
expectedHosts
!=
nil
&&
!
test
.
expectedHosts
.
Has
(
machine
)
{
if
!
reflect
.
DeepEqual
(
err
,
test
.
wErr
)
{
t
.
Errorf
(
"Failed : %s, Expected: %s, got: %s"
,
test
.
name
,
test
.
expectedHosts
,
machine
)
t
.
Errorf
(
"Failed : %s, Unexpected error: %v, expected: %v"
,
test
.
name
,
err
,
test
.
wErr
)
}
if
!
test
.
expectedHosts
.
Has
(
machine
)
{
t
.
Errorf
(
"Failed : %s, Expected: %s, Saw: %s"
,
test
.
name
,
test
.
expectedHosts
,
machine
)
}
}
}
}
}
}
}
...
...
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