|
29 | 29 |
|
30 | 30 | import java.util.Collection; |
31 | 31 | import java.util.List; |
32 | | -import java.util.Set; |
33 | 32 | import java.util.concurrent.TimeUnit; |
34 | 33 |
|
35 | 34 | import static org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_DOWNSAMPLE_STATUS; |
@@ -93,33 +92,25 @@ public void testDataStreamLifecycleDownsampleRollingRestart() throws Exception { |
93 | 92 | * downsampling. We try to detect if the downsampling has started by checking the downsample status in the target index. |
94 | 93 | */ |
95 | 94 | 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)); |
101 | 96 |
|
102 | 97 | logger.info("-> Starting the disruption."); |
103 | 98 | internalCluster().rollingRestart(new InternalTestCluster.RestartCallback()); |
104 | 99 |
|
105 | | - ensureDownsamplingStatus(targetIndex, Set.of(IndexMetadata.DownsampleTaskStatus.SUCCESS), TimeValue.timeValueSeconds(120)); |
| 100 | + ensureDownsamplingStatus(targetIndex, IndexMetadata.DownsampleTaskStatus.SUCCESS, TimeValue.timeValueSeconds(120)); |
106 | 101 | ensureGreen(targetIndex); |
107 | 102 | logger.info("-> Relocation has finished"); |
108 | 103 | } |
109 | 104 |
|
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) { |
115 | 106 | final var clusterService = internalCluster().getCurrentMasterNodeInstance(ClusterService.class); |
116 | 107 | final var listener = ClusterServiceUtils.addTemporaryStateListener(clusterService, clusterState -> { |
117 | 108 | final var indexMetadata = clusterState.metadata().getProject().index(downsampledIndex); |
118 | 109 | if (indexMetadata == null) { |
119 | 110 | return false; |
120 | 111 | } |
121 | 112 | var downsamplingStatus = INDEX_DOWNSAMPLE_STATUS.get(indexMetadata.getSettings()); |
122 | | - if (expectedStatuses.contains(downsamplingStatus)) { |
| 113 | + if (expectedStatus == downsamplingStatus) { |
123 | 114 | logger.info("-> Downsampling status for index [{}] is [{}]", downsampledIndex, downsamplingStatus); |
124 | 115 | return true; |
125 | 116 | } |
|
0 commit comments