mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-10 03:26:57 +02:00
Merge pull request #5013 from mloiseleur/fix/failing-test
chore(ci): fix failing test, upgrade to go 1.23.5 and linter to v1.63
This commit is contained in:
commit
d8d74ca6f2
2
.github/workflows/lint.yaml
vendored
2
.github/workflows/lint.yaml
vendored
@ -33,7 +33,7 @@ jobs:
|
|||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v6
|
||||||
with:
|
with:
|
||||||
args: --timeout=30m
|
args: --timeout=30m
|
||||||
version: v1.60
|
version: v1.63
|
||||||
|
|
||||||
# Run Spectral
|
# Run Spectral
|
||||||
- name: Lint OpenAPI spec
|
- name: Lint OpenAPI spec
|
||||||
|
2
Makefile
2
Makefile
@ -41,7 +41,7 @@ CONTROLLER_GEN=$(shell which controller-gen)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
golangci-lint:
|
golangci-lint:
|
||||||
@command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3
|
@command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.63.4
|
||||||
|
|
||||||
# Run the golangci-lint tool
|
# Run the golangci-lint tool
|
||||||
.PHONY: go-lint
|
.PHONY: go-lint
|
||||||
|
@ -321,7 +321,7 @@ var domainFilterTests = []domainFilterTest{
|
|||||||
|
|
||||||
var regexDomainFilterTests = []regexDomainFilterTest{
|
var regexDomainFilterTests = []regexDomainFilterTest{
|
||||||
{
|
{
|
||||||
regexp.MustCompile("\\.org$"),
|
regexp.MustCompile(`\.org$`),
|
||||||
regexp.MustCompile(""),
|
regexp.MustCompile(""),
|
||||||
[]string{"foo.org", "bar.org", "foo.bar.org"},
|
[]string{"foo.org", "bar.org", "foo.bar.org"},
|
||||||
true,
|
true,
|
||||||
@ -330,7 +330,7 @@ var regexDomainFilterTests = []regexDomainFilterTest{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regexp.MustCompile("\\.bar\\.org$"),
|
regexp.MustCompile(`\.bar\.org$`),
|
||||||
regexp.MustCompile(""),
|
regexp.MustCompile(""),
|
||||||
[]string{"foo.org", "bar.org", "example.com"},
|
[]string{"foo.org", "bar.org", "example.com"},
|
||||||
false,
|
false,
|
||||||
@ -339,7 +339,7 @@ var regexDomainFilterTests = []regexDomainFilterTest{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regexp.MustCompile("(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`(?:foo|bar)\.org$`),
|
||||||
regexp.MustCompile(""),
|
regexp.MustCompile(""),
|
||||||
[]string{"foo.org", "bar.org", "example.foo.org", "example.bar.org", "a.example.foo.org", "a.example.bar.org"},
|
[]string{"foo.org", "bar.org", "example.foo.org", "example.bar.org", "a.example.foo.org", "a.example.bar.org"},
|
||||||
true,
|
true,
|
||||||
@ -348,18 +348,18 @@ var regexDomainFilterTests = []regexDomainFilterTest{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regexp.MustCompile("(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`(?:foo|bar)\.org$`),
|
||||||
regexp.MustCompile("^example\\.(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`^example\.(?:foo|bar)\.org$`),
|
||||||
[]string{"foo.org", "bar.org", "a.example.foo.org", "a.example.bar.org"},
|
[]string{"foo.org", "bar.org", "a.example.foo.org", "a.example.bar.org"},
|
||||||
true,
|
true,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"regexInclude": "(?:foo|bar)\\.org$",
|
"regexInclude": `(?:foo|bar)\.org$`,
|
||||||
"regexExclude": "^example\\.(?:foo|bar)\\.org$",
|
"regexExclude": `^example\.(?:foo|bar)\.org$`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regexp.MustCompile("(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`(?:foo|bar)\.org$`),
|
||||||
regexp.MustCompile("^example\\.(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`^example\.(?:foo|bar)\.org$`),
|
||||||
[]string{"example.foo.org", "example.bar.org"},
|
[]string{"example.foo.org", "example.bar.org"},
|
||||||
false,
|
false,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
@ -368,8 +368,8 @@ var regexDomainFilterTests = []regexDomainFilterTest{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regexp.MustCompile("(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`(?:foo|bar)\.org$`),
|
||||||
regexp.MustCompile("^example\\.(?:foo|bar)\\.org$"),
|
regexp.MustCompile(`^example\.(?:foo|bar)\.org$`),
|
||||||
[]string{"foo.org", "bar.org", "a.example.foo.org", "a.example.bar.org"},
|
[]string{"foo.org", "bar.org", "a.example.foo.org", "a.example.bar.org"},
|
||||||
true,
|
true,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module sigs.k8s.io/external-dns
|
module sigs.k8s.io/external-dns
|
||||||
|
|
||||||
go 1.23.3
|
go 1.23.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/compute/metadata v0.6.0
|
cloud.google.com/go/compute/metadata v0.6.0
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package testutils
|
package testutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/netip"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
@ -122,3 +123,12 @@ func SameProviderSpecific(a, b endpoint.ProviderSpecific) bool {
|
|||||||
sort.Sort(byNames(sb))
|
sort.Sort(byNames(sb))
|
||||||
return reflect.DeepEqual(sa, sb)
|
return reflect.DeepEqual(sa, sb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewTargetsFromAddr convert an array of netip.Addr to Targets (array of string)
|
||||||
|
func NewTargetsFromAddr(targets []netip.Addr) endpoint.Targets {
|
||||||
|
t := make(endpoint.Targets, len(targets))
|
||||||
|
for i, target := range targets {
|
||||||
|
t[i] = target.String()
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
@ -45,7 +45,7 @@ func (s *nat64Source) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if pPrefix.Bits() != 96 {
|
if pPrefix.Bits() != 96 {
|
||||||
return nil, fmt.Errorf("NAT64 prefixes need to be /96 prefixes.")
|
return nil, fmt.Errorf("NAT64 prefixes need to be /96 prefixes")
|
||||||
}
|
}
|
||||||
parsedNAT64Prefixes = append(parsedNAT64Prefixes, pPrefix)
|
parsedNAT64Prefixes = append(parsedNAT64Prefixes, pPrefix)
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ func (s *nat64Source) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, erro
|
|||||||
|
|
||||||
v4Addr, isOk := netip.AddrFromSlice(v4AddrBytes)
|
v4Addr, isOk := netip.AddrFromSlice(v4AddrBytes)
|
||||||
if !isOk {
|
if !isOk {
|
||||||
return nil, fmt.Errorf("Could not parse %v to IPv4 address", v4AddrBytes)
|
return nil, fmt.Errorf("could not parse %v to IPv4 address", v4AddrBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
v4Targets = append(v4Targets, v4Addr.String())
|
v4Targets = append(v4Targets, v4Addr.String())
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
|
|
||||||
"sigs.k8s.io/external-dns/endpoint"
|
"sigs.k8s.io/external-dns/endpoint"
|
||||||
|
"sigs.k8s.io/external-dns/internal/testutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServiceSuite struct {
|
type ServiceSuite struct {
|
||||||
@ -411,8 +412,8 @@ func testServiceSourceEndpoints(t *testing.T) {
|
|||||||
serviceTypesFilter: []string{},
|
serviceTypesFilter: []string{},
|
||||||
resolveLoadBalancerHostname: true,
|
resolveLoadBalancerHostname: true,
|
||||||
expected: []*endpoint.Endpoint{
|
expected: []*endpoint.Endpoint{
|
||||||
{DNSName: "foo.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.Targets{exampleDotComIP4[0].String()}},
|
{DNSName: "foo.example.org", RecordType: endpoint.RecordTypeA, Targets: testutils.NewTargetsFromAddr(exampleDotComIP4)},
|
||||||
{DNSName: "foo.example.org", RecordType: endpoint.RecordTypeAAAA, Targets: endpoint.Targets{exampleDotComIP6[0].String()}},
|
{DNSName: "foo.example.org", RecordType: endpoint.RecordTypeAAAA, Targets: testutils.NewTargetsFromAddr(exampleDotComIP6)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user