From 42e0c0abf70bd1b1a8d7519a80a89ae4d47e41c4 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Thu, 19 Apr 2018 23:14:30 -0300 Subject: [PATCH] Improve speed of e2e tests --- .gitignore | 3 ++- .travis.yml | 5 +++-- Makefile | 4 ++-- test/e2e/framework/exec.go | 2 +- test/e2e/framework/framework.go | 4 ++-- test/e2e/lua/dynamic_configuration.go | 2 +- test/manifests/ingress-controller/with-rbac.yaml | 1 + 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 8403f55d4..a421505ce 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,5 @@ Session.vim e2e-tests -coverage.txt \ No newline at end of file +coverage.txt +test/e2e/e2e\.test diff --git a/.travis.yml b/.travis.yml index c8a4410a8..9a50aa9a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,11 +47,12 @@ jobs: # start minikube - test/e2e/up.sh script: - - if ! go get github.com/jteeuwen/go-bindata/...; then github.com/jteeuwen/go-bindata/...;fi + - go get github.com/jteeuwen/go-bindata/... - make cover - stage: e2e before_script: - - if ! go get github.com/jteeuwen/go-bindata/...; then github.com/jteeuwen/go-bindata/...;fi + - go get github.com/jteeuwen/go-bindata/... + - go get github.com/onsi/ginkgo/ginkgo - make e2e-image - test/e2e/up.sh script: diff --git a/Makefile b/Makefile index 920b65ee6..382d0bdb9 100644 --- a/Makefile +++ b/Makefile @@ -158,8 +158,8 @@ e2e-image: sub-container-amd64 .PHONY: e2e-test e2e-test: - @go test -o e2e-tests -c ./test/e2e - @KUBECONFIG=${HOME}/.kube/config ./e2e-tests -alsologtostderr -test.v -logtostderr -ginkgo.trace + @ginkgo build ./test/e2e + @KUBECONFIG=${HOME}/.kube/config ginkgo -randomizeSuites -randomizeAllSpecs -flakeAttempts=2 -p -trace -nodes=2 ./test/e2e/e2e.test .PHONY: cover cover: diff --git a/test/e2e/framework/exec.go b/test/e2e/framework/exec.go index d587f3533..012abe14e 100644 --- a/test/e2e/framework/exec.go +++ b/test/e2e/framework/exec.go @@ -55,7 +55,7 @@ func (f *Framework) NewIngressController(namespace string) error { execErr bytes.Buffer ) - cmd := exec.Command("test/e2e/wait-for-nginx.sh", namespace) + cmd := exec.Command("./wait-for-nginx.sh", namespace) cmd.Stdout = &execOut cmd.Stderr = &execErr diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index f7cf443f0..9f4453373 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -237,12 +237,12 @@ func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) b } var pod *v1.Pod - Loop: + for _, p := range l.Items { if strings.HasPrefix(p.GetName(), "nginx-ingress-controller") { if isRunning, err := podRunningReady(&p); err == nil && isRunning { pod = &p - break Loop + break } } } diff --git a/test/e2e/lua/dynamic_configuration.go b/test/e2e/lua/dynamic_configuration.go index 99b9226d6..6c21b2407 100644 --- a/test/e2e/lua/dynamic_configuration.go +++ b/test/e2e/lua/dynamic_configuration.go @@ -52,7 +52,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() { Expect(err).NotTo(HaveOccurred()) Expect(ing).NotTo(BeNil()) - time.Sleep(5 * time.Second) + time.Sleep(10 * time.Second) err = f.WaitForNginxServer(host, func(server string) bool { diff --git a/test/manifests/ingress-controller/with-rbac.yaml b/test/manifests/ingress-controller/with-rbac.yaml index 0110b3c38..7cf030b93 100644 --- a/test/manifests/ingress-controller/with-rbac.yaml +++ b/test/manifests/ingress-controller/with-rbac.yaml @@ -24,6 +24,7 @@ spec: - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services - --udp-services-configmap=$(POD_NAMESPACE)/udp-services - --annotations-prefix=nginx.ingress.kubernetes.io + - --watch-namespace=$(POD_NAMESPACE) env: - name: POD_NAME valueFrom: