From 8a6b0cc0cd1f2c6624b23a15f21e2c4ca6248fa5 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 8 Jun 2017 19:08:21 +0000 Subject: [PATCH] TestInitListeners: Use port 0 pick available port (#4508) --- cmd/server-mux_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/server-mux_test.go b/cmd/server-mux_test.go index 31fb7f01a..614621b2f 100644 --- a/cmd/server-mux_test.go +++ b/cmd/server-mux_test.go @@ -109,20 +109,18 @@ func dial(addr string) error { // Tests initializing listeners. func TestInitListeners(t *testing.T) { - portTest1 := getFreePort() - portTest2 := getFreePort() testCases := []struct { serverAddr string shouldPass bool }{ // Test 1 with ip and port. { - serverAddr: "127.0.0.1:" + portTest1, + serverAddr: net.JoinHostPort("127.0.0.1", "0"), shouldPass: true, }, // Test 2 only port. { - serverAddr: ":" + portTest2, + serverAddr: net.JoinHostPort("", "0"), shouldPass: true, }, // Test 3 with no port error.