Makes port selection atomic in unit tests.
This commit is contained in:
parent
6036f855a9
commit
ce93b82e1e
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue