Unverified Commit 8df7e859 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #60260 from msau42/refactor-tests

Automatic merge from submit-queue (batch tested with PRs 60396, 60384, 60395, 60387, 60260). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Refactor and add volume scheduling tests **What this PR does / why we need it**: * Combines pv node affinity negative tests into the same file as the rest of volume scheduling tests * Adds some more test cases around binding failure scenarios **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Partially address #56100 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents d866cf4b 7167c474
...@@ -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