Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -456,9 +456,6 @@ tests:
- class: org.elasticsearch.snapshots.SnapshotShutdownIT
method: testSnapshotShutdownProgressTracker
issue: https://github.com/elastic/elasticsearch/issues/127690
- class: org.elasticsearch.xpack.core.template.IndexTemplateRegistryRolloverIT
method: testRollover
issue: https://github.com/elastic/elasticsearch/issues/127692

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.elasticsearch.cluster.ClusterChangedEvent;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.project.TestProjectResolvers;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.datastreams.DataStreamsPlugin;
Expand Down Expand Up @@ -68,7 +69,8 @@ public void setup() {
public void testRollover() throws Exception {
ClusterState state = clusterService.state();
registry.clusterChanged(new ClusterChangedEvent(IndexTemplateRegistryRolloverIT.class.getName(), state, state));
assertBusy(() -> { assertTrue(clusterService.state().metadata().getProject().templatesV2().containsKey(TEST_INDEX_TEMPLATE_ID)); });
final var projectId = ProjectId.DEFAULT;
awaitClusterState(s -> s.metadata().getProject(projectId).templatesV2().containsKey(TEST_INDEX_TEMPLATE_ID));
String dsName = TEST_INDEX_PATTERN.replace('*', '1');
CreateDataStreamAction.Request createDataStreamRequest = new CreateDataStreamAction.Request(
TEST_REQUEST_TIMEOUT,
Expand All @@ -80,7 +82,7 @@ public void testRollover() throws Exception {
assertNumberOfBackingIndices(1);
registry.incrementVersion();
registry.clusterChanged(new ClusterChangedEvent(IndexTemplateRegistryRolloverIT.class.getName(), clusterService.state(), state));
assertBusy(() -> assertTrue(getDataStream().rolloverOnWrite()));
awaitClusterState(s -> s.metadata().getProject(projectId).dataStreams().get(dsName).rolloverOnWrite());
assertNumberOfBackingIndices(1);

String timestampValue = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.formatMillis(System.currentTimeMillis());
Expand All @@ -89,7 +91,7 @@ public void testRollover() throws Exception {
.source(String.format(Locale.ROOT, "{\"%s\":\"%s\"}", DEFAULT_TIMESTAMP_FIELD, timestampValue), XContentType.JSON)
).actionGet();
assertThat(docWriteResponse.status().getStatus(), equalTo(201));
assertBusy(() -> assertNumberOfBackingIndices(2));
awaitClusterState(s -> s.metadata().getProject(projectId).dataStreams().get(dsName).getIndices().size() == 2);
}

private void assertNumberOfBackingIndices(final int expected) {
Expand Down