Skip to content

Commit fc7629f

Browse files
committed
Add test ensure we can execute update requests in mixed cluster
Relates #42596
1 parent 7ada41b commit fc7629f

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.elasticsearch.index.IndexSettings;
3434
import org.elasticsearch.rest.RestStatus;
3535
import org.elasticsearch.rest.action.document.RestIndexAction;
36+
import org.elasticsearch.rest.action.document.RestUpdateAction;
3637
import org.elasticsearch.test.rest.yaml.ObjectPath;
3738
import org.hamcrest.Matcher;
3839

@@ -572,4 +573,23 @@ private void ensureGlobalCheckpointSynced(String index) throws Exception {
572573
});
573574
}, 60, TimeUnit.SECONDS);
574575
}
576+
577+
/** Ensure that we can always execute update requests regardless of the version of cluster */
578+
public void testUpdateDoc() throws Exception {
579+
final String index = "test_update_doc";
580+
if (CLUSTER_TYPE == ClusterType.OLD) {
581+
Settings.Builder settings = Settings.builder()
582+
.put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1)
583+
.put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2);
584+
createIndex(index, settings.build());
585+
}
586+
ensureGreen(index);
587+
indexDocs(index, 0, 10);
588+
for (int i = 0; i < 10; i++) {
589+
Request update = new Request("POST", index + "/test/" + i + "/_update/");
590+
update.setOptions(expectWarnings(RestUpdateAction.TYPES_DEPRECATION_MESSAGE));
591+
update.setJsonEntity("{\"doc\": {\"f\": " + randomNonNegativeLong() + "}}");
592+
client().performRequest(update);
593+
}
594+
}
575595
}

0 commit comments

Comments
 (0)