Skip to content

Commit

Permalink
Merge pull request #2853 from ElvinEfendi/improve-e2e-test
Browse files Browse the repository at this point in the history
improve annotations/default_backend e2e test
  • Loading branch information
k8s-ci-robot authored Jul 27, 2018
2 parents d263577 + 576baa8 commit 5cc185e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/e2e/annotations/default_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ package annotations

import (
"fmt"
"net/http"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest"

"k8s.io/ingress-nginx/test/e2e/framework"
)
Expand Down Expand Up @@ -49,10 +51,23 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f

err = f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring(fmt.Sprintf("server_name %v", host))) &&
Expect(server).Should(ContainSubstring("proxy_pass http://custom-default-backend"))
return Expect(server).Should(ContainSubstring(fmt.Sprintf("server_name %v", host)))
})
Expect(err).NotTo(HaveOccurred())

uri := "/alma/armud"
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+uri).
Set("Host", host).
End()

Expect(len(errs)).Should(BeNumerically("==", 0))
Expect(resp.StatusCode).Should(Equal(http.StatusOK))

Expect(body).To(ContainSubstring("x-code=503"))
Expect(body).To(ContainSubstring(fmt.Sprintf("x-ingress-name=%s", host)))
Expect(body).To(ContainSubstring("x-service-name=invalid"))
Expect(body).To(ContainSubstring(fmt.Sprintf("x-original-uri=%s", uri)))
})
})
})

0 comments on commit 5cc185e

Please sign in to comment.