Skip to content

Commit 27089e7

Browse files
authored
Handle deprecation warnings in "old cluster" parts of BWC tests (#63363)
This PR adjusts the BWC tests in to handle the deprecation warnings that are now emitted in old clusters due to the backport of system index access deprecation warnings.
1 parent 67be92c commit 27089e7

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ tasks.register("verifyVersions") {
174174
* after the backport of the backcompat code is complete.
175175
*/
176176

177-
boolean bwc_tests_enabled = false
178-
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/issues/63358"
177+
boolean bwc_tests_enabled = true
178+
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
179179
if (bwc_tests_enabled == false) {
180180
if (bwc_tests_disabled_issue.isEmpty()) {
181181
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")

qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void testSearch() throws Exception {
143143
.field("binary", Base64.getEncoder().encodeToString(randomByteArray))
144144
.endObject()
145145
);
146-
refresh();
146+
refreshAllIndices();
147147
} else {
148148
count = countOfIndexedRandomDocuments();
149149
}
@@ -708,7 +708,7 @@ public void testRecovery() throws Exception {
708708
// Count the documents in the index to make sure we have as many as we put there
709709
Request countRequest = new Request("GET", "/" + index + "/_search");
710710
countRequest.addParameter("size", "0");
711-
refresh();
711+
refreshAllIndices();
712712
Map<String, Object> countResponse = entityAsMap(client().performRequest(countRequest));
713713
assertTotalHits(count, countResponse);
714714

@@ -795,7 +795,7 @@ public void testSnapshotRestore() throws IOException {
795795
}
796796

797797
// Refresh the index so the count doesn't fail
798-
refresh();
798+
refreshAllIndices();
799799

800800
// Count the documents in the index to make sure we have as many as we put there
801801
Request countRequest = new Request("GET", "/" + index + "/_search");
@@ -935,7 +935,7 @@ public void testSoftDeletes() throws Exception {
935935
Request request = new Request("POST", "/" + index + "/_doc/" + i);
936936
request.setJsonEntity(doc);
937937
client().performRequest(request);
938-
refresh();
938+
refreshAllIndices();
939939
}
940940
client().performRequest(new Request("POST", "/" + index + "/_flush"));
941941
int liveDocs = numDocs;
@@ -951,7 +951,7 @@ public void testSoftDeletes() throws Exception {
951951
liveDocs--;
952952
}
953953
}
954-
refresh();
954+
refreshAllIndices();
955955
assertTotalHits(liveDocs, entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search"))));
956956
saveInfoDocument(index + "_doc_count", Integer.toString(liveDocs));
957957
} else {
@@ -979,10 +979,10 @@ public void testClosedIndices() throws Exception {
979979
request.setJsonEntity(Strings.toString(JsonXContent.contentBuilder().startObject().field("field", "v1").endObject()));
980980
assertOK(client().performRequest(request));
981981
if (rarely()) {
982-
refresh();
982+
refreshAllIndices();
983983
}
984984
}
985-
refresh();
985+
refreshAllIndices();
986986
}
987987

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

1208-
private void refresh() throws IOException {
1209-
logger.debug("Refreshing [{}]", index);
1210-
client().performRequest(new Request("POST", "/" + index + "/_refresh"));
1211-
}
1212-
12131208
private List<String> dataNodes(String index, RestClient client) throws IOException {
12141209
Request request = new Request("GET", index + "/_stats");
12151210
request.addParameter("level", "shards");
@@ -1427,6 +1422,10 @@ public void testSystemIndexMetadataIsUpgraded() throws Exception {
14271422

14281423
// make sure .tasks index exists
14291424
Request getTasksIndex = new Request("GET", "/.tasks");
1425+
getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
1426+
v.current(systemIndexWarning);
1427+
v.compatible(systemIndexWarning);
1428+
}));
14301429
getTasksIndex.addParameter("allow_no_indices", "false");
14311430

14321431
getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
@@ -1452,6 +1451,10 @@ public void testSystemIndexMetadataIsUpgraded() throws Exception {
14521451
" {\"add\": {\"index\": \"test_index_reindex\", \"alias\": \"test-system-alias\"}}\n" +
14531452
" ]\n" +
14541453
"}");
1454+
putAliasRequest.setOptions(expectVersionSpecificWarnings(v -> {
1455+
v.current(systemIndexWarning);
1456+
v.compatible(systemIndexWarning);
1457+
}));
14551458
assertThat(client().performRequest(putAliasRequest).getStatusLine().getStatusCode(), is(200));
14561459
}
14571460
} else {

qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SystemIndicesUpgradeIT.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public void testSystemIndicesUpgrades() throws Exception {
7171

7272
// make sure .tasks index exists
7373
Request getTasksIndex = new Request("GET", "/.tasks");
74+
getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
75+
v.current(systemIndexWarning);
76+
v.compatible(systemIndexWarning);
77+
}));
7478
getTasksIndex.addParameter("allow_no_indices", "false");
7579

7680
getTasksIndex.setOptions(expectVersionSpecificWarnings(v -> {
@@ -96,6 +100,10 @@ public void testSystemIndicesUpgrades() throws Exception {
96100
" {\"add\": {\"index\": \"test_index_reindex\", \"alias\": \"test-system-alias\"}}\n" +
97101
" ]\n" +
98102
"}");
103+
putAliasRequest.setOptions(expectVersionSpecificWarnings(v -> {
104+
v.current(systemIndexWarning);
105+
v.compatible(systemIndexWarning);
106+
}));
99107
assertThat(client().performRequest(putAliasRequest).getStatusLine().getStatusCode(), is(200));
100108
}
101109
} else if (CLUSTER_TYPE == ClusterType.UPGRADED) {

0 commit comments

Comments
 (0)