From f64876a64b9d558109a6f115458291f05228d08b Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Mon, 23 Mar 2015 11:41:32 +0000 Subject: [PATCH] Increment the server port for each test Occasionally the test servers overlap and the test will fail with "address already in use". --- nameserver/server_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nameserver/server_test.go b/nameserver/server_test.go index 10c4445c..f93f6053 100644 --- a/nameserver/server_test.go +++ b/nameserver/server_test.go @@ -15,10 +15,18 @@ const ( testRDNSsuccess = "1.2.2.10.in-addr.arpa." testRDNSfail = "4.3.2.1.in-addr.arpa." testRDNSnonlocal = "8.8.8.8.in-addr.arpa." - testPort = 17625 ) +var ( + testPort = 17625 +) + +func setupForTest() { + testPort++ +} + func TestUDPDNSServer(t *testing.T) { + setupForTest() const ( successTestName = "test1.weave.local." failTestName = "test2.weave.local." @@ -124,6 +132,7 @@ func testExchange(t *testing.T, z string, ty uint16, minAnswers int, maxAnswers } func TestTCPDNSServer(t *testing.T) { + setupForTest() const ( numAnswers = 512 nonLocalName = "weave.works."