Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,6 @@ tests:
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
method: test {yaml=indices.validate_query/20_query_string/validate_query with query_string parameters}
issue: https://github.com/elastic/elasticsearch/issues/137391
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
method: testILMDownsampleRollingRestart
issue: https://github.com/elastic/elasticsearch/issues/136585

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;
import org.elasticsearch.xpack.aggregatemetric.AggregateMetricMapperPlugin;
Expand All @@ -34,6 +33,7 @@
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;
import org.elasticsearch.xpack.core.ilm.Phase;
import org.elasticsearch.xpack.core.ilm.PhaseCompleteStep;
import org.elasticsearch.xpack.core.ilm.action.ILMActions;
import org.elasticsearch.xpack.core.ilm.action.PutLifecycleRequest;
import org.elasticsearch.xpack.ilm.IndexLifecycle;
Expand All @@ -48,6 +48,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

Expand Down Expand Up @@ -130,10 +131,6 @@ public void setup(final String sourceIndex, int numOfShards, int numOfReplicas,
assertAcked(client().execute(ILMActions.PUT, putLifecycleRequest).actionGet());
}

@TestIssueLogging(
value = "org.elasticsearch.cluster.service.MasterService:TRACE",
issueUrl = "https://github.com/elastic/elasticsearch/issues/136585"
)
public void testILMDownsampleRollingRestart() throws Exception {
final InternalTestCluster cluster = internalCluster();
cluster.startMasterOnlyNodes(1);
Expand Down Expand Up @@ -172,6 +169,13 @@ public void testILMDownsampleRollingRestart() throws Exception {
startDownsampleTaskViaIlm(sourceIndex, targetIndex);
assertBusy(() -> assertTargetIndex(cluster, targetIndex, indexedDocs));
ensureGreen(targetIndex);
// We assert that ILM successfully completed the phase
logger.info("Waiting for ILM to complete the phase for index [{}]", targetIndex);
awaitClusterState(clusterState -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh yes I'd completely forgotten we had an awaitClusterState to do this 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, credits to @nielsbauman

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have less of an excuse tho 😇

$ git annotate -- test/framework/src/main/java/org/elasticsearch/test/ClusterServiceUtils.java | grep awaitClusterState
1337476bc9efc	(David Turner	2025-08-26 12:54:45 +0100	241)    public static void awaitClusterState(Predicate<ClusterState> statePredicate, ClusterService clusterService) {

IndexMetadata indexMetadata = clusterState.metadata().getProject().index(targetIndex);
return indexMetadata.getLifecycleExecutionState() != null
&& Objects.equals(indexMetadata.getLifecycleExecutionState().step(), PhaseCompleteStep.NAME);
});
}

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