Skip to content

Commit

Permalink
Move LegacyGeoShapeWithDocValuesQueryTests to N-2 compatibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cbuescher committed Jan 8, 2025
1 parent 3464adb commit 5ea85b8
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.http.entity.ContentType;
import org.apache.http.entity.InputStreamEntity;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.Strings;
Expand Down Expand Up @@ -53,7 +54,7 @@ public abstract class AbstractIndexCompatibilityTestCase extends ESRestTestCase

protected static final int NODES = 3;

private static TemporaryFolder REPOSITORY_PATH = new TemporaryFolder();
protected static TemporaryFolder REPOSITORY_PATH = new TemporaryFolder();

protected static LocalClusterConfigProvider clusterConfig = c -> {};
private static ElasticsearchCluster cluster = ElasticsearchCluster.local()
Expand Down Expand Up @@ -170,6 +171,17 @@ protected static void indexDocs(String indexName, int numDocs) throws Exception

protected static void mountIndex(String repository, String snapshot, String indexName, boolean partial, String renamedIndexName)
throws Exception {
mountIndex(repository, snapshot, indexName, partial, renamedIndexName, RequestOptions.DEFAULT);
}

protected static void mountIndex(
String repository,
String snapshot,
String indexName,
boolean partial,
String renamedIndexName,
RequestOptions options
) throws Exception {
var request = new Request("POST", "/_snapshot/" + repository + "/" + snapshot + "/_mount");
request.addParameter("wait_for_completion", "true");
var storage = partial ? "shared_cache" : "full_copy";
Expand All @@ -179,6 +191,7 @@ protected static void mountIndex(String repository, String snapshot, String inde
"index": "%s",
"renamed_index": "%s"
}""", indexName, renamedIndexName));
request.setOptions(options);
var responseBody = createFromResponse(client().performRequest(request));
assertThat(responseBody.evaluate("snapshot.shards.total"), equalTo((int) responseBody.evaluate("snapshot.shards.successful")));
assertThat(responseBody.evaluate("snapshot.shards.failed"), equalTo(0));
Expand Down
Loading

0 comments on commit 5ea85b8

Please sign in to comment.