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
5449d153
Commit
5449d153
authored
Jul 21, 2018
by
Weibin Lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve unit test TestZeroRequest
parent
4797c8df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
generic_scheduler_test.go
pkg/scheduler/core/generic_scheduler_test.go
+10
-13
No files found.
pkg/scheduler/core/generic_scheduler_test.go
View file @
5449d153
...
...
@@ -611,10 +611,11 @@ func TestZeroRequest(t *testing.T) {
large2
:=
large
large2
.
NodeName
=
"machine2"
tests
:=
[]
struct
{
pod
*
v1
.
Pod
pods
[]
*
v1
.
Pod
nodes
[]
*
v1
.
Node
name
string
pod
*
v1
.
Pod
pods
[]
*
v1
.
Pod
nodes
[]
*
v1
.
Node
name
string
expectedScore
int
}{
// The point of these next two tests is to show you get the same priority for a zero-request pod
// as for a pod with the defaults requests, both when the zero-request pod is already on the machine
...
...
@@ -627,6 +628,7 @@ func TestZeroRequest(t *testing.T) {
{
Spec
:
large1
},
{
Spec
:
noResources1
},
{
Spec
:
large2
},
{
Spec
:
small2
},
},
expectedScore
:
25
,
},
{
pod
:
&
v1
.
Pod
{
Spec
:
small
},
...
...
@@ -636,6 +638,7 @@ func TestZeroRequest(t *testing.T) {
{
Spec
:
large1
},
{
Spec
:
noResources1
},
{
Spec
:
large2
},
{
Spec
:
small2
},
},
expectedScore
:
25
,
},
// The point of this test is to verify that we're not just getting the same score no matter what we schedule.
{
...
...
@@ -646,10 +649,10 @@ func TestZeroRequest(t *testing.T) {
{
Spec
:
large1
},
{
Spec
:
noResources1
},
{
Spec
:
large2
},
{
Spec
:
small2
},
},
expectedScore
:
23
,
},
}
const
expectedPriority
int
=
25
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
// This should match the configuration in defaultPriorities() in
...
...
@@ -683,14 +686,8 @@ func TestZeroRequest(t *testing.T) {
t
.
Errorf
(
"unexpected error: %v"
,
err
)
}
for
_
,
hp
:=
range
list
{
if
test
.
name
==
"test priority of larger pod with machine with zero-request pod"
{
if
hp
.
Score
==
expectedPriority
{
t
.
Errorf
(
"expected non-%d for all priorities, got list %#v"
,
expectedPriority
,
list
)
}
}
else
{
if
hp
.
Score
!=
expectedPriority
{
t
.
Errorf
(
"expected %d for all priorities, got list %#v"
,
expectedPriority
,
list
)
}
if
hp
.
Score
!=
test
.
expectedScore
{
t
.
Errorf
(
"expected %d for all priorities, got list %#v"
,
test
.
expectedScore
,
list
)
}
}
})
...
...
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