Skip to content

Commit

Permalink
Add some randomness to the ports used
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Feb 6, 2025
1 parent 10a6916 commit 99ae206
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions go/test/endtoend/vreplication/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,17 @@ func downloadDBTypeVersion(dbType string, majorVersion string, path string) erro
}

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

basePort += idx * 10000
etcdPort += idx * 10000
basePort += (idx * 10000) + offset
etcdPort += (idx * 10000) + offset
if _, err := os.Stat(dataRootDir); os.IsNotExist(err) {
os.Mkdir(dataRootDir, 0700)
}
Expand Down

0 comments on commit 99ae206

Please sign in to comment.