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
5468773b
Commit
5468773b
authored
May 24, 2017
by
zhengjiajin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test and fix typo in daemoncontroller
parent
58167fcf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
daemoncontroller.go
pkg/controller/daemon/daemoncontroller.go
+1
-1
daemoncontroller_test.go
pkg/controller/daemon/daemoncontroller_test.go
+24
-1
No files found.
pkg/controller/daemon/daemoncontroller.go
View file @
5468773b
...
...
@@ -814,7 +814,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
// summary. Returned booleans are:
// * wantToRun:
// Returns true when a user would expect a pod to run on this node and ignores conditions
// such as OutOfDisk or insufficent resource that would cause a daemonset pod not to schedule.
// such as OutOfDisk or insuffic
i
ent resource that would cause a daemonset pod not to schedule.
// This is primarily used to populate daemonset status.
// * shouldSchedule:
// Returns true when a daemonset should be scheduled to a node if a daemonset pod is not already
...
...
pkg/controller/daemon/daemoncontroller_test.go
View file @
5468773b
...
...
@@ -455,7 +455,7 @@ func TestInsufficientCapacityNodeDaemonDoesNotLaunchPod(t *testing.T) {
}
// DaemonSets should not unschedule a daemonset pod from a node with insufficient free resource
func
TestInsufficentCapacityNodeDaemonDoesNotUnscheduleRunningPod
(
t
*
testing
.
T
)
{
func
TestInsuffic
i
entCapacityNodeDaemonDoesNotUnscheduleRunningPod
(
t
*
testing
.
T
)
{
podSpec
:=
resourcePodSpec
(
"too-much-mem"
,
"75M"
,
"75m"
)
podSpec
.
NodeName
=
"too-much-mem"
ds
:=
newDaemonSet
(
"foo"
)
...
...
@@ -1302,6 +1302,29 @@ func TestGetNodesToDaemonPods(t *testing.T) {
}
}
func
TestAddNode
(
t
*
testing
.
T
)
{
manager
,
_
,
_
:=
newTestController
()
node1
:=
newNode
(
"node1"
,
nil
)
ds
:=
newDaemonSet
(
"ds"
)
ds
.
Spec
.
Template
.
Spec
.
NodeSelector
=
simpleNodeLabel
manager
.
dsStore
.
Add
(
ds
)
manager
.
addNode
(
node1
)
if
got
,
want
:=
manager
.
queue
.
Len
(),
0
;
got
!=
want
{
t
.
Fatalf
(
"queue.Len() = %v, want %v"
,
got
,
want
)
}
node2
:=
newNode
(
"node2"
,
simpleNodeLabel
)
manager
.
addNode
(
node2
)
if
got
,
want
:=
manager
.
queue
.
Len
(),
1
;
got
!=
want
{
t
.
Fatalf
(
"queue.Len() = %v, want %v"
,
got
,
want
)
}
key
,
done
:=
manager
.
queue
.
Get
()
if
key
==
nil
||
done
{
t
.
Fatalf
(
"failed to enqueue controller for node %v"
,
node2
.
Name
)
}
}
func
TestAddPod
(
t
*
testing
.
T
)
{
manager
,
_
,
_
:=
newTestController
()
ds1
:=
newDaemonSet
(
"foo1"
)
...
...
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