Update tests for ingress class filtering

This commit is contained in:
Dave Salisbury 2021-10-02 15:23:48 +10:00
parent 8da6f99857
commit ac0c4be36a

View File

@ -1175,7 +1175,7 @@ func testIngressEndpoints(t *testing.T) {
{ {
title: "ingressClassName filtering", title: "ingressClassName filtering",
targetNamespace: "", targetNamespace: "",
ingressClassNameFilter: []string{"public"}, ingressClassNames: []string{"public", "dmz"},
ingressItems: []fakeIngress{ ingressItems: []fakeIngress{
{ {
name: "fake-public", name: "fake-public",
@ -1191,12 +1191,23 @@ func testIngressEndpoints(t *testing.T) {
ips: []string{"2.3.4.5"}, ips: []string{"2.3.4.5"},
ingressClassName: "internal", ingressClassName: "internal",
}, },
{
name: "fake-dmz",
namespace: namespace,
tlsdnsnames: [][]string{{"dmz.example.org"}},
ips: []string{"3.4.5.6"},
ingressClassName: "dmz",
},
}, },
expected: []*endpoint.Endpoint{ expected: []*endpoint.Endpoint{
{ {
DNSName: "example.org", DNSName: "example.org",
Targets: endpoint.Targets{"1.2.3.4"}, Targets: endpoint.Targets{"1.2.3.4"},
}, },
{
DNSName: "dmz.example.org",
Targets: endpoint.Targets{"3.4.5.6"},
},
}, },
}, },
} { } {
@ -1219,7 +1230,7 @@ func testIngressEndpoints(t *testing.T) {
ti.ignoreHostnameAnnotation, ti.ignoreHostnameAnnotation,
ti.ignoreIngressTLSSpec, ti.ignoreIngressTLSSpec,
ti.ignoreIngressRulesSpec, ti.ignoreIngressRulesSpec,
ti.ingressClassNameFilter, ti.ingressClassNames,
) )
// Informer cache has all of the ingresses. Retrieve and validate their endpoints. // Informer cache has all of the ingresses. Retrieve and validate their endpoints.
res, err := source.Endpoints(context.Background()) res, err := source.Endpoints(context.Background())