Skip to content

Commit e401ab1

Browse files
committed
Handle deprecation warnings in a permissive manner.
Closes #37920
1 parent 0d10939 commit e401ab1

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
import org.apache.http.util.EntityUtils;
2323
import org.elasticsearch.Version;
2424
import org.elasticsearch.client.Request;
25+
import org.elasticsearch.client.RequestOptions;
2526
import org.elasticsearch.client.Response;
2627
import org.elasticsearch.client.ResponseException;
2728
import org.elasticsearch.client.RestClient;
29+
import org.elasticsearch.client.WarningsHandler;
2830
import org.elasticsearch.cluster.metadata.IndexMetaData;
2931
import org.elasticsearch.common.Booleans;
3032
import org.elasticsearch.common.CheckedFunction;
@@ -85,7 +87,6 @@ public void setIndex() throws IOException {
8587
index = getTestName().toLowerCase(Locale.ROOT);
8688
}
8789

88-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37920")
8990
public void testSearch() throws Exception {
9091
int count;
9192
if (isRunningAgainstOldCluster()) {
@@ -124,6 +125,9 @@ public void testSearch() throws Exception {
124125
mappingsAndSettings.endObject();
125126
Request createIndex = new Request("PUT", "/" + index);
126127
createIndex.setJsonEntity(Strings.toString(mappingsAndSettings));
128+
RequestOptions.Builder options = createIndex.getOptions().toBuilder();
129+
options.setWarningsHandler(WarningsHandler.PERMISSIVE);
130+
createIndex.setOptions(options);
127131
client().performRequest(createIndex);
128132

129133
count = randomIntBetween(2000, 3000);
@@ -153,7 +157,6 @@ public void testSearch() throws Exception {
153157
assertStoredBinaryFields(count);
154158
}
155159

156-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37920")
157160
public void testNewReplicasWork() throws Exception {
158161
if (isRunningAgainstOldCluster()) {
159162
XContentBuilder mappingsAndSettings = jsonBuilder();
@@ -180,6 +183,9 @@ public void testNewReplicasWork() throws Exception {
180183
mappingsAndSettings.endObject();
181184
Request createIndex = new Request("PUT", "/" + index);
182185
createIndex.setJsonEntity(Strings.toString(mappingsAndSettings));
186+
RequestOptions.Builder options = createIndex.getOptions().toBuilder();
187+
options.setWarningsHandler(WarningsHandler.PERMISSIVE);
188+
createIndex.setOptions(options);
183189
client().performRequest(createIndex);
184190

185191
int numDocs = randomIntBetween(2000, 3000);
@@ -332,7 +338,6 @@ public void testClusterState() throws Exception {
332338

333339
}
334340

335-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37920")
336341
public void testShrink() throws IOException {
337342
String shrunkenIndex = index + "_shrunk";
338343
int numDocs;
@@ -355,6 +360,9 @@ public void testShrink() throws IOException {
355360
mappingsAndSettings.endObject();
356361
Request createIndex = new Request("PUT", "/" + index);
357362
createIndex.setJsonEntity(Strings.toString(mappingsAndSettings));
363+
RequestOptions.Builder options = createIndex.getOptions().toBuilder();
364+
options.setWarningsHandler(WarningsHandler.PERMISSIVE);
365+
createIndex.setOptions(options);
358366
client().performRequest(createIndex);
359367

360368
numDocs = randomIntBetween(512, 1024);
@@ -401,7 +409,6 @@ public void testShrink() throws IOException {
401409
assertEquals(numDocs, totalHits);
402410
}
403411

404-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37920")
405412
public void testShrinkAfterUpgrade() throws IOException {
406413
String shrunkenIndex = index + "_shrunk";
407414
int numDocs;
@@ -424,6 +431,9 @@ public void testShrinkAfterUpgrade() throws IOException {
424431
mappingsAndSettings.endObject();
425432
Request createIndex = new Request("PUT", "/" + index);
426433
createIndex.setJsonEntity(Strings.toString(mappingsAndSettings));
434+
RequestOptions.Builder options = createIndex.getOptions().toBuilder();
435+
options.setWarningsHandler(WarningsHandler.PERMISSIVE);
436+
createIndex.setOptions(options);
427437
client().performRequest(createIndex);
428438

429439
numDocs = randomIntBetween(512, 1024);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
import org.apache.http.util.EntityUtils;
2323
import org.elasticsearch.client.Request;
24+
import org.elasticsearch.client.RequestOptions;
2425
import org.elasticsearch.client.Response;
26+
import org.elasticsearch.client.WarningsHandler;
2527
import org.elasticsearch.common.Strings;
2628
import org.elasticsearch.common.io.stream.InputStreamStreamInput;
2729
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
@@ -142,7 +144,6 @@ private static void addCandidate(String querySource, QueryBuilder expectedQb) {
142144
CANDIDATES.add(new Object[]{"{\"query\": {" + querySource + "}}", expectedQb});
143145
}
144146

145-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37920")
146147
public void testQueryBuilderBWC() throws Exception {
147148
String index = "queries";
148149
if (isRunningAgainstOldCluster()) {
@@ -179,6 +180,9 @@ public void testQueryBuilderBWC() throws Exception {
179180
}
180181
mappingsAndSettings.endObject();
181182
Request request = new Request("PUT", "/" + index);
183+
RequestOptions.Builder options = request.getOptions().toBuilder();
184+
options.setWarningsHandler(WarningsHandler.PERMISSIVE);
185+
request.setOptions(options);
182186
request.setJsonEntity(Strings.toString(mappingsAndSettings));
183187
Response rsp = client().performRequest(request);
184188
assertEquals(200, rsp.getStatusLine().getStatusCode());

0 commit comments

Comments
 (0)