From 8b6fa668ee1aaf6c00073115cc09957195ee30e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Tudor=20C=C4=83lin?= Date: Mon, 23 Sep 2019 19:10:05 +0300 Subject: [PATCH] net: use case-insensitive host string comparison in TestLookupGmailNS Some nameservers alter the case of NS records they return, e.g. ns2.google.COm. or ns2.google.coM. Change TestLookupGmailNS to account for this possibility by comparing host names in lower case. Fixes #34446 Change-Id: I6ccb5b87b42401e04c9b32cecb8b7b4267b654cc Reviewed-on: https://go-review.googlesource.com/c/go/+/196801 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/net/lookup_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go index dd599c7c1c..e85605fa2f 100644 --- a/src/net/lookup_test.go +++ b/src/net/lookup_test.go @@ -193,7 +193,9 @@ func TestLookupGmailNS(t *testing.T) { t.Error("got no record") } for _, ns := range nss { - if !strings.HasSuffix(ns.Host, tt.host) { + // Some nameservers alter the case of NS records. See #34446. + host := strings.ToLower(ns.Host) + if !strings.HasSuffix(host, tt.host) { t.Errorf("got %v; want a record containing %s", ns, tt.host) } }