|
23 | 23 | import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
24 | 24 | import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
|
25 | 25 | import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
|
| 26 | +import org.elasticsearch.action.admin.indices.template.delete.DeleteComposableIndexTemplateAction; |
26 | 27 | import org.elasticsearch.action.index.IndexResponse;
|
27 | 28 | import org.elasticsearch.action.support.IndicesOptions;
|
28 | 29 | import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
@@ -1083,17 +1084,23 @@ public void testRestoreDataStreamAliasWithConflictingDataStream() throws Excepti
|
1083 | 1084 | createFullSnapshot(REPO, snapshotName);
|
1084 | 1085 | client.execute(DeleteDataStreamAction.INSTANCE, new DeleteDataStreamAction.Request("*")).actionGet();
|
1085 | 1086 | DataStreamIT.putComposableIndexTemplate("my-template", List.of("my-*"));
|
1086 |
| - var request = new CreateDataStreamAction.Request("my-alias"); |
1087 |
| - assertAcked(client.execute(CreateDataStreamAction.INSTANCE, request).actionGet()); |
1088 |
| - |
1089 |
| - var e = expectThrows( |
1090 |
| - IllegalStateException.class, |
1091 |
| - () -> client.admin().cluster().prepareRestoreSnapshot(REPO, snapshotName).setWaitForCompletion(true).get() |
1092 |
| - ); |
1093 |
| - assertThat(e.getMessage(), containsString("data stream alias and data stream have the same name (my-alias)")); |
| 1087 | + try { |
| 1088 | + var request = new CreateDataStreamAction.Request("my-alias"); |
| 1089 | + assertAcked(client.execute(CreateDataStreamAction.INSTANCE, request).actionGet()); |
| 1090 | + var e = expectThrows( |
| 1091 | + IllegalStateException.class, |
| 1092 | + () -> client.admin().cluster().prepareRestoreSnapshot(REPO, snapshotName).setWaitForCompletion(true).get() |
| 1093 | + ); |
| 1094 | + assertThat(e.getMessage(), containsString("data stream alias and data stream have the same name (my-alias)")); |
| 1095 | + } finally { |
| 1096 | + // Need to remove data streams in order to remove template |
| 1097 | + client.execute(DeleteDataStreamAction.INSTANCE, new DeleteDataStreamAction.Request("*")).actionGet(); |
| 1098 | + // Need to remove template, because base class doesn't remove composable index templates after each test (only legacy templates) |
| 1099 | + client.execute(DeleteComposableIndexTemplateAction.INSTANCE, new DeleteComposableIndexTemplateAction.Request("my-template")) |
| 1100 | + .actionGet(); |
| 1101 | + } |
1094 | 1102 | }
|
1095 | 1103 |
|
1096 |
| - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/81040") |
1097 | 1104 | public void testRestoreDataStreamAliasWithConflictingIndicesAlias() throws Exception {
|
1098 | 1105 | var snapshotName = "test-snapshot";
|
1099 | 1106 | createFullSnapshot(REPO, snapshotName);
|
|
0 commit comments