Skip to content
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

Disabling the migration reindex yaml rest tests unless feature is available #118382

Merged
Show file tree
Hide file tree
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 @@ -20,11 +20,16 @@
import org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.ReindexDataStreamResponse;

import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;

public class RestMigrationReindexAction extends BaseRestHandler {
public static final String MIGRATION_REINDEX_CAPABILITY = "migration_reindex";

@Override
public String getName() {
Expand All @@ -49,6 +54,15 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
);
}

@Override
public Set<String> supportedCapabilities() {
Set<String> capabilities = new HashSet<>();
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
capabilities.add(MIGRATION_REINDEX_CAPABILITY);
}
return Collections.unmodifiableSet(capabilities);
}

static class ReindexDataStreamRestToXContentListener extends RestBuilderListener<ReindexDataStreamResponse> {

ReindexDataStreamRestToXContentListener(RestChannel channel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ setup:

---
"Test Reindex With Unsupported Mode":
- requires:
reason: "migration reindex is behind a feature flag"
test_runner_features: [capabilities]
capabilities:
- method: POST
path: /_migration/reindex
capabilities: [migration_reindex]
- do:
catch: /illegal_argument_exception/
migrate.reindex:
Expand All @@ -19,6 +26,13 @@ setup:

---
"Test Reindex With Nonexistent Data Stream":
- requires:
reason: "migration reindex is behind a feature flag"
test_runner_features: [capabilities]
capabilities:
- method: POST
path: /_migration/reindex
capabilities: [migration_reindex]
- do:
catch: /resource_not_found_exception/
migrate.reindex:
Expand All @@ -44,6 +58,13 @@ setup:

---
"Test Reindex With Bad Data Stream Name":
- requires:
reason: "migration reindex is behind a feature flag"
test_runner_features: [capabilities]
capabilities:
- method: POST
path: /_migration/reindex
capabilities: [migration_reindex]
- do:
catch: /illegal_argument_exception/
migrate.reindex:
Expand All @@ -57,6 +78,13 @@ setup:

---
"Test Reindex With Existing Data Stream":
- requires:
reason: "migration reindex is behind a feature flag"
test_runner_features: [capabilities]
capabilities:
- method: POST
path: /_migration/reindex
capabilities: [migration_reindex]
- do:
indices.put_index_template:
name: my-template1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ setup:

---
"Test get reindex status with nonexistent task id":
- requires:
reason: "migration reindex is behind a feature flag"
test_runner_features: [capabilities]
capabilities:
- method: POST
path: /_migration/reindex
capabilities: [migration_reindex]
- do:
catch: /resource_not_found_exception/
migrate.get_reindex_status:
index: "does_not_exist"

---
"Test Reindex With Existing Data Stream":
- requires:
reason: "migration reindex is behind a feature flag"
test_runner_features: [capabilities]
capabilities:
- method: POST
path: /_migration/reindex
capabilities: [migration_reindex]
- do:
indices.put_index_template:
name: my-template1
Expand Down