From 8805c1f11284905fb763d6783cf0e314b6f70a53 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Fri, 5 Jun 2020 15:49:44 +0200 Subject: [PATCH] Manually Craft CreateSnapshotRequest to fix BwC Test (#57661) (#57715) We can't use the high level create snapshot request any longer since we changed some of its default parameters in `8` and those are not understood by older versions like `7.4`. Closes #57650 --- .../upgrades/MultiVersionRepositoryAccessIT.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qa/repository-multi-version/src/test/java/org/elasticsearch/upgrades/MultiVersionRepositoryAccessIT.java b/qa/repository-multi-version/src/test/java/org/elasticsearch/upgrades/MultiVersionRepositoryAccessIT.java index 06f7f192654..f3b02c71578 100644 --- a/qa/repository-multi-version/src/test/java/org/elasticsearch/upgrades/MultiVersionRepositoryAccessIT.java +++ b/qa/repository-multi-version/src/test/java/org/elasticsearch/upgrades/MultiVersionRepositoryAccessIT.java @@ -21,7 +21,6 @@ package org.elasticsearch.upgrades; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; -import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStatus; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; @@ -291,7 +290,11 @@ public class MultiVersionRepositoryAccessIT extends ESRestTestCase { } private static void createSnapshot(RestHighLevelClient client, String repoName, String name, String index) throws IOException { - client.snapshot().create(new CreateSnapshotRequest(repoName, name).waitForCompletion(true).indices(index), RequestOptions.DEFAULT); + final Request createSnapshotRequest = new Request("PUT", "/_snapshot/" + repoName + "/" + name); + createSnapshotRequest.addParameter("wait_for_completion", "true"); + createSnapshotRequest.setJsonEntity("{ \"indices\" : \"" + index + "\"}"); + final Response response = client.getLowLevelClient().performRequest(createSnapshotRequest); + assertThat(response.getStatusLine().getStatusCode(), is(HttpURLConnection.HTTP_OK)); } private void createIndex(RestHighLevelClient client, String name, int shards) throws IOException {