Refactor e2e tests to use testify y httpexpect

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-02-19 00:08:56 -03:00
parent 046e2d959d
commit f9624cbe46
80 changed files with 2280 additions and 2631 deletions

View file

@ -21,21 +21,20 @@ import (
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest"
"github.com/onsi/ginkgo"
"k8s.io/ingress-nginx/test/e2e/framework"
)
var _ = framework.IngressNginxDescribe("[Shutdown] Graceful shutdown with pending request", func() {
f := framework.NewDefaultFramework("shutdown-slow-requests")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
f.NewSlowEchoDeployment()
f.UpdateNginxConfigMapData("worker-shutdown-timeout", "50s")
})
It("should let slow requests finish before shutting down", func() {
ginkgo.It("should let slow requests finish before shutting down", func() {
host := "graceful-shutdown"
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.SlowEchoService, 80, nil))
@ -47,13 +46,13 @@ var _ = framework.IngressNginxDescribe("[Shutdown] Graceful shutdown with pendin
done := make(chan bool)
go func() {
defer func() { done <- true }()
defer GinkgoRecover()
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)+"/sleep/30").
Set("Host", host).
End()
Expect(errs).To(BeNil())
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
defer ginkgo.GinkgoRecover()
f.HTTPTestClient().
GET("/sleep/30").
WithHeader("Host", host).
Expect().
Status(http.StatusOK)
}()
time.Sleep(1 * time.Second)