Skip to content

Commit b271174

Browse files
nik9000gmjehovich
authored andcommitted
ESQL: Replace function count tests (elastic#134951)
Replaces the tests for a count of functions with a spot check of some specific functions. `delay` should never be released. `idelta` isn't released but will be. `mv_sum` has been released. It's nice to have the ones we want to make sure aren't available in production in there, but otherwise it's a fairly random list. Doing this because maintaining the count was constantly a problem - folks would stumble over it all the time and it wasn't really buying us anything.
1 parent 3bd28cc commit b271174

File tree

2 files changed

+18
-6
lines changed
  • x-pack/plugin
    • esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar
    • src/yamlRestTest/resources/rest-api-spec/test/esql

2 files changed

+18
-6
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/package-info.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@
223223
* When it comes to the correct syntax, e.g.: annotations, groupings, etc., feel free to look at existing snapshot functions and
224224
* Git history.
225225
*
226-
* Depending on whether the new function requires a snapshot build, you may need to increment the expected ES|QL functions count in
227-
* one or both places in {@code x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml}. You can also run
228-
* these tests locally, just make sure to pass the right flags so you can toggle between snapshot and non-snapshot tests.
226+
* If your function should be available in snapshot <strong>only</strong>, add it to the list in
227+
* {@code x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml} around
228+
* {@code not_exists: esql.functions.delay}. The release build will fail if this function is
229+
* available. Check out the instructions for running a release build in {@code testing.asciidoc}
230+
* if you want to test this, but it's generally enough to let CI do it.
229231
* </li>
230232
* <li>
231233
* Open the PR. The subject and description of the PR are important because those'll turn

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ setup:
133133
- gt: { esql.functions.to_long: $functions_to_long }
134134
- match: { esql.functions.coalesce: $functions_coalesce }
135135
- gt: { esql.functions.categorize: $functions_categorize }
136-
# Testing for the entire function set isn't feasible, so we just check that we return the correct count as an approximation.
137-
# - length: {esql.functions: 179} # check the "sister" test below for a likely update to the same esql.functions length check
136+
137+
# There's one of these per function but that's a ton of things to check. So we just spot check that a few exist.
138+
- exists: esql.functions.delay
139+
- exists: esql.functions.idelta
140+
- exists: esql.functions.mv_sum
141+
- exists: esql.functions.to_dateperiod
142+
138143
---
139144
"Basic ESQL usage output (telemetry) non-snapshot version":
140145
- requires:
@@ -231,7 +236,12 @@ setup:
231236
- gt: { esql.functions.to_long: $functions_to_long }
232237
- match: { esql.functions.coalesce: $functions_coalesce }
233238
- gt: { esql.functions.categorize: $functions_categorize }
234-
# - length: {esql.functions: 151} # check the "sister" test above for a likely update to the same esql.functions length check
239+
240+
# There's one of these per function but that's a ton of things to check. So we just spot check that a few exist.
241+
- not_exists: esql.functions.delay
242+
- not_exists: esql.functions.idelta
243+
- exists: esql.functions.mv_sum
244+
- exists: esql.functions.to_dateperiod
235245

236246
---
237247
took:

0 commit comments

Comments
 (0)