mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
Case insensitivity when comparing targets
This commit is contained in:
parent
6a7fb3a9a7
commit
0a9daa9e9b
@ -71,7 +71,7 @@ func (t Targets) Swap(i, j int) {
|
||||
t[i], t[j] = t[j], t[i]
|
||||
}
|
||||
|
||||
// Same compares to Targets and returns true if they are completely identical
|
||||
// Same compares to Targets and returns true if they are identical (case-insensitive)
|
||||
func (t Targets) Same(o Targets) bool {
|
||||
if len(t) != len(o) {
|
||||
return false
|
||||
@ -80,7 +80,7 @@ func (t Targets) Same(o Targets) bool {
|
||||
sort.Stable(o)
|
||||
|
||||
for i, e := range t {
|
||||
if e != o[i] {
|
||||
if !strings.EqualFold(e, o[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ func TestTargetsSame(t *testing.T) {
|
||||
{""},
|
||||
{"1.2.3.4"},
|
||||
{"8.8.8.8", "8.8.4.4"},
|
||||
{"example.org", "EXAMPLE.ORG"},
|
||||
}
|
||||
|
||||
for _, d := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user