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,19 +17,21 @@ limitations under the License.
package annotations
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"strings"
"github.com/onsi/ginkgo"
"k8s.io/ingress-nginx/test/e2e/framework"
)
var _ = framework.DescribeAnnotation("backend-protocol", func() {
f := framework.NewDefaultFramework("backendprotocol")
BeforeEach(func() {
f.NewEchoDeploymentWithReplicas(2)
ginkgo.BeforeEach(func() {
f.NewEchoDeployment()
})
It("should set backend protocol to https:// and use proxy_pass", func() {
ginkgo.It("should set backend protocol to https:// and use proxy_pass", func() {
host := "backendprotocol.foo.com"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "HTTPS",
@ -40,11 +42,11 @@ var _ = framework.DescribeAnnotation("backend-protocol", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("proxy_pass https://upstream_balancer;"))
return strings.Contains(server, "proxy_pass https://upstream_balancer;")
})
})
It("should set backend protocol to grpc:// and use grpc_pass", func() {
ginkgo.It("should set backend protocol to grpc:// and use grpc_pass", func() {
host := "backendprotocol.foo.com"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
@ -55,11 +57,11 @@ var _ = framework.DescribeAnnotation("backend-protocol", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("grpc_pass grpc://upstream_balancer;"))
return strings.Contains(server, "grpc_pass grpc://upstream_balancer;")
})
})
It("should set backend protocol to grpcs:// and use grpc_pass", func() {
ginkgo.It("should set backend protocol to grpcs:// and use grpc_pass", func() {
host := "backendprotocol.foo.com"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "GRPCS",
@ -70,11 +72,11 @@ var _ = framework.DescribeAnnotation("backend-protocol", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("grpc_pass grpcs://upstream_balancer;"))
return strings.Contains(server, "grpc_pass grpcs://upstream_balancer;")
})
})
It("should set backend protocol to '' and use fastcgi_pass", func() {
ginkgo.It("should set backend protocol to '' and use fastcgi_pass", func() {
host := "backendprotocol.foo.com"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "FCGI",
@ -85,11 +87,11 @@ var _ = framework.DescribeAnnotation("backend-protocol", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("fastcgi_pass upstream_balancer;"))
return strings.Contains(server, "fastcgi_pass upstream_balancer;")
})
})
It("should set backend protocol to '' and use ajp_pass", func() {
ginkgo.It("should set backend protocol to '' and use ajp_pass", func() {
host := "backendprotocol.foo.com"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "AJP",
@ -100,7 +102,7 @@ var _ = framework.DescribeAnnotation("backend-protocol", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("ajp_pass upstream_balancer;"))
return strings.Contains(server, "ajp_pass upstream_balancer;")
})
})
})