From fb93cd45a647087a11f96cf2610e64a257a68c19 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 4 Feb 2020 19:41:48 -0500 Subject: [PATCH] net: don't check LookupHost error in TestLookupNullByte net.LookupHost("foo\x00bar") may resolve successfully on some networks. Reduce the scope of the test to check only that the call doesn't panic. Also update the test comment to reference the relevant issue. Fixes #37031 Updates #31597 Change-Id: If175deed8121625ef507598c6145e937ccffd89e Reviewed-on: https://go-review.googlesource.com/c/go/+/217729 Reviewed-by: Ian Lance Taylor Run-TryBot: Dmitri Shuralyov TryBot-Result: Gobot Gobot --- src/net/lookup_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go index 1663b78ef0..2bc5592d5a 100644 --- a/src/net/lookup_test.go +++ b/src/net/lookup_test.go @@ -1179,12 +1179,9 @@ func TestWithUnexpiredValuesPreserved(t *testing.T) { } } -// Issue 31586: don't crash on null byte in name +// Issue 31597: don't panic on null byte in name func TestLookupNullByte(t *testing.T) { testenv.MustHaveExternalNetwork(t) testenv.SkipFlakyNet(t) - _, err := LookupHost("foo\x00bar") // used to crash on Windows - if err == nil { - t.Errorf("unexpected success") - } + LookupHost("foo\x00bar") // check that it doesn't panic; it used to on Windows } -- 2.50.0