Adjust default timeout for e2e tests (#3495)
This commit is contained in:
parent
50b552da9f
commit
c3ff68e9ca
8 changed files with 25 additions and 38 deletions
|
@ -28,9 +28,7 @@ import (
|
||||||
"github.com/parnurzeal/gorequest"
|
"github.com/parnurzeal/gorequest"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||||
)
|
)
|
||||||
|
@ -269,22 +267,15 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
f.NewHttpbinDeployment()
|
f.NewHttpbinDeployment()
|
||||||
|
|
||||||
var httpbinIP string
|
var httpbinIP string
|
||||||
err := wait.PollImmediate(framework.Poll, 5*time.Minute, func() (bool, error) {
|
|
||||||
e, err := f.KubeClientSet.CoreV1().Endpoints(f.IngressController.Namespace).Get("httpbin", metav1.GetOptions{})
|
err := framework.WaitForEndpoints(f.KubeClientSet, framework.DefaultTimeout, "httpbin", f.IngressController.Namespace)
|
||||||
if errors.IsNotFound(err) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
if len(e.Subsets) < 1 || len(e.Subsets[0].Addresses) < 1 {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
httpbinIP = e.Subsets[0].Addresses[0].IP
|
|
||||||
return true, nil
|
|
||||||
})
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
e, err := f.KubeClientSet.CoreV1().Endpoints(f.IngressController.Namespace).Get("httpbin", metav1.GetOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
httpbinIP = e.Subsets[0].Addresses[0].IP
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/auth-url": fmt.Sprintf("http://%s/basic-auth/user/password", httpbinIP),
|
"nginx.ingress.kubernetes.io/auth-url": fmt.Sprintf("http://%s/basic-auth/user/password", httpbinIP),
|
||||||
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
|
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
|
||||||
|
|
|
@ -123,6 +123,6 @@ func (f *Framework) NewDeployment(name, image string, port int32, replicas int32
|
||||||
s := f.EnsureService(service)
|
s := f.EnsureService(service)
|
||||||
Expect(s).NotTo(BeNil(), "expected a service but none returned")
|
Expect(s).NotTo(BeNil(), "expected a service but none returned")
|
||||||
|
|
||||||
err = WaitForEndpoints(f.KubeClientSet, defaultTimeout, name, f.IngressController.Namespace)
|
err = WaitForEndpoints(f.KubeClientSet, DefaultTimeout, name, f.IngressController.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to wait for endpoints to become ready")
|
Expect(err).NotTo(HaveOccurred(), "failed to wait for endpoints to become ready")
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ func (f *Framework) BeforeEach() {
|
||||||
err = f.NewIngressController(f.IngressController.Namespace)
|
err = f.NewIngressController(f.IngressController.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
err = WaitForPodsReady(f.KubeClientSet, defaultTimeout, 1, f.IngressController.Namespace, metav1.ListOptions{
|
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.IngressController.Namespace, metav1.ListOptions{
|
||||||
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
|
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
@ -342,7 +342,7 @@ func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = WaitForPodsReady(kubeClientSet, defaultTimeout, replicas, namespace, metav1.ListOptions{
|
err = WaitForPodsReady(kubeClientSet, DefaultTimeout, replicas, namespace, metav1.ListOptions{
|
||||||
LabelSelector: fields.SelectorFromSet(fields.Set(deployment.Spec.Template.ObjectMeta.Labels)).String(),
|
LabelSelector: fields.SelectorFromSet(fields.Set(deployment.Spec.Template.ObjectMeta.Labels)).String(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -17,8 +17,6 @@ limitations under the License.
|
||||||
package framework
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
@ -79,7 +77,7 @@ func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(d).NotTo(BeNil(), "expected a fortune-teller deployment")
|
Expect(d).NotTo(BeNil(), "expected a fortune-teller deployment")
|
||||||
|
|
||||||
err = WaitForPodsReady(f.KubeClientSet, 5*time.Minute, int(replicas), f.IngressController.Namespace, metav1.ListOptions{
|
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.IngressController.Namespace, metav1.ListOptions{
|
||||||
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to wait for to become ready")
|
Expect(err).NotTo(HaveOccurred(), "failed to wait for to become ready")
|
||||||
|
|
|
@ -17,8 +17,6 @@ limitations under the License.
|
||||||
package framework
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
@ -142,7 +140,7 @@ func (f *Framework) NewInfluxDBDeployment() {
|
||||||
|
|
||||||
Expect(d).NotTo(BeNil(), "unexpected error creating deployement for influxdb")
|
Expect(d).NotTo(BeNil(), "unexpected error creating deployement for influxdb")
|
||||||
|
|
||||||
err = WaitForPodsReady(f.KubeClientSet, 5*time.Minute, 1, f.IngressController.Namespace, metav1.ListOptions{
|
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.IngressController.Namespace, metav1.ListOptions{
|
||||||
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to wait for influxdb to become ready")
|
Expect(err).NotTo(HaveOccurred(), "failed to wait for influxdb to become ready")
|
||||||
|
|
|
@ -143,7 +143,7 @@ func CreateIngressMASecret(client kubernetes.Interface, host string, secretName,
|
||||||
|
|
||||||
// WaitForTLS waits until the TLS handshake with a given server completes successfully.
|
// WaitForTLS waits until the TLS handshake with a given server completes successfully.
|
||||||
func WaitForTLS(url string, tlsConfig *tls.Config) {
|
func WaitForTLS(url string, tlsConfig *tls.Config) {
|
||||||
err := wait.Poll(Poll, 30*time.Second, matchTLSServerName(url, tlsConfig))
|
err := wait.Poll(Poll, DefaultTimeout, matchTLSServerName(url, tlsConfig))
|
||||||
Expect(err).NotTo(HaveOccurred(), "timeout waiting for TLS configuration in URL %s", url)
|
Expect(err).NotTo(HaveOccurred(), "timeout waiting for TLS configuration in URL %s", url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ const (
|
||||||
// Poll how often to poll for conditions
|
// Poll how often to poll for conditions
|
||||||
Poll = 2 * time.Second
|
Poll = 2 * time.Second
|
||||||
|
|
||||||
// Default time to wait for operations to complete
|
// DefaultTimeout time to wait for operations to complete
|
||||||
defaultTimeout = 30 * time.Second
|
DefaultTimeout = 5 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
func nowStamp() string {
|
func nowStamp() string {
|
||||||
|
@ -109,7 +109,7 @@ func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error
|
||||||
}
|
}
|
||||||
// Be robust about making the namespace creation call.
|
// Be robust about making the namespace creation call.
|
||||||
var got *v1.Namespace
|
var got *v1.Namespace
|
||||||
err := wait.PollImmediate(Poll, defaultTimeout, func() (bool, error) {
|
err := wait.PollImmediate(Poll, DefaultTimeout, func() (bool, error) {
|
||||||
var err error
|
var err error
|
||||||
got, err = c.CoreV1().Namespaces().Create(ns)
|
got, err = c.CoreV1().Namespaces().Create(ns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -140,7 +140,7 @@ func ExpectNoError(err error, explain ...interface{}) {
|
||||||
|
|
||||||
// WaitForKubeNamespaceNotExist waits until a namespaces is not present in the cluster
|
// WaitForKubeNamespaceNotExist waits until a namespaces is not present in the cluster
|
||||||
func WaitForKubeNamespaceNotExist(c kubernetes.Interface, namespace string) error {
|
func WaitForKubeNamespaceNotExist(c kubernetes.Interface, namespace string) error {
|
||||||
return wait.PollImmediate(Poll, time.Minute*5, namespaceNotExist(c, namespace))
|
return wait.PollImmediate(Poll, DefaultTimeout, namespaceNotExist(c, namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
func namespaceNotExist(c kubernetes.Interface, namespace string) wait.ConditionFunc {
|
func namespaceNotExist(c kubernetes.Interface, namespace string) wait.ConditionFunc {
|
||||||
|
@ -158,7 +158,7 @@ func namespaceNotExist(c kubernetes.Interface, namespace string) wait.ConditionF
|
||||||
|
|
||||||
// WaitForNoPodsInNamespace waits until there are no pods running in a namespace
|
// WaitForNoPodsInNamespace waits until there are no pods running in a namespace
|
||||||
func WaitForNoPodsInNamespace(c kubernetes.Interface, namespace string) error {
|
func WaitForNoPodsInNamespace(c kubernetes.Interface, namespace string) error {
|
||||||
return wait.PollImmediate(Poll, time.Minute*5, noPodsInNamespace(c, namespace))
|
return wait.PollImmediate(Poll, DefaultTimeout, noPodsInNamespace(c, namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
func noPodsInNamespace(c kubernetes.Interface, namespace string) wait.ConditionFunc {
|
func noPodsInNamespace(c kubernetes.Interface, namespace string) wait.ConditionFunc {
|
||||||
|
@ -184,16 +184,16 @@ func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *v1.Pod) error {
|
||||||
if pod.Status.Phase == v1.PodRunning {
|
if pod.Status.Phase == v1.PodRunning {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return waitTimeoutForPodRunningInNamespace(c, pod.Name, pod.Namespace, defaultTimeout)
|
return waitTimeoutForPodRunningInNamespace(c, pod.Name, pod.Namespace, DefaultTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitTimeoutForPodRunningInNamespace(c kubernetes.Interface, podName, namespace string, timeout time.Duration) error {
|
func waitTimeoutForPodRunningInNamespace(c kubernetes.Interface, podName, namespace string, timeout time.Duration) error {
|
||||||
return wait.PollImmediate(Poll, defaultTimeout, podRunning(c, podName, namespace))
|
return wait.PollImmediate(Poll, DefaultTimeout, podRunning(c, podName, namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForSecretInNamespace waits a default amount of time for the specified secret is present in a particular namespace
|
// WaitForSecretInNamespace waits a default amount of time for the specified secret is present in a particular namespace
|
||||||
func WaitForSecretInNamespace(c kubernetes.Interface, namespace, name string) error {
|
func WaitForSecretInNamespace(c kubernetes.Interface, namespace, name string) error {
|
||||||
return wait.PollImmediate(1*time.Second, time.Minute*2, secretInNamespace(c, namespace, name))
|
return wait.PollImmediate(Poll, DefaultTimeout, secretInNamespace(c, namespace, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
func secretInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
|
func secretInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
|
||||||
|
@ -215,7 +215,7 @@ func secretInNamespace(c kubernetes.Interface, namespace, name string) wait.Cond
|
||||||
|
|
||||||
// WaitForFileInFS waits a default amount of time for the specified file is present in the filesystem
|
// WaitForFileInFS waits a default amount of time for the specified file is present in the filesystem
|
||||||
func WaitForFileInFS(file string, fs file.Filesystem) error {
|
func WaitForFileInFS(file string, fs file.Filesystem) error {
|
||||||
return wait.PollImmediate(1*time.Second, time.Minute*2, fileInFS(file, fs))
|
return wait.PollImmediate(Poll, DefaultTimeout, fileInFS(file, fs))
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileInFS(file string, fs file.Filesystem) wait.ConditionFunc {
|
func fileInFS(file string, fs file.Filesystem) wait.ConditionFunc {
|
||||||
|
@ -239,7 +239,7 @@ func fileInFS(file string, fs file.Filesystem) wait.ConditionFunc {
|
||||||
|
|
||||||
// WaitForNoIngressInNamespace waits until there is no ingress object in a particular namespace
|
// WaitForNoIngressInNamespace waits until there is no ingress object in a particular namespace
|
||||||
func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string) error {
|
func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string) error {
|
||||||
return wait.PollImmediate(1*time.Second, time.Minute*2, noIngressInNamespace(c, namespace, name))
|
return wait.PollImmediate(Poll, DefaultTimeout, noIngressInNamespace(c, namespace, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
|
func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
|
||||||
|
@ -261,7 +261,7 @@ func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.C
|
||||||
|
|
||||||
// WaitForIngressInNamespace waits until a particular ingress object exists namespace
|
// WaitForIngressInNamespace waits until a particular ingress object exists namespace
|
||||||
func WaitForIngressInNamespace(c kubernetes.Interface, namespace, name string) error {
|
func WaitForIngressInNamespace(c kubernetes.Interface, namespace, name string) error {
|
||||||
return wait.PollImmediate(1*time.Second, time.Minute*2, ingressInNamespace(c, namespace, name))
|
return wait.PollImmediate(Poll, DefaultTimeout, ingressInNamespace(c, namespace, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
|
func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
|
||||||
|
|
|
@ -109,7 +109,7 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = wait.Poll(10*time.Second, time.Minute*3, func() (done bool, err error) {
|
err = wait.Poll(10*time.Second, framework.DefaultTimeout, func() (done bool, err error) {
|
||||||
ing, err = f.KubeClientSet.Extensions().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err = f.KubeClientSet.Extensions().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
|
Loading…
Reference in a new issue