Commit 7167c474 authored by Michelle Au's avatar Michelle Au

Add more test cases for volume binding in the scheduler

parent 47b012ec
...@@ -11,7 +11,6 @@ go_test( ...@@ -11,7 +11,6 @@ go_test(
size = "large", size = "large",
srcs = [ srcs = [
"extender_test.go", "extender_test.go",
"local-pv-neg-affinity_test.go",
"main_test.go", "main_test.go",
"predicates_test.go", "predicates_test.go",
"preemption_test.go", "preemption_test.go",
......
...@@ -362,6 +362,18 @@ func waitForPodToSchedule(cs clientset.Interface, pod *v1.Pod) error { ...@@ -362,6 +362,18 @@ func waitForPodToSchedule(cs clientset.Interface, pod *v1.Pod) error {
return waitForPodToScheduleWithTimeout(cs, pod, 30*time.Second) return waitForPodToScheduleWithTimeout(cs, pod, 30*time.Second)
} }
// waitForPodUnscheduleWithTimeout waits for a pod to fail scheduling and returns
// an error if it does not become unschedulable within the given timeout.
func waitForPodUnschedulableWithTimeout(cs clientset.Interface, pod *v1.Pod, timeout time.Duration) error {
return wait.Poll(100*time.Millisecond, timeout, podUnschedulable(cs, pod.Namespace, pod.Name))
}
// waitForPodUnschedule waits for a pod to fail scheduling and returns
// an error if it does not become unschedulable within the timeout duration (30 seconds).
func waitForPodUnschedulable(cs clientset.Interface, pod *v1.Pod) error {
return waitForPodUnschedulableWithTimeout(cs, pod, 30*time.Second)
}
// deletePod deletes the given pod in the given namespace. // deletePod deletes the given pod in the given namespace.
func deletePod(cs clientset.Interface, podName string, nsName string) error { func deletePod(cs clientset.Interface, podName string, nsName string) error {
return cs.CoreV1().Pods(nsName).Delete(podName, metav1.NewDeleteOptions(0)) return cs.CoreV1().Pods(nsName).Delete(podName, metav1.NewDeleteOptions(0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment