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
ace0bde0
Unverified
Commit
ace0bde0
authored
Feb 12, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73943 from bsalamat/fix_race
Fix races in scheduling queue tests
parents
dc20f64d
ec0739bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
scheduling_queue_test.go
pkg/scheduler/internal/queue/scheduling_queue_test.go
+15
-7
No files found.
pkg/scheduler/internal/queue/scheduling_queue_test.go
View file @
ace0bde0
...
...
@@ -443,18 +443,26 @@ func TestPriorityQueue_NominatedPodsForNode(t *testing.T) {
}
func
TestPriorityQueue_PendingPods
(
t
*
testing
.
T
)
{
makeSet
:=
func
(
pods
[]
*
v1
.
Pod
)
map
[
*
v1
.
Pod
]
struct
{}
{
pendingSet
:=
map
[
*
v1
.
Pod
]
struct
{}{}
for
_
,
p
:=
range
pods
{
pendingSet
[
p
]
=
struct
{}{}
}
return
pendingSet
}
q
:=
NewPriorityQueue
(
nil
)
q
.
Add
(
&
medPriorityPod
)
addOrUpdateUnschedulablePod
(
q
,
&
unschedulablePod
)
addOrUpdateUnschedulablePod
(
q
,
&
highPriorityPod
)
expected
List
:=
[]
*
v1
.
Pod
{
&
medPriorityPod
,
&
unschedulablePod
,
&
highPriorityPod
}
if
!
reflect
.
DeepEqual
(
expected
List
,
q
.
PendingPods
(
))
{
t
.
Error
(
"Unexpected list of pending Pods
for node
."
)
expected
Set
:=
makeSet
([]
*
v1
.
Pod
{
&
medPriorityPod
,
&
unschedulablePod
,
&
highPriorityPod
})
if
!
reflect
.
DeepEqual
(
expected
Set
,
makeSet
(
q
.
PendingPods
()
))
{
t
.
Error
(
"Unexpected list of pending Pods."
)
}
// Move all to active queue. We should still see the same set of pods.
q
.
MoveAllToActiveQueue
()
if
!
reflect
.
DeepEqual
(
expected
List
,
q
.
PendingPods
(
))
{
t
.
Error
(
"Unexpected list of pending Pods
for node
."
)
if
!
reflect
.
DeepEqual
(
expected
Set
,
makeSet
(
q
.
PendingPods
()
))
{
t
.
Error
(
"Unexpected list of pending Pods
..
."
)
}
}
...
...
@@ -954,8 +962,8 @@ func TestHighProirotyFlushUnschedulableQLeftover(t *testing.T) {
},
}
q
.
unschedulableQ
.
addOrUpdate
(
&
highPod
)
q
.
unschedulableQ
.
addOrUpdate
(
&
midPod
)
addOrUpdateUnschedulablePod
(
q
,
&
highPod
)
addOrUpdateUnschedulablePod
(
q
,
&
midPod
)
// Update pod condition to highPod.
podutil
.
UpdatePodCondition
(
&
highPod
.
Status
,
&
v1
.
PodCondition
{
...
...
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