Merge pull request #53759 from anfernee/sched-test

Automatic merge from submit-queue. 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>.

Make scheduler integration test faster

Not to wait for 30 seconds for every negative test case. This commit
also organizes the test code to make it more readable.

It cuts the test time from 450s to 125s.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #53302

**Special notes for your reviewer**:

**Release note**: 
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2017-10-19 16:50:58 -07:00
committed by GitHub
4 changed files with 24 additions and 13 deletions

View File

@@ -332,13 +332,13 @@ func podScheduled(c clientset.Interface, podNamespace, podName string) wait.Cond
// waitForPodToScheduleWithTimeout waits for a pod to get scheduled and returns
// an error if it does not scheduled within the given timeout.
func waitForPodToScheduleWithTimeout(cs clientset.Interface, pod *v1.Pod, timeout time.Duration) error {
return wait.Poll(time.Second, timeout, podScheduled(cs, pod.Namespace, pod.Name))
return wait.Poll(100*time.Millisecond, timeout, podScheduled(cs, pod.Namespace, pod.Name))
}
// waitForPodToSchedule waits for a pod to get scheduled and returns an error if
// it does not scheduled within the timeout duration (30 seconds).
// it does not get scheduled within the timeout duration (30 seconds).
func waitForPodToSchedule(cs clientset.Interface, pod *v1.Pod) error {
return waitForPodToScheduleWithTimeout(cs, pod, wait.ForeverTestTimeout)
return waitForPodToScheduleWithTimeout(cs, pod, 30*time.Second)
}
// deletePod deletes the given pod in the given namespace.