Skip to content

Commit ac2e09b

Browse files
authored
Fix suite scope random initializaation (#37163)
The initialization of a suite scope cluster had some sideffects on subsequent runs which causes issues when tests must be reproduced. This moves the suite scope initialization to a privte random context. Closes #36202
1 parent 21996f7 commit ac2e09b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,24 @@ protected final boolean enableWarningsCheck() {
373373

374374
protected final void beforeInternal() throws Exception {
375375
final Scope currentClusterScope = getCurrentClusterScope();
376+
Callable<Void> setup = () -> {
377+
cluster().beforeTest(random(), getPerTestTransportClientRatio());
378+
cluster().wipe(excludeTemplates());
379+
randomIndexTemplate();
380+
return null;
381+
};
376382
switch (currentClusterScope) {
377383
case SUITE:
378384
assert SUITE_SEED != null : "Suite seed was not initialized";
379385
currentCluster = buildAndPutCluster(currentClusterScope, SUITE_SEED);
386+
RandomizedContext.current().runWithPrivateRandomness(SUITE_SEED, setup);
380387
break;
381388
case TEST:
382389
currentCluster = buildAndPutCluster(currentClusterScope, randomLong());
390+
setup.call();
383391
break;
384392
}
385-
cluster().beforeTest(random(), getPerTestTransportClientRatio());
386-
cluster().wipe(excludeTemplates());
387-
randomIndexTemplate();
393+
388394
}
389395

390396
private void printTestMessage(String message) {

test/framework/src/test/java/org/elasticsearch/test/test/SuiteScopeClusterIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public class SuiteScopeClusterIT extends ESIntegTestCase {
4141
@Test
4242
@SuppressForbidden(reason = "repeat is a feature here")
4343
@Repeat(iterations = 10, useConstantSeed = true)
44-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/36202")
4544
public void testReproducible() throws IOException {
4645
if (ITER++ == 0) {
4746
CLUSTER_SEED = cluster().seed();

0 commit comments

Comments
 (0)