Skip to content

Commit

Permalink
Fix bwc tests for 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
williamrandolph committed Oct 7, 2021
1 parent ccfec46 commit 3b43555
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.elasticsearch.upgrades;

import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.migration.TransportGetFeatureUpgradeStatusAction;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.test.XContentTestUtils;
Expand All @@ -31,12 +32,15 @@ public void testGetFeatureUpgradeStatus() throws Exception {
// setup - put something in the tasks index
// create index
Request createTestIndex = new Request("PUT", "/feature_test_index_old");
createTestIndex.setJsonEntity("{\"settings\": {\"index.number_of_replicas\": 0}}");
createTestIndex.setJsonEntity("{\"settings\": {" +
"\"index.number_of_replicas\": 0," +
"\"index.number_of_shards\": 1" +
"}}");
client().performRequest(createTestIndex);

Request bulk = new Request("POST", "/_bulk");
bulk.addParameter("refresh", "true");
bulk.setJsonEntity("{\"index\": {\"_index\": \"feature_test_index_old\"}}\n" +
bulk.setJsonEntity("{\"index\": {\"_index\": \"feature_test_index_old\", \"_type\": \"_doc\"}}\n" +
"{\"f1\": \"v1\", \"f2\": \"v2\"}\n");
client().performRequest(bulk);

Expand Down Expand Up @@ -67,6 +71,7 @@ public void testGetFeatureUpgradeStatus() throws Exception {
v.compatible(systemIndexWarning);
}));
getTasksIndex.addParameter("allow_no_indices", "false");
getTasksIndex.addParameter("include_type_name", "false");

assertBusy(() -> {
try {
Expand All @@ -91,7 +96,7 @@ 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(Version.CURRENT.minimumIndexCompatibilityVersion())) {
if (UPGRADE_FROM_VERSION.before(TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_VERSION)) {
assertThat(feature.get("upgrade_status"), equalTo("UPGRADE_NEEDED"));
} else {
assertThat(feature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class TransportGetFeatureUpgradeStatusAction extends TransportMasterNodeA
GetFeatureUpgradeStatusRequest,
GetFeatureUpgradeStatusResponse> {

public static final Version NO_UPGRADE_REQUIRED_VERSION = Version.V_7_0_0;

private final SystemIndices systemIndices;

@Inject
Expand Down

0 comments on commit 3b43555

Please sign in to comment.