Skip to content

Commit 77ed7ff

Browse files
committed
Make the status check stricter
1 parent e6504e2 commit 77ed7ff

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import java.util.Collection;
3131
import java.util.List;
32-
import java.util.Set;
3332
import java.util.concurrent.TimeUnit;
3433

3534
import static org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_DOWNSAMPLE_STATUS;
@@ -93,33 +92,25 @@ public void testDataStreamLifecycleDownsampleRollingRestart() throws Exception {
9392
* downsampling. We try to detect if the downsampling has started by checking the downsample status in the target index.
9493
*/
9594
logger.info("-> Waiting for the data stream lifecycle to start the downsampling operation before starting the disruption.");
96-
ensureDownsamplingStatus(
97-
targetIndex,
98-
Set.of(IndexMetadata.DownsampleTaskStatus.STARTED, IndexMetadata.DownsampleTaskStatus.SUCCESS),
99-
TimeValue.timeValueSeconds(6)
100-
);
95+
ensureDownsamplingStatus(targetIndex, IndexMetadata.DownsampleTaskStatus.STARTED, TimeValue.timeValueSeconds(8));
10196

10297
logger.info("-> Starting the disruption.");
10398
internalCluster().rollingRestart(new InternalTestCluster.RestartCallback());
10499

105-
ensureDownsamplingStatus(targetIndex, Set.of(IndexMetadata.DownsampleTaskStatus.SUCCESS), TimeValue.timeValueSeconds(120));
100+
ensureDownsamplingStatus(targetIndex, IndexMetadata.DownsampleTaskStatus.SUCCESS, TimeValue.timeValueSeconds(120));
106101
ensureGreen(targetIndex);
107102
logger.info("-> Relocation has finished");
108103
}
109104

110-
private void ensureDownsamplingStatus(
111-
String downsampledIndex,
112-
Set<IndexMetadata.DownsampleTaskStatus> expectedStatuses,
113-
TimeValue timeout
114-
) {
105+
private void ensureDownsamplingStatus(String downsampledIndex, IndexMetadata.DownsampleTaskStatus expectedStatus, TimeValue timeout) {
115106
final var clusterService = internalCluster().getCurrentMasterNodeInstance(ClusterService.class);
116107
final var listener = ClusterServiceUtils.addTemporaryStateListener(clusterService, clusterState -> {
117108
final var indexMetadata = clusterState.metadata().getProject().index(downsampledIndex);
118109
if (indexMetadata == null) {
119110
return false;
120111
}
121112
var downsamplingStatus = INDEX_DOWNSAMPLE_STATUS.get(indexMetadata.getSettings());
122-
if (expectedStatuses.contains(downsamplingStatus)) {
113+
if (expectedStatus == downsamplingStatus) {
123114
logger.info("-> Downsampling status for index [{}] is [{}]", downsampledIndex, downsamplingStatus);
124115
return true;
125116
}

0 commit comments

Comments
 (0)