Skip to content

Commit 99ae206

Browse files
committed
Add some randomness to the ports used
Signed-off-by: Matt Lord <mattalord@gmail.com>
1 parent 10a6916 commit 99ae206

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

go/test/endtoend/vreplication/cluster_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,17 @@ func downloadDBTypeVersion(dbType string, majorVersion string, path string) erro
297297
}
298298

299299
func getClusterConfig(idx int, dataRootDir string) *ClusterConfig {
300+
offset := 0
301+
if !debugMode {
302+
// Add some randomness to the ports so that multiple tests can run in
303+
// parallel on the same host.
304+
offset = (idx + 1) * rand.IntN(1000)
305+
}
300306
basePort := 15000
301307
etcdPort := 2379
302308

303-
basePort += idx * 10000
304-
etcdPort += idx * 10000
309+
basePort += (idx * 10000) + offset
310+
etcdPort += (idx * 10000) + offset
305311
if _, err := os.Stat(dataRootDir); os.IsNotExist(err) {
306312
os.Mkdir(dataRootDir, 0700)
307313
}

0 commit comments

Comments
 (0)