mirror of https://github.com/k3s-io/k3s
Add namespace name into e2e event verify
parent
d7f6154136
commit
b646467536
|
@ -91,7 +91,7 @@ var _ = framework.KubeDescribe("EquivalenceCache [Serial]", func() {
|
|||
WaitForSchedulerAfterAction(f, func() error {
|
||||
err := CreateNodeSelectorPods(f, rcName, 2, nodeSelector, false)
|
||||
return err
|
||||
}, rcName, false)
|
||||
}, ns, rcName, false)
|
||||
defer framework.DeleteRCAndPods(f.ClientSet, f.InternalClientset, f.ScalesGetter, ns, rcName)
|
||||
// the first replica pod is scheduled, and the second pod will be rejected.
|
||||
verifyResult(cs, 1, 1, ns)
|
||||
|
@ -157,7 +157,7 @@ var _ = framework.KubeDescribe("EquivalenceCache [Serial]", func() {
|
|||
WaitForSchedulerAfterAction(f, func() error {
|
||||
err := framework.ScaleRC(f.ClientSet, f.InternalClientset, f.ScalesGetter, ns, affinityRCName, uint(replica+1), false)
|
||||
return err
|
||||
}, affinityRCName, false)
|
||||
}, ns, affinityRCName, false)
|
||||
// and this new pod should be rejected since node label has been updated
|
||||
verifyReplicasResult(cs, replica, 1, ns, affinityRCName)
|
||||
})
|
||||
|
@ -222,7 +222,7 @@ var _ = framework.KubeDescribe("EquivalenceCache [Serial]", func() {
|
|||
WaitForSchedulerAfterAction(f, func() error {
|
||||
_, err := cs.CoreV1().ReplicationControllers(ns).Create(rc)
|
||||
return err
|
||||
}, labelRCName, false)
|
||||
}, ns, labelRCName, false)
|
||||
|
||||
// these two replicas should all be rejected since podAntiAffinity says it they anit-affinity with pod {"service": "S1"}
|
||||
verifyReplicasResult(cs, 0, replica, ns, labelRCName)
|
||||
|
|
|
@ -23,12 +23,12 @@ import (
|
|||
"k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
func scheduleSuccessEvent(podName, nodeName string) func(*v1.Event) bool {
|
||||
func scheduleSuccessEvent(ns, podName, nodeName string) func(*v1.Event) bool {
|
||||
return func(e *v1.Event) bool {
|
||||
return e.Type == v1.EventTypeNormal &&
|
||||
e.Reason == "Scheduled" &&
|
||||
strings.HasPrefix(e.Name, podName) &&
|
||||
strings.Contains(e.Message, fmt.Sprintf("Successfully assigned %v to %v", podName, nodeName))
|
||||
strings.Contains(e.Message, fmt.Sprintf("Successfully assigned %v/%v to %v", ns, podName, nodeName))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
|
|||
WaitForSchedulerAfterAction(f, createPausePodAction(f, pausePodConfig{
|
||||
Name: podName,
|
||||
Labels: map[string]string{"name": "additional"},
|
||||
}), podName, false)
|
||||
}), ns, podName, false)
|
||||
verifyResult(cs, podsNeededForSaturation, 1, ns)
|
||||
})
|
||||
|
||||
|
@ -222,7 +222,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
|
|||
},
|
||||
},
|
||||
}
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
|
||||
verifyResult(cs, podsNeededForSaturation, 1, ns)
|
||||
})
|
||||
|
||||
|
@ -337,7 +337,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
|
|||
},
|
||||
},
|
||||
}
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
|
||||
verifyResult(cs, len(fillerPods), 1, ns)
|
||||
})
|
||||
|
||||
|
@ -362,7 +362,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
|
|||
},
|
||||
}
|
||||
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
|
||||
verifyResult(cs, 0, 1, ns)
|
||||
})
|
||||
|
||||
|
@ -461,7 +461,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
|
|||
},
|
||||
Labels: map[string]string{"name": "restricted"},
|
||||
}
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podName, false)
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
|
||||
verifyResult(cs, 0, 1, ns)
|
||||
})
|
||||
|
||||
|
@ -585,11 +585,11 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
|
|||
NodeSelector: map[string]string{labelKey: labelValue},
|
||||
}
|
||||
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), podNameNoTolerations, false)
|
||||
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podNameNoTolerations, false)
|
||||
verifyResult(cs, 0, 1, ns)
|
||||
|
||||
By("Removing taint off the node")
|
||||
WaitForSchedulerAfterAction(f, removeTaintFromNodeAction(cs, nodeName, testTaint), podNameNoTolerations, true)
|
||||
WaitForSchedulerAfterAction(f, removeTaintFromNodeAction(cs, nodeName, testTaint), ns, podNameNoTolerations, true)
|
||||
verifyResult(cs, 1, 0, ns)
|
||||
})
|
||||
|
||||
|
@ -736,10 +736,10 @@ func createPausePodAction(f *framework.Framework, conf pausePodConfig) common.Ac
|
|||
|
||||
// WaitForSchedulerAfterAction performs the provided action and then waits for
|
||||
// scheduler to act on the given pod.
|
||||
func WaitForSchedulerAfterAction(f *framework.Framework, action common.Action, podName string, expectSuccess bool) {
|
||||
func WaitForSchedulerAfterAction(f *framework.Framework, action common.Action, ns, podName string, expectSuccess bool) {
|
||||
predicate := scheduleFailureEvent(podName)
|
||||
if expectSuccess {
|
||||
predicate = scheduleSuccessEvent(podName, "" /* any node */)
|
||||
predicate = scheduleSuccessEvent(ns, podName, "" /* any node */)
|
||||
}
|
||||
success, err := common.ObserveEventAfterAction(f, predicate, action)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
|
Loading…
Reference in New Issue