Skip to content

Commit

Permalink
Removing test using leading zeros when comparing hashes of IPv4 addre…
Browse files Browse the repository at this point in the history
…sses

as net.ParseIP function rejects IPv4 addresses which contain decimal
components with leading zeros as of Go 1.17 (#222)

References: https://go.dev/doc/go1.17
  • Loading branch information
bendbennett committed Aug 23, 2022
1 parent 9e898dc commit 43a6ad3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions internal/provider/hash_ip_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ import (
)

func TestHashIPString(t *testing.T) {
ipv4 := []string{"192.168.0.1", "192.168.000.001"}
ipv6 := []string{"fdd5:e282::dead:beef:cafe:babe", "FDD5:E282:0000:0000:DEAD:BEEF:CAFE:BABE"}
invalid := "not.an.ip.address"

if hashIPString(ipv4[0]) != hashIPString(ipv4[1]) {
t.Errorf("IPv4 values %s and %s should hash to the same value", ipv4[0], ipv4[1])
}

if hashIPString(ipv6[0]) != hashIPString(ipv6[1]) {
t.Errorf("IPv6 values %s and %s should hash to the same value", ipv6[0], ipv6[1])
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/resource_dns_a_record_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ var testAccDnsARecordSet_basic = fmt.Sprintf(`
resource "dns_a_record_set" "foo" {
zone = "example.com."
name = "foo"
addresses = ["192.168.000.001", "192.168.000.002"]
addresses = ["192.168.0.1", "192.168.0.2"]
ttl = 300
}`)

Expand Down

0 comments on commit 43a6ad3

Please sign in to comment.