Use a monotonically incrementing number to create unique node names.

Also remove the space from the "name" of the node
This commit is contained in:
Sean Chittenden 2016-06-01 03:48:31 -07:00
parent 1ec7d6c266
commit 060300007e
No known key found for this signature in database
GPG Key ID: 4EBC9DC16C2E5E16
1 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,10 @@ import (
"github.com/hashicorp/nomad/testutil"
)
var nextPort uint32 = 15000
var (
nextPort uint32 = 15000
nodeNumber uint32 = 0
)
func getPort() int {
return int(atomic.AddUint32(&nextPort, 1))
@ -34,7 +37,8 @@ func testServer(t *testing.T, cb func(*Config)) *Server {
IP: []byte{127, 0, 0, 1},
Port: getPort(),
}
config.NodeName = fmt.Sprintf("Node %d", config.RPCAddr.Port)
nodeNumber = atomic.AddUint32(&nodeNumber, 1)
config.NodeName = fmt.Sprintf("nomad-%03d", nodeNumber)
// Tighten the Serf timing
config.SerfConfig.MemberlistConfig.BindAddr = "127.0.0.1"