From a89d6b8e3d16c4eb8c8be5359a7f7ee72b6269dd Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 1 Sep 2020 10:11:15 -0700 Subject: [PATCH] Fix common Windows failure (#10397) The `getNonLoopBackIP` may grab an IP from an interface that doesn't allow binding (on Windows), so this test consistently fails. We exclude that specific error. --- cmd/http/listener_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/http/listener_test.go b/cmd/http/listener_test.go index c8a559249..037ad8c6d 100644 --- a/cmd/http/listener_test.go +++ b/cmd/http/listener_test.go @@ -186,6 +186,10 @@ func TestHTTPListenerStartClose(t *testing.T) { testCase.serverAddrs, ) if err != nil { + if strings.Contains(err.Error(), "The requested address is not valid in its context") { + // Ignore if IP is unbindable. + continue + } t.Fatalf("Test %d: error: expected = , got = %v", i+1, err) } @@ -225,6 +229,10 @@ func TestHTTPListenerAddr(t *testing.T) { testCase.serverAddrs, ) if err != nil { + if strings.Contains(err.Error(), "The requested address is not valid in its context") { + // Ignore if IP is unbindable. + continue + } t.Fatalf("Test %d: error: expected = , got = %v", i+1, err) } @@ -261,6 +269,10 @@ func TestHTTPListenerAddrs(t *testing.T) { testCase.serverAddrs, ) if err != nil { + if strings.Contains(err.Error(), "The requested address is not valid in its context") { + // Ignore if IP is unbindable. + continue + } t.Fatalf("Test %d: error: expected = , got = %v", i+1, err) }