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
This commit is contained in:
Niels Bauman 2025-04-11 17:45:45 +02:00 committed by GitHub
parent 856323594d
commit 507f40cd72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 10 deletions

View file

@ -396,9 +396,6 @@ tests:
- class: org.elasticsearch.xpack.test.rest.XPackRestIT - class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=transform/transforms_start_stop/Test start/stop only starts/stops specified transform} method: test {p0=transform/transforms_start_stop/Test start/stop only starts/stops specified transform}
issue: https://github.com/elastic/elasticsearch/issues/126466 issue: https://github.com/elastic/elasticsearch/issues/126466
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
method: testILMDownsampleRollingRestart
issue: https://github.com/elastic/elasticsearch/issues/126495
- class: org.elasticsearch.smoketest.MlWithSecurityIT - class: org.elasticsearch.smoketest.MlWithSecurityIT
method: test {yaml=ml/get_trained_model_stats/Test get stats given trained models} method: test {yaml=ml/get_trained_model_stats/Test get stats given trained models}
issue: https://github.com/elastic/elasticsearch/issues/126510 issue: https://github.com/elastic/elasticsearch/issues/126510

View file

@ -1735,17 +1735,21 @@ public abstract class ESIntegTestCase extends ESTestCase {
} }
public static void awaitIndexExists(String index) { public static void awaitIndexExists(String index) {
awaitIndexExists(index, client()); awaitIndexExists(index, client(), SAFE_AWAIT_TIMEOUT);
}
public static void awaitIndexExists(String index, TimeValue timeout) {
awaitIndexExists(index, client(), timeout);
} }
public static void awaitIndexExists(String index, Client client) { public static void awaitIndexExists(String index, Client client) {
awaitIndexExists(index, client, SAFE_AWAIT_TIMEOUT);
}
public static void awaitIndexExists(String index, Client client, TimeValue timeout) {
assertThat("wildcards not supported", index, allOf(not(Metadata.ALL), not(containsString("*")))); assertThat("wildcards not supported", index, allOf(not(Metadata.ALL), not(containsString("*"))));
safeGet( safeGet(
client.admin() client.admin().cluster().prepareHealth(timeout, index).setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED).execute()
.cluster()
.prepareHealth(SAFE_AWAIT_TIMEOUT, index)
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED)
.execute()
); );
} }

View file

@ -192,8 +192,8 @@ public class ILMDownsampleDisruptionIT extends ESIntegTestCase {
throw new AssertionError(e); throw new AssertionError(e);
} }
}, 1, TimeUnit.MINUTES); }, 1, TimeUnit.MINUTES);
awaitIndexExists(targetIndex, TimeValue.timeValueSeconds(60));
assertBusy(() -> { assertBusy(() -> {
assertTrue("target index [" + targetIndex + "] does not exist", indexExists(targetIndex));
var getSettingsResponse = client().admin() var getSettingsResponse = client().admin()
.indices() .indices()
.getSettings(new GetSettingsRequest(TEST_REQUEST_TIMEOUT).indices(targetIndex)) .getSettings(new GetSettingsRequest(TEST_REQUEST_TIMEOUT).indices(targetIndex))