diff --git a/consul/server_test.go b/consul/server_test.go index a8d65d36f..20333e44b 100644 --- a/consul/server_test.go +++ b/consul/server_test.go @@ -7,18 +7,17 @@ import ( "net" "os" "strings" + "sync/atomic" "testing" "time" "github.com/hashicorp/consul/testutil" ) -var nextPort = 15000 +var nextPort int32 = 15000 func getPort() int { - p := nextPort - nextPort++ - return p + return int(atomic.AddInt32(&nextPort, 1)) } func tmpDir(t *testing.T) string {