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
26142e61
Commit
26142e61
authored
Aug 31, 2018
by
Klaus Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for Scheduler cache empty.
Signed-off-by:
Klaus Ma
<
klaus1982.cn@gmail.com
>
parent
cd064199
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
scheduler.go
pkg/scheduler/scheduler.go
+5
-0
taint_test.go
test/integration/scheduler/taint_test.go
+4
-1
util.go
test/integration/scheduler/util.go
+12
-0
No files found.
pkg/scheduler/scheduler.go
View file @
26142e61
...
@@ -74,6 +74,11 @@ func (sched *Scheduler) StopEverything() {
...
@@ -74,6 +74,11 @@ func (sched *Scheduler) StopEverything() {
close
(
sched
.
config
.
StopEverything
)
close
(
sched
.
config
.
StopEverything
)
}
}
// Cache returns the cache in scheduler for test to check the data in scheduler.
func
(
sched
*
Scheduler
)
Cache
()
schedulercache
.
Cache
{
return
sched
.
config
.
SchedulerCache
}
// Configurator defines I/O, caching, and other functionality needed to
// Configurator defines I/O, caching, and other functionality needed to
// construct a new scheduler. An implementation of this can be seen in
// construct a new scheduler. An implementation of this can be seen in
// factory.go.
// factory.go.
...
...
test/integration/scheduler/taint_test.go
View file @
26142e61
...
@@ -104,7 +104,7 @@ func TestTaintNodeByCondition(t *testing.T) {
...
@@ -104,7 +104,7 @@ func TestTaintNodeByCondition(t *testing.T) {
informers
.
Extensions
()
.
V1beta1
()
.
DaemonSets
(),
informers
.
Extensions
()
.
V1beta1
()
.
DaemonSets
(),
nil
,
// CloudProvider
nil
,
// CloudProvider
cs
,
cs
,
time
.
Second
,
// Node monitor grace period
time
.
Hour
,
// Node monitor grace period
time
.
Second
,
// Node startup grace period
time
.
Second
,
// Node startup grace period
time
.
Second
,
// Node monitor period
time
.
Second
,
// Node monitor period
time
.
Second
,
// Pod eviction timeout
time
.
Second
,
// Pod eviction timeout
...
@@ -125,6 +125,8 @@ func TestTaintNodeByCondition(t *testing.T) {
...
@@ -125,6 +125,8 @@ func TestTaintNodeByCondition(t *testing.T) {
// Waiting for all controller sync.
// Waiting for all controller sync.
internalInformers
.
Start
(
controllerCh
)
internalInformers
.
Start
(
controllerCh
)
internalInformers
.
WaitForCacheSync
(
controllerCh
)
internalInformers
.
WaitForCacheSync
(
controllerCh
)
informers
.
Start
(
controllerCh
)
informers
.
WaitForCacheSync
(
controllerCh
)
// -------------------------------------------
// -------------------------------------------
// Test TaintNodeByCondition feature.
// Test TaintNodeByCondition feature.
...
@@ -669,6 +671,7 @@ func TestTaintNodeByCondition(t *testing.T) {
...
@@ -669,6 +671,7 @@ func TestTaintNodeByCondition(t *testing.T) {
cleanupPods
(
cs
,
t
,
pods
)
cleanupPods
(
cs
,
t
,
pods
)
cleanupNodes
(
cs
,
t
)
cleanupNodes
(
cs
,
t
)
waitForSchedulerCacheCleanup
(
context
.
scheduler
,
t
)
})
})
}
}
}
}
test/integration/scheduler/util.go
View file @
26142e61
...
@@ -679,3 +679,15 @@ func cleanupPodsInNamespace(cs clientset.Interface, t *testing.T, ns string) {
...
@@ -679,3 +679,15 @@ func cleanupPodsInNamespace(cs clientset.Interface, t *testing.T, ns string) {
t
.
Errorf
(
"error while waiting for pods in namespace %v: %v"
,
ns
,
err
)
t
.
Errorf
(
"error while waiting for pods in namespace %v: %v"
,
ns
,
err
)
}
}
}
}
func
waitForSchedulerCacheCleanup
(
sched
*
scheduler
.
Scheduler
,
t
*
testing
.
T
)
{
schedulerCacheIsEmpty
:=
func
()
(
bool
,
error
)
{
snapshot
:=
sched
.
Cache
()
.
Snapshot
()
return
len
(
snapshot
.
Nodes
)
==
0
&&
len
(
snapshot
.
AssumedPods
)
==
0
,
nil
}
if
err
:=
wait
.
Poll
(
time
.
Second
,
wait
.
ForeverTestTimeout
,
schedulerCacheIsEmpty
);
err
!=
nil
{
t
.
Errorf
(
"Failed to wait for scheduler cache cleanup: %v"
,
err
)
}
}
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