update test to run on every ip in googlebot pool

This commit is contained in:
Damian Bednarczyk
2023-12-01 21:16:38 -06:00
parent 54173cf672
commit a1a2f261e9

View File

@@ -6,9 +6,17 @@ import (
)
func TestRandomIPFromSubnet(t *testing.T) {
subnets := []string{"34.100.182.96/28", "207.46.13.0/24", "2001:4860:4801:10::/64", "2001:4860:4801:c::/64"}
err := GoogleBot.UpdatePool("https://developers.google.com/static/search/apis/ipranges/googlebot.json")
if err != nil {
t.Error(err)
}
for _, prefix := range GoogleBot.IPPool.Prefixes {
subnet := prefix.IPv4
if prefix.IPv6 != "" {
subnet = prefix.IPv6
}
for _, subnet := range subnets {
t.Run(subnet, func(t *testing.T) {
_, ipnet, err := net.ParseCIDR(subnet)
if err != nil {