From 31bc5bb0778d9dd06ab93b0c26b08fd50eb5ddba Mon Sep 17 00:00:00 2001 From: Dave Salisbury Date: Sat, 2 Oct 2021 17:08:54 +1000 Subject: [PATCH] ingress source: fix broken NewIngressSource test and add an extra one for the mutual exclusivity of ingressClassNames and ingress.class annotationFilters --- source/ingress_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/ingress_test.go b/source/ingress_test.go index 9cf60d963..f79a7b222 100644 --- a/source/ingress_test.go +++ b/source/ingress_test.go @@ -100,6 +100,7 @@ func TestNewIngressSource(t *testing.T) { fqdnTemplate string combineFQDNAndAnnotation bool expectError bool + ingressClassNames []string }{ { title: "invalid template", @@ -131,6 +132,17 @@ func TestNewIngressSource(t *testing.T) { expectError: false, annotationFilter: "kubernetes.io/ingress.class=nginx", }, + { + title: "non-empty ingress class name list", + expectError: false, + ingressClassNames: []string{"internal", "external"}, + }, + { + title: "ingress class name and annotation filter jointly specified", + expectError: true, + ingressClassNames: []string{"internal", "external"}, + annotationFilter: "kubernetes.io/ingress.class=nginx", + }, } { ti := ti t.Run(ti.title, func(t *testing.T) { @@ -145,7 +157,7 @@ func TestNewIngressSource(t *testing.T) { false, false, false, - []string{}, + ti.ingressClassNames, ) if ti.expectError { assert.Error(t, err)