Merge pull request #52724 from shyamjvs/fix-density-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>..

Retry if possible while creating latency pods in density test

Saw the [last run](https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-kubernetes-e2e-gce-scale-performance/37) of density test on 5k-node fail due to it:

```
Expected error:
    <*errors.StatusError | 0xc44f2fd7a0>: {
        ErrStatus: {
            TypeMeta: {Kind: "", APIVersion: ""},
            ListMeta: {SelfLink: "", ResourceVersion: "", Continue: ""},
            Status: "Failure",
            Message: "timeout",
            Reason: "",
            Details: nil,
            Code: 500,
        },
    }
    timeout
not to have occurred
```

cc @kubernetes/sig-scalability-misc
pull/6/head
Kubernetes Submit Queue 2017-09-20 18:49:36 -07:00 committed by GitHub
commit 9505c01f54
2 changed files with 10 additions and 2 deletions

View File

@ -23,6 +23,7 @@ go_library(
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",

View File

@ -26,6 +26,7 @@ import (
"time"
"k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
@ -53,6 +54,7 @@ const (
MinSaturationThreshold = 2 * time.Minute
MinPodsPerSecondThroughput = 8
DensityPollInterval = 10 * time.Second
MaxLatencyPodCreationTries = 5
)
// Maximum container failures this test tolerates before failing.
@ -819,8 +821,13 @@ func createRunningPodFromRC(wg *sync.WaitGroup, c clientset.Interface, name, ns,
},
},
}
_, err := c.Core().ReplicationControllers(ns).Create(rc)
framework.ExpectNoError(err)
for attempt := 1; attempt <= MaxLatencyPodCreationTries; attempt++ {
_, err := c.Core().ReplicationControllers(ns).Create(rc)
if err == nil || apierrs.IsAlreadyExists(err) {
break
}
Expect(attempt < MaxLatencyPodCreationTries && framework.IsRetryableAPIError(err)).To(Equal(true))
}
framework.ExpectNoError(framework.WaitForControlledPodsRunning(c, ns, name, api.Kind("ReplicationController")))
framework.Logf("Found pod '%s' running", name)
}