Skip to content

Commit 132a531

Browse files
committed
Add test ensure we can execute update requests in mixed cluster
Relates #42596
1 parent 931174b commit 132a531

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

+20
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.elasticsearch.common.xcontent.support.XContentMapValues;
3131
import org.elasticsearch.index.IndexSettings;
3232
import org.elasticsearch.rest.action.document.RestIndexAction;
33+
import org.elasticsearch.rest.action.document.RestUpdateAction;
3334
import org.elasticsearch.test.rest.yaml.ObjectPath;
3435

3536
import java.io.IOException;
@@ -334,4 +335,23 @@ public void testRecoveryWithSoftDeletes() throws Exception {
334335
}
335336
ensureGreen(index);
336337
}
338+
339+
/** Ensure that we can always execute update requests regardless of the version of cluster */
340+
public void testUpdateDoc() throws Exception {
341+
final String index = "test_update_doc";
342+
if (CLUSTER_TYPE == ClusterType.OLD) {
343+
Settings.Builder settings = Settings.builder()
344+
.put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1)
345+
.put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2);
346+
createIndex(index, settings.build());
347+
}
348+
ensureGreen(index);
349+
indexDocs(index, 0, 10);
350+
for (int i = 0; i < 10; i++) {
351+
Request update = new Request("POST", index + "/test/" + i + "/_update/");
352+
update.setOptions(expectWarnings(RestUpdateAction.TYPES_DEPRECATION_MESSAGE));
353+
update.setJsonEntity("{\"doc\": {\"f\": " + randomNonNegativeLong() + "}}");
354+
client().performRequest(update);
355+
}
356+
}
337357
}

0 commit comments

Comments
 (0)