From 5a17fabc501402ec6299b23e0443e8619fc51e70 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Wed, 31 May 2017 12:15:55 +0200 Subject: [PATCH] test: use random ports for consul tests --- consul/server_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/consul/server_test.go b/consul/server_test.go index e00d4f2f3..74098e38e 100644 --- a/consul/server_test.go +++ b/consul/server_test.go @@ -2,10 +2,10 @@ package consul import ( "fmt" + "math/rand" "net" "os" "strings" - "sync/atomic" "testing" "time" @@ -17,10 +17,8 @@ import ( "github.com/hashicorp/go-uuid" ) -var nextPort int32 = 15000 - func getPort() int { - return int(atomic.AddInt32(&nextPort, 1)) + return 1030 + int(rand.Int31n(64400)) } func configureTLS(config *Config) {