From 6a33a653a1e674ef5263e428ea1628fa35ec8346 Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Sun, 5 Mar 2023 16:04:13 +0100 Subject: [PATCH 01/10] Add echo source for testing --- source/echo.go | 41 ++++++++++++++++++++++++++++++++++++++++ source/echo_test.go | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 source/echo.go create mode 100644 source/echo_test.go diff --git a/source/echo.go b/source/echo.go new file mode 100644 index 000000000..a79ef99f3 --- /dev/null +++ b/source/echo.go @@ -0,0 +1,41 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package source + +import ( + "context" + + "sigs.k8s.io/external-dns/endpoint" +) + +// echoSource is a Source that returns the endpoints passed in on creation. +type echoSource struct { + endpoints []*endpoint.Endpoint +} + +func (e *echoSource) AddEventHandler(ctx context.Context, handler func()) { +} + +// Endpoints returns all of the endpoints passed in on creation +func (e *echoSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) { + return e.endpoints, nil +} + +// NewEchoSource creates a new echoSource. +func NewEchoSource(endpoints []*endpoint.Endpoint) Source { + return &echoSource{endpoints: endpoints} +} diff --git a/source/echo_test.go b/source/echo_test.go new file mode 100644 index 000000000..aca6baafd --- /dev/null +++ b/source/echo_test.go @@ -0,0 +1,46 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package source + +import ( + "context" + "testing" + + "sigs.k8s.io/external-dns/endpoint" +) + +func TestEchoSourceReturnGivenSources(t *testing.T) { + startEndpoints := []*endpoint.Endpoint{{ + DNSName: "foo.bar.com", + RecordType: "A", + Targets: endpoint.Targets{"1.2.3.4"}, + RecordTTL: endpoint.TTL(300), + Labels: endpoint.Labels{}, + }} + e := NewEchoSource(startEndpoints) + + endpoints, err := e.Endpoints(context.Background()) + if err != nil { + t.Errorf("Expected no error but got %s", err.Error()) + } + + for i, endpoint := range endpoints { + if endpoint != startEndpoints[i] { + t.Errorf("Expected %s but got %s", startEndpoints[i], endpoint) + } + } +} From 98fe58b27e7b5bcd44acfec65393f2c7014ee76b Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Sun, 5 Mar 2023 16:04:29 +0100 Subject: [PATCH 02/10] Add tests for targetfiltersource --- source/targerfiltersource_test.go | 140 ++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 source/targerfiltersource_test.go diff --git a/source/targerfiltersource_test.go b/source/targerfiltersource_test.go new file mode 100644 index 000000000..9d951941d --- /dev/null +++ b/source/targerfiltersource_test.go @@ -0,0 +1,140 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package source + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/net/context" + + "sigs.k8s.io/external-dns/endpoint" +) + +func TestTargetFilterSource(t *testing.T) { + t.Parallel() + + t.Run("Interface", TestTargetFilterSourceImplementsSource) + t.Run("Endpoints", TestTargetFilterSourceEndpoints) +} + +// TestTargetFilterSourceImplementsSource tests that targetFilterSource is a valid Source. +func TestTargetFilterSourceImplementsSource(t *testing.T) { + assert.Implements(t, (*Source)(nil), new(targetFilterSource)) +} + +func TestTargetFilterSourceEndpoints(t *testing.T) { + t.Parallel() + + tests := []struct { + title string + filters endpoint.TargetFilterInterface + endpoints []*endpoint.Endpoint + expected []*endpoint.Endpoint + }{ + { + title: "no filters", + filters: endpoint.NewTargetNetFilter(nil), + endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + }, + { + title: "filter matched specific", + filters: endpoint.NewTargetNetFilter([]string{"1.2.3.4"}), + endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + }, + { + title: "filter matched net", + filters: endpoint.NewTargetNetFilter([]string{"1.2.3.0/24"}), + endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + }, + { + title: "filter not matched specific", + filters: endpoint.NewTargetNetFilter([]string{"1.2.3.5/32"}), + endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + expected: []*endpoint.Endpoint{}, + }, + { + title: "filter not matched net", + filters: endpoint.NewTargetNetFilter([]string{"1.2.4.0/24"}), + endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, + expected: []*endpoint.Endpoint{}, + }, + { + title: "filter not matched CNAME endpoint", + filters: endpoint.NewTargetNetFilter([]string{"1.2.4.0/24"}), + endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "CNAME", "foo.bar")}, + expected: []*endpoint.Endpoint{}, + }, + { + title: "filter matched one of two", + filters: endpoint.NewTargetNetFilter([]string{"1.2.4.0/24"}), + endpoints: []*endpoint.Endpoint{ + endpoint.NewEndpoint("foo", "CNAME", "foo.bar"), + endpoint.NewEndpoint("foo", "A", "1.2.4.1")}, + expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.4.1")}, + }, + { + title: "filter exclusion all", + filters: endpoint.NewTargetNetFilterWithExclusions( + []string{""}, + []string{"1.0.0.0/8"}), + endpoints: []*endpoint.Endpoint{ + endpoint.NewEndpoint("foo", "A", "1.2.3.4"), + endpoint.NewEndpoint("foo", "A", "1.2.3.5"), + endpoint.NewEndpoint("foo", "A", "1.2.3.6"), + endpoint.NewEndpoint("foo", "A", "1.3.4.5"), + endpoint.NewEndpoint("foo", "A", "1.4.4.5")}, + expected: []*endpoint.Endpoint{}, + }, + { + title: "filter exclude internal net", + filters: endpoint.NewTargetNetFilterWithExclusions( + []string{""}, + []string{"10.0.0.0/8"}), + endpoints: []*endpoint.Endpoint{ + endpoint.NewEndpoint("foo", "A", "10.0.0.1"), + endpoint.NewEndpoint("foo", "A", "8.8.8.8")}, + expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "8.8.8.8")}, + }, + { + title: "filter only internal", + filters: endpoint.NewTargetNetFilterWithExclusions( + []string{"10.0.0.0/8"}, []string{}), + endpoints: []*endpoint.Endpoint{ + endpoint.NewEndpoint("foo", "A", "10.0.0.1"), + endpoint.NewEndpoint("foo", "A", "8.8.8.8")}, + expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "10.0.0.1")}, + }, + } + for _, tt := range tests { + tt := tt + t.Run(tt.title, func(t *testing.T) { + t.Parallel() + + echo := NewEchoSource(tt.endpoints) + src := NewTargetFilterSource(echo, tt.filters) + + endpoints, err := src.Endpoints(context.Background()) + require.NoError(t, err, "failed to get Endpoints") + validateEndpoints(t, endpoints, tt.expected) + }) + } +} From af7b072405e1ee5ba9521baef06bdb9e50597918 Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Sun, 5 Mar 2023 16:04:43 +0100 Subject: [PATCH 03/10] Filter out endpoints if targetfiltersource filters out all targets --- source/targetfiltersource.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/targetfiltersource.go b/source/targetfiltersource.go index 5c95ecfda..24d6c56e4 100644 --- a/source/targetfiltersource.go +++ b/source/targetfiltersource.go @@ -52,6 +52,11 @@ func (ms *targetFilterSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoi } } + // If all targets are filtered out, skip the endpoint. + if len(filteredTargets) == 0 { + continue + } + ep.Targets = filteredTargets result = append(result, ep) From e3fbc7eb30aaa76fc7699a267171bf3d5fd06e1b Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Sun, 5 Mar 2023 16:32:15 +0100 Subject: [PATCH 04/10] Add logs --- source/targetfiltersource.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/targetfiltersource.go b/source/targetfiltersource.go index 24d6c56e4..daf0e1bfc 100644 --- a/source/targetfiltersource.go +++ b/source/targetfiltersource.go @@ -19,6 +19,7 @@ package source import ( "context" + log "github.com/sirupsen/logrus" "sigs.k8s.io/external-dns/endpoint" ) @@ -54,6 +55,7 @@ func (ms *targetFilterSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoi // If all targets are filtered out, skip the endpoint. if len(filteredTargets) == 0 { + log.WithField("endpoint", ep).Debugf("Skipping endpoint because all targets were filtered out") continue } From 8533cb229a921d4efef0bf958cb9bc96245733c0 Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Tue, 9 May 2023 11:11:56 +0200 Subject: [PATCH 05/10] Fix file name spelling --- source/{targerfiltersource_test.go => targetfiltersource_test.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename source/{targerfiltersource_test.go => targetfiltersource_test.go} (100%) diff --git a/source/targerfiltersource_test.go b/source/targetfiltersource_test.go similarity index 100% rename from source/targerfiltersource_test.go rename to source/targetfiltersource_test.go From d7d5a2d404a903f4a0a125ba56848363e6f21f15 Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Wed, 17 May 2023 15:47:14 +0200 Subject: [PATCH 06/10] Move echoSource into targetfiltersource_test.go --- source/echo.go | 41 --------------------------- source/echo_test.go | 46 ------------------------------- source/targetfiltersource_test.go | 41 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 87 deletions(-) delete mode 100644 source/echo.go delete mode 100644 source/echo_test.go diff --git a/source/echo.go b/source/echo.go deleted file mode 100644 index a79ef99f3..000000000 --- a/source/echo.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2023 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package source - -import ( - "context" - - "sigs.k8s.io/external-dns/endpoint" -) - -// echoSource is a Source that returns the endpoints passed in on creation. -type echoSource struct { - endpoints []*endpoint.Endpoint -} - -func (e *echoSource) AddEventHandler(ctx context.Context, handler func()) { -} - -// Endpoints returns all of the endpoints passed in on creation -func (e *echoSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) { - return e.endpoints, nil -} - -// NewEchoSource creates a new echoSource. -func NewEchoSource(endpoints []*endpoint.Endpoint) Source { - return &echoSource{endpoints: endpoints} -} diff --git a/source/echo_test.go b/source/echo_test.go deleted file mode 100644 index aca6baafd..000000000 --- a/source/echo_test.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package source - -import ( - "context" - "testing" - - "sigs.k8s.io/external-dns/endpoint" -) - -func TestEchoSourceReturnGivenSources(t *testing.T) { - startEndpoints := []*endpoint.Endpoint{{ - DNSName: "foo.bar.com", - RecordType: "A", - Targets: endpoint.Targets{"1.2.3.4"}, - RecordTTL: endpoint.TTL(300), - Labels: endpoint.Labels{}, - }} - e := NewEchoSource(startEndpoints) - - endpoints, err := e.Endpoints(context.Background()) - if err != nil { - t.Errorf("Expected no error but got %s", err.Error()) - } - - for i, endpoint := range endpoints { - if endpoint != startEndpoints[i] { - t.Errorf("Expected %s but got %s", startEndpoints[i], endpoint) - } - } -} diff --git a/source/targetfiltersource_test.go b/source/targetfiltersource_test.go index 9d951941d..207e8959f 100644 --- a/source/targetfiltersource_test.go +++ b/source/targetfiltersource_test.go @@ -26,6 +26,47 @@ import ( "sigs.k8s.io/external-dns/endpoint" ) +// echoSource is a Source that returns the endpoints passed in on creation. +type echoSource struct { + endpoints []*endpoint.Endpoint +} + +func (e *echoSource) AddEventHandler(ctx context.Context, handler func()) { +} + +// Endpoints returns all of the endpoints passed in on creation +func (e *echoSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) { + return e.endpoints, nil +} + +// NewEchoSource creates a new echoSource. +func NewEchoSource(endpoints []*endpoint.Endpoint) Source { + return &echoSource{endpoints: endpoints} +} + +func TestEchoSourceReturnGivenSources(t *testing.T) { + startEndpoints := []*endpoint.Endpoint{{ + DNSName: "foo.bar.com", + RecordType: "A", + Targets: endpoint.Targets{"1.2.3.4"}, + RecordTTL: endpoint.TTL(300), + Labels: endpoint.Labels{}, + }} + e := NewEchoSource(startEndpoints) + + endpoints, err := e.Endpoints(context.Background()) + if err != nil { + t.Errorf("Expected no error but got %s", err.Error()) + } + + for i, endpoint := range endpoints { + if endpoint != startEndpoints[i] { + t.Errorf("Expected %s but got %s", startEndpoints[i], endpoint) + } + } +} + + func TestTargetFilterSource(t *testing.T) { t.Parallel() From 05bb165ffaf886a775cfc951b6d3ca62eb36f51b Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Mon, 22 May 2023 16:17:36 +0200 Subject: [PATCH 07/10] Run tests via a Mock targetNetFilter instead of the actual one --- source/targetfiltersource_test.go | 82 ++++++++++--------------------- 1 file changed, 26 insertions(+), 56 deletions(-) diff --git a/source/targetfiltersource_test.go b/source/targetfiltersource_test.go index 207e8959f..19e552799 100644 --- a/source/targetfiltersource_test.go +++ b/source/targetfiltersource_test.go @@ -26,6 +26,26 @@ import ( "sigs.k8s.io/external-dns/endpoint" ) +type mockTargetNetFilter struct { + targets map[string]bool +} + +func NewMockTargetNetFilter(targets []string) endpoint.TargetFilterInterface { + targetMap := make(map[string]bool) + for _, target := range targets { + targetMap[target] = true + } + return &mockTargetNetFilter{targets: targetMap} +} + +func (m *mockTargetNetFilter) Match(target string) bool { + return m.targets[target] +} + +func (m *mockTargetNetFilter) IsConfigured() bool { + return true +} + // echoSource is a Source that returns the endpoints passed in on creation. type echoSource struct { endpoints []*endpoint.Endpoint @@ -66,7 +86,6 @@ func TestEchoSourceReturnGivenSources(t *testing.T) { } } - func TestTargetFilterSource(t *testing.T) { t.Parallel() @@ -89,54 +108,8 @@ func TestTargetFilterSourceEndpoints(t *testing.T) { expected []*endpoint.Endpoint }{ { - title: "no filters", - filters: endpoint.NewTargetNetFilter(nil), - endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - }, - { - title: "filter matched specific", - filters: endpoint.NewTargetNetFilter([]string{"1.2.3.4"}), - endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - }, - { - title: "filter matched net", - filters: endpoint.NewTargetNetFilter([]string{"1.2.3.0/24"}), - endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - }, - { - title: "filter not matched specific", - filters: endpoint.NewTargetNetFilter([]string{"1.2.3.5/32"}), - endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - expected: []*endpoint.Endpoint{}, - }, - { - title: "filter not matched net", - filters: endpoint.NewTargetNetFilter([]string{"1.2.4.0/24"}), - endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.3.4")}, - expected: []*endpoint.Endpoint{}, - }, - { - title: "filter not matched CNAME endpoint", - filters: endpoint.NewTargetNetFilter([]string{"1.2.4.0/24"}), - endpoints: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "CNAME", "foo.bar")}, - expected: []*endpoint.Endpoint{}, - }, - { - title: "filter matched one of two", - filters: endpoint.NewTargetNetFilter([]string{"1.2.4.0/24"}), - endpoints: []*endpoint.Endpoint{ - endpoint.NewEndpoint("foo", "CNAME", "foo.bar"), - endpoint.NewEndpoint("foo", "A", "1.2.4.1")}, - expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "1.2.4.1")}, - }, - { - title: "filter exclusion all", - filters: endpoint.NewTargetNetFilterWithExclusions( - []string{""}, - []string{"1.0.0.0/8"}), + title: "filter exclusion all", + filters: NewMockTargetNetFilter([]string{}), endpoints: []*endpoint.Endpoint{ endpoint.NewEndpoint("foo", "A", "1.2.3.4"), endpoint.NewEndpoint("foo", "A", "1.2.3.5"), @@ -146,19 +119,16 @@ func TestTargetFilterSourceEndpoints(t *testing.T) { expected: []*endpoint.Endpoint{}, }, { - title: "filter exclude internal net", - filters: endpoint.NewTargetNetFilterWithExclusions( - []string{""}, - []string{"10.0.0.0/8"}), + title: "filter exclude internal net", + filters: NewMockTargetNetFilter([]string{"8.8.8.8"}), endpoints: []*endpoint.Endpoint{ endpoint.NewEndpoint("foo", "A", "10.0.0.1"), endpoint.NewEndpoint("foo", "A", "8.8.8.8")}, expected: []*endpoint.Endpoint{endpoint.NewEndpoint("foo", "A", "8.8.8.8")}, }, { - title: "filter only internal", - filters: endpoint.NewTargetNetFilterWithExclusions( - []string{"10.0.0.0/8"}, []string{}), + title: "filter only internal", + filters: NewMockTargetNetFilter([]string{"10.0.0.1"}), endpoints: []*endpoint.Endpoint{ endpoint.NewEndpoint("foo", "A", "10.0.0.1"), endpoint.NewEndpoint("foo", "A", "8.8.8.8")}, From 42dde17b1baff56b5e84338616b060b6b0e06814 Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Thu, 29 Jun 2023 22:30:26 +0200 Subject: [PATCH 08/10] Remove unneeded IsConfigured() method --- source/targetfiltersource_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/targetfiltersource_test.go b/source/targetfiltersource_test.go index 19e552799..c5f48065b 100644 --- a/source/targetfiltersource_test.go +++ b/source/targetfiltersource_test.go @@ -42,10 +42,6 @@ func (m *mockTargetNetFilter) Match(target string) bool { return m.targets[target] } -func (m *mockTargetNetFilter) IsConfigured() bool { - return true -} - // echoSource is a Source that returns the endpoints passed in on creation. type echoSource struct { endpoints []*endpoint.Endpoint From 3dbcb9cba18b8425279d1326990c3c34db03750a Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Thu, 29 Jun 2023 22:38:17 +0200 Subject: [PATCH 09/10] Simplify interface implementation test for targetFilterSource --- source/targetfiltersource_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/targetfiltersource_test.go b/source/targetfiltersource_test.go index c5f48065b..070d01dce 100644 --- a/source/targetfiltersource_test.go +++ b/source/targetfiltersource_test.go @@ -19,7 +19,6 @@ package source import ( "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/net/context" @@ -91,7 +90,7 @@ func TestTargetFilterSource(t *testing.T) { // TestTargetFilterSourceImplementsSource tests that targetFilterSource is a valid Source. func TestTargetFilterSourceImplementsSource(t *testing.T) { - assert.Implements(t, (*Source)(nil), new(targetFilterSource)) + var _ Source = &targetFilterSource{} } func TestTargetFilterSourceEndpoints(t *testing.T) { From c4df1b18c95ae28a2f2e42914673f20e497225dc Mon Sep 17 00:00:00 2001 From: Fredrik Larsson Date: Sat, 1 Jul 2023 14:11:49 +0200 Subject: [PATCH 10/10] Fix: File is not `goimports`-ed with -local --- source/targetfiltersource.go | 1 + 1 file changed, 1 insertion(+) diff --git a/source/targetfiltersource.go b/source/targetfiltersource.go index daf0e1bfc..e20273606 100644 --- a/source/targetfiltersource.go +++ b/source/targetfiltersource.go @@ -20,6 +20,7 @@ import ( "context" log "github.com/sirupsen/logrus" + "sigs.k8s.io/external-dns/endpoint" )