From 118edcfb08e5f2360c4b674297f08b25ec6b35ac Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Mon, 17 Nov 2025 14:59:54 +0100 Subject: [PATCH] Fix `DataStreamLifecycleDownsampleIT.testUpdateDownsampleSamplingMode` It was clear from failed tests that DLM was still progressing when the timeout of 10s was reached. Since DLM works on a poll interval (set to 1s in these tests), there's not much we can do to speed up the test. Therefore, we simply bump the timeout from 10s to 30s. This should give DLM enough time to complete the downsampling mode change. Note that `safeAwait` uses a timeout of 10s and `awaitClusterState` uses a timeout of 30s; that's why there's no explicit timeout change. Fixes #138135 --- muted-tests.yml | 3 --- .../xpack/downsample/DataStreamLifecycleDownsampleIT.java | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index ae61165df3614..23e8478b408fa 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -474,9 +474,6 @@ tests: - class: org.elasticsearch.upgrades.IndexSortUpgradeIT method: testIndexSortForNumericTypes {upgradedNodes=1} issue: https://github.com/elastic/elasticsearch/issues/138130 -- class: org.elasticsearch.xpack.downsample.DataStreamLifecycleDownsampleIT - method: testUpdateDownsampleSamplingMode - issue: https://github.com/elastic/elasticsearch/issues/138135 # Examples: # diff --git a/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DataStreamLifecycleDownsampleIT.java b/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DataStreamLifecycleDownsampleIT.java index 7cfbdef90a2bd..e2467dd76e59a 100644 --- a/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DataStreamLifecycleDownsampleIT.java +++ b/x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DataStreamLifecycleDownsampleIT.java @@ -21,7 +21,6 @@ import org.elasticsearch.core.TimeValue; import org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; -import org.elasticsearch.test.ClusterServiceUtils; import org.elasticsearch.test.junit.annotations.TestLogging; import java.util.HashSet; @@ -352,17 +351,15 @@ public void testUpdateDownsampleSamplingMode() throws Exception { rolloverResponse = safeGet(client().execute(RolloverAction.INSTANCE, new RolloverRequest(dataStreamName, null))); assertTrue(rolloverResponse.isRolledOver()); String downsampledPrefix = "downsample-10m-"; - final var waitForUpdatedDownsamplingRound = ClusterServiceUtils.addMasterTemporaryStateListener(clusterState -> { + awaitClusterState(clusterState -> { ProjectMetadata projectMetadata = clusterState.metadata().getProject(); final var dataStream = projectMetadata.dataStreams().get(dataStreamName); if (dataStream == null) { return false; } - return dataStream.getIndices().size() > 2 && dataStream.getIndices().stream().filter(index -> index.getName().startsWith(downsampledPrefix)).count() == 2; }); - safeAwait(waitForUpdatedDownsamplingRound); assertDownsamplingMethod(initialSamplingMethod, downsampledPrefix + firstBackingIndex); assertDownsamplingMethod(updatedSamplingMethod, downsampledPrefix + secondBackingIndex); }