Skip to content

Commit 85d6e07

Browse files
authored
Fix: ILMDownsampleDisruptionIT.testILMDownsampleRollingRestart (#137423)
This PR stabilises `testILMDownsampleRollingRestart` and closes #136585. This test started failing more often after #135834 because this change increased the chance of manifesting #137422. To reduce this chance we wait for ILM to finish the phase before we end the test. Closes #136585
1 parent c9dcc3b commit 85d6e07

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,6 @@ tests:
501501
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
502502
method: test {yaml=indices.validate_query/20_query_string/validate_query with query_string parameters}
503503
issue: https://github.com/elastic/elasticsearch/issues/137391
504-
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
505-
method: testILMDownsampleRollingRestart
506-
issue: https://github.com/elastic/elasticsearch/issues/136585
507504

508505
# Examples:
509506
#

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
2626
import org.elasticsearch.test.ESIntegTestCase;
2727
import org.elasticsearch.test.InternalTestCluster;
28-
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
2928
import org.elasticsearch.xcontent.XContentBuilder;
3029
import org.elasticsearch.xcontent.XContentFactory;
3130
import org.elasticsearch.xpack.aggregatemetric.AggregateMetricMapperPlugin;
@@ -34,6 +33,7 @@
3433
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
3534
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;
3635
import org.elasticsearch.xpack.core.ilm.Phase;
36+
import org.elasticsearch.xpack.core.ilm.PhaseCompleteStep;
3737
import org.elasticsearch.xpack.core.ilm.action.ILMActions;
3838
import org.elasticsearch.xpack.core.ilm.action.PutLifecycleRequest;
3939
import org.elasticsearch.xpack.ilm.IndexLifecycle;
@@ -48,6 +48,7 @@
4848
import java.util.List;
4949
import java.util.Locale;
5050
import java.util.Map;
51+
import java.util.Objects;
5152
import java.util.concurrent.TimeUnit;
5253
import java.util.function.Supplier;
5354

@@ -135,10 +136,6 @@ public void setup(final String sourceIndex, int numOfShards, int numOfReplicas,
135136
assertAcked(client().execute(ILMActions.PUT, putLifecycleRequest).actionGet());
136137
}
137138

138-
@TestIssueLogging(
139-
value = "org.elasticsearch.cluster.service.MasterService:TRACE",
140-
issueUrl = "https://github.com/elastic/elasticsearch/issues/136585"
141-
)
142139
public void testILMDownsampleRollingRestart() throws Exception {
143140
final InternalTestCluster cluster = internalCluster();
144141
cluster.startMasterOnlyNodes(1);
@@ -178,6 +175,13 @@ public void testILMDownsampleRollingRestart() throws Exception {
178175
startDownsampleTaskViaIlm(sourceIndex, targetIndex);
179176
assertBusy(() -> assertTargetIndex(cluster, targetIndex, indexedDocs, samplingMethod));
180177
ensureGreen(targetIndex);
178+
// We wait for ILM to successfully complete the phase
179+
logger.info("Waiting for ILM to complete the phase for index [{}]", targetIndex);
180+
awaitClusterState(clusterState -> {
181+
IndexMetadata indexMetadata = clusterState.metadata().getProject().index(targetIndex);
182+
return indexMetadata.getLifecycleExecutionState() != null
183+
&& Objects.equals(indexMetadata.getLifecycleExecutionState().step(), PhaseCompleteStep.NAME);
184+
});
181185
}
182186

183187
private void startDownsampleTaskViaIlm(String sourceIndex, String targetIndex) throws Exception {

0 commit comments

Comments
 (0)