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 20, 2022
1 parent 9e898dc commit 59b3066
Showing 1 changed file with 0 additions and 5 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

0 comments on commit 59b3066

Please sign in to comment.