mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Added unscheduable node UT for DaemonSet.
Signed-off-by: Da K. Ma <madaxa@cn.ibm.com>
This commit is contained in:
parent
dac59e4dd1
commit
f94b7eda83
@ -1545,6 +1545,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
|||||||
predicateName string
|
predicateName string
|
||||||
podsOnNode []*v1.Pod
|
podsOnNode []*v1.Pod
|
||||||
nodeCondition []v1.NodeCondition
|
nodeCondition []v1.NodeCondition
|
||||||
|
nodeUnschedulable bool
|
||||||
ds *apps.DaemonSet
|
ds *apps.DaemonSet
|
||||||
wantToRun, shouldSchedule, shouldContinueRunning bool
|
wantToRun, shouldSchedule, shouldContinueRunning bool
|
||||||
err error
|
err error
|
||||||
@ -1800,6 +1801,24 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
|||||||
shouldSchedule: true,
|
shouldSchedule: true,
|
||||||
shouldContinueRunning: true,
|
shouldContinueRunning: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
predicateName: "ShouldRunDaemonPodOnUnscheduableNode",
|
||||||
|
ds: &apps.DaemonSet{
|
||||||
|
Spec: apps.DaemonSetSpec{
|
||||||
|
Selector: &metav1.LabelSelector{MatchLabels: simpleDaemonSetLabel},
|
||||||
|
Template: v1.PodTemplateSpec{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Labels: simpleDaemonSetLabel,
|
||||||
|
},
|
||||||
|
Spec: resourcePodSpec("", "50M", "0.5"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nodeUnschedulable: true,
|
||||||
|
wantToRun: true,
|
||||||
|
shouldSchedule: true,
|
||||||
|
shouldContinueRunning: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, c := range cases {
|
for i, c := range cases {
|
||||||
@ -1807,6 +1826,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
|||||||
node := newNode("test-node", simpleDaemonSetLabel)
|
node := newNode("test-node", simpleDaemonSetLabel)
|
||||||
node.Status.Conditions = append(node.Status.Conditions, c.nodeCondition...)
|
node.Status.Conditions = append(node.Status.Conditions, c.nodeCondition...)
|
||||||
node.Status.Allocatable = allocatableResources("100M", "1")
|
node.Status.Allocatable = allocatableResources("100M", "1")
|
||||||
|
node.Spec.Unschedulable = c.nodeUnschedulable
|
||||||
manager, _, _, err := newTestController()
|
manager, _, _, err := newTestController()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error creating DaemonSets controller: %v", err)
|
t.Fatalf("error creating DaemonSets controller: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user