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

@ -17,13 +17,11 @@ limitations under the License.
package defaultbackend
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"net/http"
"strings"
"github.com/parnurzeal/gorequest"
"github.com/onsi/ginkgo"
networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
@ -34,11 +32,11 @@ var _ = framework.IngressNginxDescribe("[Default Backend] change default setting
f := framework.NewDefaultFramework("default-backend-hosts")
host := "foo.com"
BeforeEach(func() {
f.NewEchoDeploymentWithReplicas(1)
ginkgo.BeforeEach(func() {
f.NewEchoDeployment()
})
It("should apply the annotation to the default backend", func() {
ginkgo.It("should apply the annotation to the default backend", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/proxy-buffer-size": "8k",
}
@ -69,13 +67,10 @@ var _ = framework.IngressNginxDescribe("[Default Backend] change default setting
return strings.Contains(server, "proxy_buffer_size 8k;")
})
resp, _, errs := gorequest.New().
Get(f.GetURL(framework.HTTP)).
Set("Host", "foo.com").
End()
Expect(errs).Should(BeEmpty())
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
f.HTTPTestClient().
GET("/").
WithHeader("Host", "foo.com").
Expect().
Status(http.StatusOK)
})
})