|
9 | 9 | "context" |
10 | 10 | gosql "database/sql" |
11 | 11 | "fmt" |
12 | | - "math/rand/v2" |
| 12 | + "math/rand" |
13 | 13 | "net" |
14 | 14 | "os" |
15 | 15 | "reflect" |
@@ -51,6 +51,7 @@ import ( |
51 | 51 | "github.com/cockroachdb/cockroach/pkg/util/allstacks" |
52 | 52 | "github.com/cockroachdb/cockroach/pkg/util/hlc" |
53 | 53 | "github.com/cockroachdb/cockroach/pkg/util/log" |
| 54 | + "github.com/cockroachdb/cockroach/pkg/util/randutil" |
54 | 55 | "github.com/cockroachdb/cockroach/pkg/util/retry" |
55 | 56 | "github.com/cockroachdb/cockroach/pkg/util/stop" |
56 | 57 | "github.com/cockroachdb/cockroach/pkg/util/syncutil" |
@@ -324,9 +325,14 @@ func NewTestCluster( |
324 | 325 | t.Fatal("StartSingleNode implies 1 node only, but asked to create", nodes) |
325 | 326 | } |
326 | 327 | if clusterArgs.ServerArgs.ClusterName == "" { |
| 328 | + // NB: not using randutil.NewTestRand which deterministically depends on the |
| 329 | + // testing seed. It would defeat the ClusterName's purpose (prevent messages |
| 330 | + // across TestClusters), e.g. if a test is stressed with the same seed. |
| 331 | + rng := rand.New(rand.NewSource(rand.Int63())) |
327 | 332 | // Use a cluster name that is sufficiently unique (within the CI env) but is |
328 | 333 | // concise and recognizable. |
329 | | - clusterArgs.ServerArgs.ClusterName = fmt.Sprintf("TestCluster-%d", rand.Uint32()) |
| 334 | + clusterArgs.ServerArgs.ClusterName = fmt.Sprintf("TestCluster-%s", |
| 335 | + randutil.RandString(rng, 10, randutil.PrintableKeyAlphabet)) |
330 | 336 | } |
331 | 337 |
|
332 | 338 | if err := checkServerArgsForCluster( |
|
0 commit comments