Skip to content

Commit 3835988

Browse files
committed
Run tests with allow_partial_results set to false
This switches spec-based integration and YAML tests to run with `"allow_partial_results": false` to conteract the default, set to `true`.
1 parent 385e0d9 commit 3835988

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
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;
1315

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

2325
@ParametersFactory
2426
public static Iterable<Object[]> parameters() throws Exception {
25-
return createParameters();
27+
return updateEsqlQueryDoSections(createParameters(), EsqlClientYamlIT::modifyEsqlQueryExecutableSection);
2628
}
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+
2740
}

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ protected void doTest() throws Throwable {
266266
protected final void doTest(String query) throws Throwable {
267267
RequestObjectBuilder builder = new RequestObjectBuilder(randomFrom(XContentType.values()));
268268

269+
builder.query(query);
270+
builder.allowPartialResults(false); // we want any error to fail the test
269271
if (query.toUpperCase(Locale.ROOT).contains("LOOKUP_\uD83D\uDC14")) {
270272
builder.tables(tables());
271273
}
272274

273275
Map<?, ?> prevTooks = supportsTook() ? tooks() : null;
274-
Map<String, Object> answer = runEsql(builder.query(query), testCase.assertWarnings(deduplicateExactWarnings()));
276+
Map<String, Object> answer = runEsql(builder, testCase.assertWarnings(deduplicateExactWarnings()));
275277

276278
var expectedColumnsWithValues = loadCsvSpecValues(testCase.expectedResults);
277279

@@ -296,7 +298,7 @@ protected final void doTest(String query) throws Throwable {
296298
}
297299
}
298300

299-
private Map<?, ?> tooks() throws IOException {
301+
private static Map<?, ?> tooks() throws IOException {
300302
Request request = new Request("GET", "/_xpack/usage");
301303
HttpEntity entity = client().performRequest(request).getEntity();
302304
Map<?, ?> usage = XContentHelper.convertToMap(XContentType.JSON.xContent(), entity.getContent(), false);

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

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

0 commit comments

Comments
 (0)