Fix nginx ingress variables for definitions with Backend
This commit is contained in:
parent
0b6d115236
commit
77234fcde0
3 changed files with 91 additions and 41 deletions
|
|
@ -22,6 +22,9 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
networking "k8s.io/api/networking/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||
)
|
||||
|
|
@ -49,4 +52,42 @@ var _ = framework.IngressNginxDescribe("[Ingress] definition without host", func
|
|||
Expect().
|
||||
Status(http.StatusOK)
|
||||
})
|
||||
|
||||
ginkgo.It("should set ingress details variables for ingresses with host without IngressRuleValue, only Backend", func() {
|
||||
f.NewEchoDeployment()
|
||||
|
||||
ing := &networking.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "backend",
|
||||
Namespace: f.Namespace,
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: framework.EchoService,
|
||||
ServicePort: intstr.FromInt(80),
|
||||
},
|
||||
Rules: []networking.IngressRule{
|
||||
{
|
||||
Host: "only-backend",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer("only-backend",
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, fmt.Sprintf(`set $namespace "%v";`, f.Namespace)) &&
|
||||
strings.Contains(server, fmt.Sprintf(`set $ingress_name "%v";`, ing.Name)) &&
|
||||
strings.Contains(server, fmt.Sprintf(`set $service_name "%v";`, framework.EchoService)) &&
|
||||
strings.Contains(server, `set $service_port "80";`) &&
|
||||
strings.Contains(server, `set $location_path "/";`)
|
||||
})
|
||||
|
||||
f.HTTPTestClient().
|
||||
GET("/").
|
||||
WithHeader("Host", "only-backend").
|
||||
Expect().
|
||||
Status(http.StatusOK)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue