Skip to content

Commit

Permalink
dag: add RegexRoute test
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Cheney <dave@cheney.net>
  • Loading branch information
davecheney committed Aug 2, 2019
1 parent 988b948 commit 3c4476e
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions internal/dag/builder_test.go
Expand Up @@ -537,6 +537,28 @@ func TestDAGInsert(t *testing.T) {
},
}

i15 := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "regex",
Namespace: "default",
},
Spec: v1beta1.IngressSpec{
Rules: []v1beta1.IngressRule{{
IngressRuleValue: v1beta1.IngressRuleValue{
HTTP: &v1beta1.HTTPIngressRuleValue{
Paths: []v1beta1.HTTPIngressPath{{
Path: "/[^/]+/invoices(/.*|/?)", // issue 1243
Backend: v1beta1.IngressBackend{
ServiceName: "kuard",
ServicePort: intstr.FromString("http"),
},
}},
},
},
}},
},
}

// s3a and b have http/2 protocol annotations
s3a := &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -2566,6 +2588,25 @@ func TestDAGInsert(t *testing.T) {
},
),
},
"insert ingressroute with regex route": {
objs: []interface{}{
i15,
s1,
},
want: listeners(
&Listener{
Port: 80,
VirtualHosts: virtualhosts(
virtualhost("*", &RegexRoute{
Regex: "/[^/]+/invoices(/.*|/?)",
Route: Route{
Clusters: clustermap(s1),
},
}),
),
},
),
},
"insert ingress overlay": {
objs: []interface{}{
i13a, i13b, sec13, s13a, s13b,
Expand Down

0 comments on commit 3c4476e

Please sign in to comment.