Skip to content

Handle deprecation warnings in "old cluster" parts of BWC tests #63363

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
merged 6 commits into from
Oct 6, 2020
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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ tasks.register("verifyVersions") {
* after the backport of the backcompat code is complete.
*/

boolean bwc_tests_enabled = false
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/issues/63358"
boolean bwc_tests_enabled = true
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
if (bwc_tests_enabled == false) {
if (bwc_tests_disabled_issue.isEmpty()) {
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void testSearch() throws Exception {
.field("binary", Base64.getEncoder().encodeToString(randomByteArray))
.endObject()
);
refresh();
refreshAllIndices();
} else {
count = countOfIndexedRandomDocuments();
}
Expand Down Expand Up @@ -708,7 +708,7 @@ public void testRecovery() throws Exception {
// Count the documents in the index to make sure we have as many as we put there
Request countRequest = new Request("GET", "/" + index + "/_search");
countRequest.addParameter("size", "0");
refresh();
refreshAllIndices();
Map<String, Object> countResponse = entityAsMap(client().performRequest(countRequest));
assertTotalHits(count, countResponse);

Expand Down Expand Up @@ -795,7 +795,7 @@ public void testSnapshotRestore() throws IOException {
}

// Refresh the index so the count doesn't fail
refresh();
refreshAllIndices();

// Count the documents in the index to make sure we have as many as we put there
Request countRequest = new Request("GET", "/" + index + "/_search");
Expand Down Expand Up @@ -935,7 +935,7 @@ public void testSoftDeletes() throws Exception {
Request request = new Request("POST", "/" + index + "/_doc/" + i);
request.setJsonEntity(doc);
client().performRequest(request);
refresh();
refreshAllIndices();
}
client().performRequest(new Request("POST", "/" + index + "/_flush"));
int liveDocs = numDocs;
Expand All @@ -951,7 +951,7 @@ public void testSoftDeletes() throws Exception {
liveDocs--;
}
}
refresh();
refreshAllIndices();
assertTotalHits(liveDocs, entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search"))));
saveInfoDocument(index + "_doc_count", Integer.toString(liveDocs));
} else {
Expand Down Expand Up @@ -979,10 +979,10 @@ public void testClosedIndices() throws Exception {
request.setJsonEntity(Strings.toString(JsonXContent.contentBuilder().startObject().field("field", "v1").endObject()));
assertOK(client().performRequest(request));
if (rarely()) {
refresh();
refreshAllIndices();
}
}
refresh();
refreshAllIndices();
}

assertTotalHits(numDocs, entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search"))));
Expand Down Expand Up @@ -1163,7 +1163,7 @@ private void indexRandomDocuments(
createDocument.setJsonEntity(Strings.toString(docSupplier.apply(i)));
client().performRequest(createDocument);
if (rarely()) {
refresh();
refreshAllIndices();
}
if (flushAllowed && rarely()) {
logger.debug("Flushing [{}]", index);
Expand Down Expand Up @@ -1205,11 +1205,6 @@ private String loadInfoDocument(String id) throws IOException {
return m.group(1);
}

private void refresh() throws IOException {
logger.debug("Refreshing [{}]", index);
client().performRequest(new Request("POST", "/" + index + "/_refresh"));
}

private List<String> dataNodes(String index, RestClient client) throws IOException {
Request request = new Request("GET", index + "/_stats");
request.addParameter("level", "shards");
Expand Down Expand Up @@ -1427,6 +1422,10 @@ public void testSystemIndexMetadataIsUpgraded() throws Exception {

// make sure .tasks index exists
Request getTasksIndex = new Request("GET", "/.tasks");
getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
v.current(systemIndexWarning);
v.compatible(systemIndexWarning);
}));
getTasksIndex.addParameter("allow_no_indices", "false");

getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
Expand All @@ -1452,6 +1451,10 @@ public void testSystemIndexMetadataIsUpgraded() throws Exception {
" {\"add\": {\"index\": \"test_index_reindex\", \"alias\": \"test-system-alias\"}}\n" +
" ]\n" +
"}");
putAliasRequest.setOptions(expectVersionSpecificWarnings(v -> {
v.current(systemIndexWarning);
v.compatible(systemIndexWarning);
}));
assertThat(client().performRequest(putAliasRequest).getStatusLine().getStatusCode(), is(200));
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public void testSystemIndicesUpgrades() throws Exception {

// make sure .tasks index exists
Request getTasksIndex = new Request("GET", "/.tasks");
getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
v.current(systemIndexWarning);
v.compatible(systemIndexWarning);
}));
getTasksIndex.addParameter("allow_no_indices", "false");

getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
Expand All @@ -96,6 +100,10 @@ public void testSystemIndicesUpgrades() throws Exception {
" {\"add\": {\"index\": \"test_index_reindex\", \"alias\": \"test-system-alias\"}}\n" +
" ]\n" +
"}");
putAliasRequest.setOptions(expectVersionSpecificWarnings(v -> {
v.current(systemIndexWarning);
v.compatible(systemIndexWarning);
}));
assertThat(client().performRequest(putAliasRequest).getStatusLine().getStatusCode(), is(200));
}
} else if (CLUSTER_TYPE == ClusterType.UPGRADED) {
Expand Down