Skip to content

Commit 507f40c

Browse files
authored
Fix ILMDownsampleDisruptionIT.testILMDownsampleRollingRestart (#126692)
Wait for the index to exist on the master node to ensure all nodes have the latest cluster state. Fixes #126495
1 parent 8563235 commit 507f40c

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,6 @@ tests:
396396
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
397397
method: test {p0=transform/transforms_start_stop/Test start/stop only starts/stops specified transform}
398398
issue: https://github.com/elastic/elasticsearch/issues/126466
399-
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
400-
method: testILMDownsampleRollingRestart
401-
issue: https://github.com/elastic/elasticsearch/issues/126495
402399
- class: org.elasticsearch.smoketest.MlWithSecurityIT
403400
method: test {yaml=ml/get_trained_model_stats/Test get stats given trained models}
404401
issue: https://github.com/elastic/elasticsearch/issues/126510

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,17 +1735,21 @@ public static boolean indexExists(String index, Client client) {
17351735
}
17361736

17371737
public static void awaitIndexExists(String index) {
1738-
awaitIndexExists(index, client());
1738+
awaitIndexExists(index, client(), SAFE_AWAIT_TIMEOUT);
1739+
}
1740+
1741+
public static void awaitIndexExists(String index, TimeValue timeout) {
1742+
awaitIndexExists(index, client(), timeout);
17391743
}
17401744

17411745
public static void awaitIndexExists(String index, Client client) {
1746+
awaitIndexExists(index, client, SAFE_AWAIT_TIMEOUT);
1747+
}
1748+
1749+
public static void awaitIndexExists(String index, Client client, TimeValue timeout) {
17421750
assertThat("wildcards not supported", index, allOf(not(Metadata.ALL), not(containsString("*"))));
17431751
safeGet(
1744-
client.admin()
1745-
.cluster()
1746-
.prepareHealth(SAFE_AWAIT_TIMEOUT, index)
1747-
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED)
1748-
.execute()
1752+
client.admin().cluster().prepareHealth(timeout, index).setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED).execute()
17491753
);
17501754
}
17511755

x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/ILMDownsampleDisruptionIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ private void startDownsampleTaskViaIlm(String sourceIndex, String targetIndex) t
192192
throw new AssertionError(e);
193193
}
194194
}, 1, TimeUnit.MINUTES);
195+
awaitIndexExists(targetIndex, TimeValue.timeValueSeconds(60));
195196
assertBusy(() -> {
196-
assertTrue("target index [" + targetIndex + "] does not exist", indexExists(targetIndex));
197197
var getSettingsResponse = client().admin()
198198
.indices()
199199
.getSettings(new GetSettingsRequest(TEST_REQUEST_TIMEOUT).indices(targetIndex))

0 commit comments

Comments
 (0)