Skip to content

Commit 659b1da

Browse files
committed
Review feedback
1 parent 3835988 commit 659b1da

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

x-pack/plugin/esql/qa/server/single-node/src/yamlRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/AbstractEsqlClientYamlIT.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ private void assertRequestBreakerEmpty() throws Exception {
5151
EsqlSpecTestCase.assertRequestBreakerEmpty();
5252
}
5353

54+
public static Iterable<Object[]> partialResultsDisablingParameters() throws Exception {
55+
return updateEsqlQueryDoSections(createParameters(), AbstractEsqlClientYamlIT::modifyEsqlQueryExecutableSection);
56+
}
57+
58+
private static ExecutableSection modifyEsqlQueryExecutableSection(DoSection doSection) {
59+
var apiCallSection = doSection.getApiCallSection();
60+
if (apiCallSection.getApi().equals("esql.query")) {
61+
if (apiCallSection.getParams().containsKey("allow_partial_results") == false) {
62+
apiCallSection.addParam("allow_partial_results", "false"); // we want any error to fail the test
63+
}
64+
}
65+
return doSection;
66+
}
67+
5468
public static Iterable<Object[]> updateEsqlQueryDoSections(Iterable<Object[]> parameters, Function<DoSection, ExecutableSection> modify)
5569
throws Exception {
5670
List<Object[]> result = new ArrayList<>();

x-pack/plugin/esql/qa/server/single-node/src/yamlRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlClientYamlAsyncIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public EsqlClientYamlAsyncIT(final ClientYamlTestCandidate testCandidate) {
2626

2727
@ParametersFactory
2828
public static Iterable<Object[]> parameters() throws Exception {
29-
return updateEsqlQueryDoSections(createParameters(), doSection -> {
29+
return updateEsqlQueryDoSections(partialResultsDisablingParameters(), doSection -> {
3030
ApiCallSection copy = doSection.getApiCallSection().copyWithNewApi("esql.async_query");
3131
for (Map<String, Object> body : copy.getBodies()) {
3232
body.put("wait_for_completion_timeout", "30m");

x-pack/plugin/esql/qa/server/single-node/src/yamlRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlClientYamlAsyncSubmitAndFetchIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public EsqlClientYamlAsyncSubmitAndFetchIT(final ClientYamlTestCandidate testCan
3232

3333
@ParametersFactory
3434
public static Iterable<Object[]> parameters() throws Exception {
35-
return updateEsqlQueryDoSections(createParameters(), DoEsqlAsync::new);
35+
return updateEsqlQueryDoSections(partialResultsDisablingParameters(), DoEsqlAsync::new);
3636
}
3737

3838
private static class DoEsqlAsync implements ExecutableSection {

x-pack/plugin/esql/qa/server/single-node/src/yamlRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlClientYamlIT.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1111

1212
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
13-
import org.elasticsearch.test.rest.yaml.section.DoSection;
14-
import org.elasticsearch.test.rest.yaml.section.ExecutableSection;
1513

1614
/**
1715
* Run the ESQL yaml tests against the synchronous API.
@@ -24,17 +22,6 @@ public EsqlClientYamlIT(final ClientYamlTestCandidate testCandidate) {
2422

2523
@ParametersFactory
2624
public static Iterable<Object[]> parameters() throws Exception {
27-
return updateEsqlQueryDoSections(createParameters(), EsqlClientYamlIT::modifyEsqlQueryExecutableSection);
25+
return partialResultsDisablingParameters();
2826
}
29-
30-
private static ExecutableSection modifyEsqlQueryExecutableSection(DoSection doSection) {
31-
var apiCallSection = doSection.getApiCallSection();
32-
if (apiCallSection.getApi().equals("esql.query")) {
33-
if (apiCallSection.getParams().containsKey("allow_partial_results") == false) {
34-
apiCallSection.addParam("allow_partial_results", "false"); // we want any error to fail the test
35-
}
36-
}
37-
return doSection;
38-
}
39-
4027
}

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/63_enrich_int_range.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,5 +203,6 @@ teardown:
203203
- do:
204204
catch: /ENRICH range and input types are incompatible. range\[INTEGER\], input\[DOUBLE\]/
205205
esql.query:
206+
allow_partial_results: false
206207
body:
207208
query: 'FROM employees | ENRICH ages-policy ON salary | STATS count=COUNT(*) BY description | SORT count DESC, description ASC'

0 commit comments

Comments
 (0)