-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ESQL: Make esql version required in REST requests (#107433)
* Enable corresponding validation in EsqlQueryRequest. * Add the ESQL version to requests to /_query in integration tests. * In mixed cluster tests for versions prior to 8.13.3, impersonate an 8.13 client and do not send any version. --------- Co-authored-by: Nik Everett <[email protected]>
- Loading branch information
1 parent
624a5b1
commit 1e4d4da
Showing
55 changed files
with
600 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...r/src/main/java/org/elasticsearch/test/rest/yaml/ImpersonateOfficialClientTestClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.test.rest.yaml; | ||
|
||
import org.apache.http.HttpEntity; | ||
import org.apache.http.HttpHost; | ||
import org.elasticsearch.client.NodeSelector; | ||
import org.elasticsearch.client.RestClient; | ||
import org.elasticsearch.client.RestClientBuilder; | ||
import org.elasticsearch.common.CheckedSupplier; | ||
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestApi; | ||
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestSpec; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.BiPredicate; | ||
|
||
/** | ||
* Impersonates an official test client by setting the @{code x-elastic-client-meta} header. | ||
*/ | ||
public class ImpersonateOfficialClientTestClient extends ClientYamlTestClient { | ||
private final String meta; | ||
|
||
public ImpersonateOfficialClientTestClient( | ||
ClientYamlSuiteRestSpec restSpec, | ||
RestClient restClient, | ||
List<HttpHost> hosts, | ||
CheckedSupplier<RestClientBuilder, IOException> clientBuilderWithSniffedNodes, | ||
String meta | ||
) { | ||
super(restSpec, restClient, hosts, clientBuilderWithSniffedNodes); | ||
this.meta = meta; | ||
} | ||
|
||
@Override | ||
public ClientYamlTestResponse callApi( | ||
String apiName, | ||
Map<String, String> params, | ||
HttpEntity entity, | ||
Map<String, String> headers, | ||
NodeSelector nodeSelector, | ||
BiPredicate<ClientYamlSuiteRestApi, ClientYamlSuiteRestApi.Path> pathPredicate | ||
) throws IOException { | ||
headers.put("x-elastic-client-meta", meta); | ||
return super.callApi(apiName, params, entity, headers, nodeSelector, pathPredicate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.