Remove hard-coded timeout in e2e tests

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-01-26 21:01:52 -03:00
parent d9983cb387
commit 68bfbd939b
10 changed files with 5 additions and 72 deletions

View file

@ -57,7 +57,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
@ -83,7 +82,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
@ -97,8 +95,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
ing.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/session-cookie-name"] = "OTHERCOOKIENAME"
f.EnsureIngress(ing)
time.Sleep(waitForLuaSync)
resp, _, errs = gorequest.New().
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
@ -123,7 +119,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/something").
@ -181,7 +176,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/something").
@ -218,7 +212,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
@ -254,7 +247,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/foo/bar").
@ -282,7 +274,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/foo/bar").
@ -313,7 +304,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, `location /foo/bar`) && strings.Contains(server, `location /foo`)
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/foo").
@ -347,7 +337,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
func(server string) bool {
return strings.Contains(server, "server_name _")
})
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).

View file

@ -19,7 +19,6 @@ package annotations
import (
"fmt"
"net/http"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -29,8 +28,6 @@ import (
)
const (
waitForLuaSync = 5 * time.Second
canaryService = "echo-canary"
)
@ -68,8 +65,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
resp, body, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
@ -96,8 +91,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
@ -135,7 +128,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("returning a 503 status when the mainline deployment has 0 replicas and a request is sent to the canary")
@ -189,8 +182,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("routing requests destined for the mainline ingress to the maineline upstream")
resp, body, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
@ -230,8 +221,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
@ -290,8 +279,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
modAnnotations := map[string]string{
"foo": "bar",
}
@ -354,8 +341,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
modCanaryAnnotations := map[string]string{
"nginx.ingress.kubernetes.io/canary": "true",
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader2",
@ -364,8 +349,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, modCanaryAnnotations)
f.EnsureIngress(modCanaryIng)
time.Sleep(waitForLuaSync)
By("routing requests destined for the mainline ingress to the mainline upstream")
resp, body, errs := gorequest.New().
@ -417,8 +400,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("routing requests to the canary upstream when header is set to 'always'")
resp, body, errs := gorequest.New().
@ -484,8 +465,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("routing requests to the canary upstream when header is set to 'DoCanary'")
resp, body, errs := gorequest.New().
@ -565,8 +544,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("routing requests to the canary upstream when header value does not match and cookie is set to 'always'")
resp, body, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
@ -605,8 +582,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("routing requests to the canary upstream when cookie is set to 'always'")
resp, body, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
@ -671,8 +646,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
By("returning requests from the mainline only when weight is equal to 0")
resp, body, errs := gorequest.New().
@ -696,8 +669,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
f.EnsureIngress(modCanaryIng)
time.Sleep(waitForLuaSync)
resp, body, errs = gorequest.New().
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
@ -751,8 +722,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
ing = framework.NewSingleIngress(otherHost, "/", otherHost, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
time.Sleep(waitForLuaSync)
f.WaitForNginxConfiguration(func(cfg string) bool {
return Expect(cfg).Should(ContainSubstring("server_name "+otherHost)) &&
Expect(cfg).ShouldNot(ContainSubstring("server_name "+host))

View file

@ -19,7 +19,6 @@ package annotations
import (
"fmt"
"net/http"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -45,8 +44,6 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "invalid", 80, annotations)
f.EnsureIngress(ing)
time.Sleep(5 * time.Second)
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring(fmt.Sprintf("server_name %v", host)))

View file

@ -48,7 +48,7 @@ var _ = framework.IngressNginxDescribe("Custom Default Backend", func() {
return err
})
Expect(err).NotTo(HaveOccurred())
time.Sleep(1 * time.Second)
time.Sleep(5 * time.Second)
f.WaitForNginxServer("_",
func(server string) bool {

View file

@ -93,6 +93,8 @@ func (f *Framework) EnsureIngress(ingress *networking.Ingress) *networking.Ingre
ing.Annotations = make(map[string]string)
}
time.Sleep(5 * time.Second)
return ing
}

View file

@ -50,8 +50,6 @@ var _ = framework.IngressNginxDescribe("Shutdown ingress controller", func() {
return Expect(server).Should(ContainSubstring("server_name shutdown"))
})
time.Sleep(1 * time.Second)
resp, _, _ := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/sleep/1").
Set("Host", host).
@ -91,8 +89,6 @@ var _ = framework.IngressNginxDescribe("Shutdown ingress controller", func() {
return Expect(server).Should(ContainSubstring("server_name shutdown"))
})
time.Sleep(1 * time.Second)
result := make(chan *asyncResult)
startTime := time.Now()
@ -152,8 +148,6 @@ var _ = framework.IngressNginxDescribe("Shutdown ingress controller", func() {
return Expect(server).Should(ContainSubstring("server_name shutdown"))
})
time.Sleep(1 * time.Second)
result := make(chan *asyncResult)
startTime := time.Now()

View file

@ -18,7 +18,6 @@ package loadbalance
import (
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -26,10 +25,6 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const (
waitForLuaSync = 5 * time.Second
)
var _ = framework.IngressNginxDescribe("Load Balance - Configmap value", func() {
f := framework.NewDefaultFramework("lb-configmap")
@ -50,7 +45,6 @@ var _ = framework.IngressNginxDescribe("Load Balance - Configmap value", func()
func(server string) bool {
return strings.Contains(server, "server_name load-balance.com")
})
time.Sleep(waitForLuaSync)
algorithm, err := f.GetLbAlgorithm(framework.EchoService, 80)
Expect(err).Should(BeNil())

View file

@ -20,7 +20,6 @@ import (
"fmt"
"regexp"
"strings"
"time"
"github.com/parnurzeal/gorequest"
@ -47,7 +46,6 @@ var _ = framework.IngressNginxDescribe("Load Balance - EWMA", func() {
func(server string) bool {
return strings.Contains(server, "server_name load-balance.com")
})
time.Sleep(waitForLuaSync)
algorithm, err := f.GetLbAlgorithm(framework.EchoService, 80)
Expect(err).Should(BeNil())

View file

@ -73,7 +73,6 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
replicas := 2
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, framework.EchoService, replicas, nil)
Expect(err).NotTo(HaveOccurred())
time.Sleep(waitForLuaSync)
ensureRequest(f, "foo.com")
@ -152,7 +151,6 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/load-balance"] = "round_robin"
_, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(ingress)
Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync)
ensureRequest(f, "foo.com")
@ -176,7 +174,6 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 3, nil)
Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync)
output, err = f.ExecIngressPod(curlCmd)
Expect(err).ToNot(HaveOccurred())
@ -186,7 +183,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
func ensureIngress(f *framework.Framework, host string, deploymentName string) *networking.Ingress {
ing := createIngress(f, host, deploymentName)
time.Sleep(waitForLuaSync)
ensureRequest(f, host)
return ing

View file

@ -21,7 +21,6 @@ import (
"fmt"
"net"
"strings"
"time"
"github.com/parnurzeal/gorequest"
@ -35,10 +34,6 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const (
waitForLuaSync = 5 * time.Second
)
var _ = framework.IngressNginxDescribe("TCP Feature", func() {
f := framework.NewDefaultFramework("tcp")
@ -167,8 +162,6 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
Update(config)
Expect(err).NotTo(HaveOccurred(), "unexpected error updating configmap")
time.Sleep(waitForLuaSync)
// Validate that the generated nginx config contains the expected `proxy_upstream_name` value
f.WaitForNginxConfiguration(
func(cfg string) bool {