Skip to content

Unmute DataStreamsSnapshotsIT#testRestoreDataStreamAliasWithConflictingIndicesAlias() test #81142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
import org.elasticsearch.action.admin.indices.template.delete.DeleteComposableIndexTemplateAction;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
Expand Down Expand Up @@ -1083,17 +1084,23 @@ public void testRestoreDataStreamAliasWithConflictingDataStream() throws Excepti
createFullSnapshot(REPO, snapshotName);
client.execute(DeleteDataStreamAction.INSTANCE, new DeleteDataStreamAction.Request("*")).actionGet();
DataStreamIT.putComposableIndexTemplate("my-template", List.of("my-*"));
var request = new CreateDataStreamAction.Request("my-alias");
assertAcked(client.execute(CreateDataStreamAction.INSTANCE, request).actionGet());

var e = expectThrows(
IllegalStateException.class,
() -> client.admin().cluster().prepareRestoreSnapshot(REPO, snapshotName).setWaitForCompletion(true).get()
);
assertThat(e.getMessage(), containsString("data stream alias and data stream have the same name (my-alias)"));
try {
var request = new CreateDataStreamAction.Request("my-alias");
assertAcked(client.execute(CreateDataStreamAction.INSTANCE, request).actionGet());
var e = expectThrows(
IllegalStateException.class,
() -> client.admin().cluster().prepareRestoreSnapshot(REPO, snapshotName).setWaitForCompletion(true).get()
);
assertThat(e.getMessage(), containsString("data stream alias and data stream have the same name (my-alias)"));
} finally {
// Need to remove data streams in order to remove template
client.execute(DeleteDataStreamAction.INSTANCE, new DeleteDataStreamAction.Request("*")).actionGet();
// Need to remove template, because base class doesn't remove composable index templates after each test (only legacy templates)
client.execute(DeleteComposableIndexTemplateAction.INSTANCE, new DeleteComposableIndexTemplateAction.Request("my-template"))
.actionGet();
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/81040")
public void testRestoreDataStreamAliasWithConflictingIndicesAlias() throws Exception {
var snapshotName = "test-snapshot";
createFullSnapshot(REPO, snapshotName);
Expand Down