ESQL: Assert no partial results in integration tests#129293
ESQL: Assert no partial results in integration tests#129293bpintea merged 5 commits intoelastic:mainfrom
Conversation
This injects assertions in spec-based and YAML integration tests that the received results aren't partial. This only happens in case the tests themselves don't set `"allow_partial_results": true`
| Map<String, Object> answer = runEsql(builder.query(query), testCase.assertWarnings(deduplicateExactWarnings())); | ||
|
|
||
| var isPartial = answer.get("is_partial"); | ||
| assertTrue("unexpected partial results", isPartial == null || (boolean) isPartial == false); |
There was a problem hiding this comment.
Might be easier to read with assertThat(..., anyOf(is(false), nullValue())). Dunno. Your call.
There was a problem hiding this comment.
Yes, better, thanks.
| var apiCallSection = doSection.getApiCallSection(); | ||
| if (apiCallSection.getApi().equals("esql.query")) { | ||
| // If `allow_partial_results` is explicitly set to true, partial results are allowed. | ||
| // If it's missing, no partial results are expected, even if the parameter's default is true. |
There was a problem hiding this comment.
It's a bit of magic, I think it's a pretty reasonable sacrifice.
|
|
||
| var isPartial = answer.get("is_partial"); | ||
| assertTrue("unexpected partial results", isPartial == null || (boolean) isPartial == false); | ||
|
|
There was a problem hiding this comment.
nit: can we also extract the failures and throw them?
There was a problem hiding this comment.
Good idea, I've extracted _clusters contents into the assertion message (we don't have more otherwise).
The changes apply to those suites too. |
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Thanks Nik and Nhat. |
💔 Backport failed
You can use sqren/backport to manually backport by running |
This extends the check that no partial results are returned to the rest of the JSON-based REST ITs. Related: #129293
…0213) This extends the check that no partial results are returned to the rest of the JSON-based REST ITs. Related: elastic#129293
…0213) This extends the check that no partial results are returned to the rest of the JSON-based REST ITs. Related: elastic#129293
This injects assertions in spec-based and YAML integration tests that the received results aren't partial.
This only happens in case the tests themselves don't set
"allow_partial_results": true.Closes #129256