Skip to content

Commit

Permalink
Use 'migration' instead of 'upgrade' in GET system feature migration …
Browse files Browse the repository at this point in the history
…status responses (elastic#79302) (elastic#79495)

* Change 'upgrade' to 'migration' in System Index Migration responses
  • Loading branch information
williamrandolph authored Oct 19, 2021
1 parent 4e57b13 commit 159cb44
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public class GetFeatureUpgradeStatusResponse {

private static final ParseField FEATURE_UPGRADE_STATUSES = new ParseField("features");
private static final ParseField UPGRADE_STATUS = new ParseField("upgrade_status");
private static final ParseField UPGRADE_STATUS = new ParseField("migration_status");

private final List<FeatureUpgradeStatus> featureUpgradeStatuses;
private final String upgradeStatus;
Expand Down Expand Up @@ -76,7 +76,7 @@ public static class FeatureUpgradeStatus {

private static final ParseField FEATURE_NAME = new ParseField("feature_name");
private static final ParseField MINIMUM_INDEX_VERSION = new ParseField("minimum_index_version");
private static final ParseField UPGRADE_STATUS = new ParseField("upgrade_status");
private static final ParseField UPGRADE_STATUS = new ParseField("migration_status");
private static final ParseField INDEX_VERSIONS = new ParseField("indices");

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testGetDeprecationInfo() throws IOException {
public void testGetFeatureUpgradeStatus() throws IOException {
GetFeatureUpgradeStatusRequest request = new GetFeatureUpgradeStatusRequest();
GetFeatureUpgradeStatusResponse response = highLevelClient().migration().getFeatureUpgradeStatus(request, RequestOptions.DEFAULT);
assertThat(response.getUpgradeStatus(), equalTo("NO_UPGRADE_NEEDED"));
assertThat(response.getUpgradeStatus(), equalTo("NO_MIGRATION_NEEDED"));
assertThat(response.getFeatureUpgradeStatuses().size(), greaterThanOrEqualTo(1));
Optional<GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus> optionalTasksStatus = response.getFeatureUpgradeStatuses().stream()
.filter(status -> "tasks".equals(status.getFeatureName()))
Expand All @@ -65,7 +65,7 @@ public void testGetFeatureUpgradeStatus() throws IOException {

GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus tasksStatus = optionalTasksStatus.get();

assertThat(tasksStatus.getUpgradeStatus(), equalTo("NO_UPGRADE_NEEDED"));
assertThat(tasksStatus.getUpgradeStatus(), equalTo("NO_MIGRATION_NEEDED"));
assertThat(tasksStatus.getMinimumIndexVersion(), equalTo(Version.CURRENT.toString()));
assertThat(tasksStatus.getFeatureName(), equalTo("tasks"));
}
Expand Down
26 changes: 13 additions & 13 deletions docs/reference/migration/apis/feature_upgrade.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,77 +46,77 @@ Example response:
{
"feature_name" : "async_search",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "enrich",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "fleet",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "geoip",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "kibana",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "logstash_management",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "machine_learning",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "searchable_snapshots",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "security",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "tasks",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "transform",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "watcher",
"minimum_index_version" : "7.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
}
],
"upgrade_status" : "NO_UPGRADE_NEEDED"
"migration_status" : "NO_MIGRATION_NEEDED"
}
--------------------------------------------------
// TESTRESPONSE[s/"minimum_index_version" : "7.0.0"/"minimum_index_version" : $body.$_path/]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public void testGetFeatureUpgradeStatus() throws Exception {
assertThat(feature.size(), equalTo(4));
assertThat(feature.get("minimum_index_version"), equalTo(UPGRADE_FROM_VERSION.toString()));
if (UPGRADE_FROM_VERSION.before(TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_VERSION)) {
assertThat(feature.get("upgrade_status"), equalTo("UPGRADE_NEEDED"));
assertThat(feature.get("migration_status"), equalTo("MIGRATION_NEEDED"));
} else {
assertThat(feature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED"));
assertThat(feature.get("migration_status"), equalTo("NO_MIGRATION_NEEDED"));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void testGetFeatureUpgradedStatuses() throws Exception {
Response response = client().performRequest(new Request("GET", "/_migration/system_features"));
assertThat(response.getStatusLine().getStatusCode(), is(200));
XContentTestUtils.JsonMapView view = XContentTestUtils.createJsonMapView(response.getEntity().getContent());
String upgradeStatus = view.get("upgrade_status");
assertThat(upgradeStatus, equalTo("NO_UPGRADE_NEEDED"));
String upgradeStatus = view.get("migration_status");
assertThat(upgradeStatus, equalTo("NO_MIGRATION_NEEDED"));
List<Map<String, Object>> features = view.get("features");
Map<String, Object> testFeature = features.stream()
.filter(feature -> "system indices qa".equals(feature.get("feature_name")))
Expand All @@ -62,7 +62,7 @@ public void testGetFeatureUpgradedStatuses() throws Exception {

assertThat(testFeature.size(), equalTo(4));
assertThat(testFeature.get("minimum_index_version"), equalTo(Version.CURRENT.toString()));
assertThat(testFeature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED"));
assertThat(testFeature.get("migration_status"), equalTo("NO_MIGRATION_NEEDED"));
assertThat(testFeature.get("indices"), instanceOf(List.class));

assertThat((List<Object>) testFeature.get("indices"), hasSize(1));
Expand Down
2 changes: 1 addition & 1 deletion rest-api-spec/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@


apply plugin: 'elasticsearch.build'
apply plugin: 'elasticsearch.publish'
apply plugin: 'elasticsearch.rest-resources'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
- do:
migration.get_feature_upgrade_status: {}

- is_true: upgrade_status
- is_true: migration_status
- is_true: features
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.value(featureUpgradeStatus);
}
builder.endArray();
builder.field("upgrade_status", upgradeStatus);
builder.field("migration_status", upgradeStatus);
builder.endObject();
return builder;
}
Expand Down Expand Up @@ -98,8 +98,8 @@ public String toString() {
}

public enum UpgradeStatus {
UPGRADE_NEEDED,
NO_UPGRADE_NEEDED,
MIGRATION_NEEDED,
NO_MIGRATION_NEEDED,
IN_PROGRESS
}

Expand Down Expand Up @@ -167,7 +167,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.startObject();
builder.field("feature_name", this.featureName);
builder.field("minimum_index_version", this.minimumIndexVersion.toString());
builder.field("upgrade_status", this.upgradeStatus);
builder.field("migration_status", this.upgradeStatus);
builder.startArray("indices");
for (IndexVersion version : this.indexVersions) {
builder.value(version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_UPGRADE_NEEDED;
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.UPGRADE_NEEDED;
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED;
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.MIGRATION_NEEDED;

/**
* Transport class for the get feature upgrade status action
Expand Down Expand Up @@ -80,7 +80,7 @@ protected void masterOperation(GetFeatureUpgradeStatusRequest request, ClusterSt
.orElse(Version.CURRENT)
.before(Version.V_7_0_0);

listener.onResponse(new GetFeatureUpgradeStatusResponse(features, isUpgradeNeeded ? UPGRADE_NEEDED : NO_UPGRADE_NEEDED));
listener.onResponse(new GetFeatureUpgradeStatusResponse(features, isUpgradeNeeded ? MIGRATION_NEEDED : NO_MIGRATION_NEEDED));
}

// visible for testing
Expand All @@ -97,7 +97,7 @@ static GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus getFeatureUpgradeSta
return new GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus(
featureName,
minimumVersion,
minimumVersion.before(Version.V_7_0_0) ? UPGRADE_NEEDED : NO_UPGRADE_NEEDED,
minimumVersion.before(Version.V_7_0_0) ? MIGRATION_NEEDED : NO_MIGRATION_NEEDED,
indexVersions
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.io.IOException;
import java.util.Collections;

import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.UPGRADE_NEEDED;
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.MIGRATION_NEEDED;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;

Expand Down Expand Up @@ -50,7 +50,7 @@ protected GetFeatureUpgradeStatusResponse mutateInstance(GetFeatureUpgradeStatus

/** If constructor is called with null for a list, we just use an empty list */
public void testConstructorHandlesNullLists() {
GetFeatureUpgradeStatusResponse response = new GetFeatureUpgradeStatusResponse(null, UPGRADE_NEEDED);
GetFeatureUpgradeStatusResponse response = new GetFeatureUpgradeStatusResponse(null, MIGRATION_NEEDED);
assertThat(response.getFeatureUpgradeStatuses(), notNullValue());
assertThat(response.getFeatureUpgradeStatuses(), equalTo(Collections.emptyList()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.ArrayList;
import java.util.List;

import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_UPGRADE_NEEDED;
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED;
import static org.hamcrest.Matchers.equalTo;

public class TransportGetFeatureUpgradeStatusActionTests extends ESTestCase {
Expand All @@ -35,7 +35,7 @@ public void testGetFeatureStatus() {
TransportGetFeatureUpgradeStatusAction.getFeatureUpgradeStatus(
CLUSTER_STATE, "test-feature", FEATURE);

assertThat(status.getUpgradeStatus(), equalTo(NO_UPGRADE_NEEDED));
assertThat(status.getUpgradeStatus(), equalTo(NO_MIGRATION_NEEDED));
assertThat(status.getFeatureName(), equalTo("test-feature"));
assertThat(status.getMinimumIndexVersion(), equalTo(Version.V_7_0_0));
assertThat(status.getIndexVersions().size(), equalTo(2)); // additional testing below
Expand Down

0 comments on commit 159cb44

Please sign in to comment.