Merge pull request #64994 from cheftako/aggrDelay

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>.

Extended e2e/aggr test wait on sample-apiserver

**What this PR does / why we need it**:
The e2e/aggegator test usually passes. When it does it seems
to take almost 30 seconds for the sample-apiserver to start returning
2xx rather than 4xx to flunder requests. On the failing tests I looked
at it was taking almost 45 seconds for the sample-apiserver to become
healthy. I bumped the wait/timeout in the test for this case to 60
seconds. I also added a log statement to make it easier to track how
long it was taking for the sample-apiserver to come up. 

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

**Special notes for your reviewer**:
Once we have a bit more history I will log a bug for the long start up time.
We should also determine how far back we want to check compatibility. 
The current test is checking 1.7.

**Release note**:

```release-note
None
```
pull/8/head
Kubernetes Submit Queue 2018-06-12 06:48:50 -07:00 committed by GitHub
commit b15b18f932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -324,7 +324,7 @@ func TestSampleAPIServer(f *framework.Framework, image string) {
currentPods *v1.PodList
)
err = wait.Poll(100*time.Millisecond, 30*time.Second, func() (bool, error) {
err = pollTimed(100*time.Millisecond, 60*time.Second, func() (bool, error) {
currentAPIService, _ = aggrclient.ApiregistrationV1beta1().APIServices().Get("v1alpha1.wardle.k8s.io", metav1.GetOptions{})
currentPods, _ = client.CoreV1().Pods(namespace).List(metav1.ListOptions{})
@ -346,7 +346,7 @@ func TestSampleAPIServer(f *framework.Framework, image string) {
return false, err
}
return true, nil
})
}, "Waited %s for the sample-apiserver to be ready to handle requests.")
if err != nil {
currentAPIServiceJSON, _ := json.Marshal(currentAPIService)
framework.Logf("current APIService: %s", string(currentAPIServiceJSON))
@ -460,6 +460,17 @@ func TestSampleAPIServer(f *framework.Framework, image string) {
cleanTest(client, aggrclient, namespace)
}
// pollTimed will call Poll but time how long Poll actually took.
// It will then framework.logf the msg with the duration of the Poll.
// It is assumed that msg will contain one %s for the elapsed time.
func pollTimed(interval, timeout time.Duration, condition wait.ConditionFunc, msg string) error {
defer func(start time.Time, msg string) {
elapsed := time.Since(start)
framework.Logf(msg, elapsed)
}(time.Now(), msg)
return wait.Poll(interval, timeout, condition)
}
func validateErrorWithDebugInfo(f *framework.Framework, err error, pods *v1.PodList, msg string, fields ...interface{}) {
if err != nil {
namespace := f.Namespace.Name