Skip to content

Commit 4247581

Browse files
Fix failing UTs in old version
1 parent 6f34981 commit 4247581

File tree

1 file changed

+48
-2
lines changed
  • x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql

1 file changed

+48
-2
lines changed

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/230_folding.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ Top function with invalid sort order:
127127
---
128128

129129
SAMPLE function with constant folding:
130+
- requires:
131+
test_runner_features: [ capabilities ]
132+
capabilities:
133+
- method: POST
134+
path: /_query
135+
parameters: [ ]
136+
capabilities: [ sample_v3 ]
137+
reason: "Uses SAMPLE function"
130138
- do:
131139
esql.query:
132140
body:
@@ -142,6 +150,14 @@ SAMPLE function with constant folding:
142150
---
143151

144152
SAMPLE function with negative limit value after folding:
153+
- requires:
154+
test_runner_features: [ capabilities ]
155+
capabilities:
156+
- method: POST
157+
path: /_query
158+
parameters: [ ]
159+
capabilities: [ sample_v3 ]
160+
reason: "Uses SAMPLE function"
145161
- do:
146162
catch: bad_request
147163
esql.query:
@@ -189,11 +205,22 @@ MATCH function with non-foldable query:
189205
| WHERE MATCH(salary, salary + 10000 )
190206
| LIMIT 5
191207
- match: { error.type: "verification_exception" }
192-
- contains: { error.reason: "Query must be a valid string in [MATCH(salary, salary + 10000 )], found [salary + 10000]" }
208+
#We only check that the problematic string is there, because the error message is slightly different in old versions
209+
#"Query must be a valid string in [MATCH(salary, salary + 10000 )], found [salary + 10000]"
210+
#second argument of [MATCH(salary, salary + 10000 )] must be a constant, received [salary + 10000]
211+
- contains: { error.reason: "[MATCH(salary, salary + 10000 )]" }
193212

194213
---
195214

196215
Foldable query using MATCH_PHRASE on name:
216+
- requires:
217+
test_runner_features: [ capabilities ]
218+
capabilities:
219+
- method: POST
220+
path: /_query
221+
parameters: [ ]
222+
capabilities: [ match_phrase_function ]
223+
reason: "Uses MATCH_PHRASE function"
197224
- do:
198225
esql.query:
199226
body:
@@ -217,6 +244,14 @@ Foldable query using MATCH_PHRASE on name:
217244
---
218245

219246
Foldable query using MATCH_PHRASE on name but with non-foldable expression:
247+
- requires:
248+
test_runner_features: [ capabilities ]
249+
capabilities:
250+
- method: POST
251+
path: /_query
252+
parameters: [ ]
253+
capabilities: [ match_phrase_function ]
254+
reason: "Uses MATCH_PHRASE function"
220255
- do:
221256
catch: bad_request
222257
esql.query:
@@ -232,6 +267,14 @@ Foldable query using MATCH_PHRASE on name but with non-foldable expression:
232267
---
233268

234269
Foldable query using MATCH_PHRASE on name but with non constant query:
270+
- requires:
271+
test_runner_features: [ capabilities ]
272+
capabilities:
273+
- method: POST
274+
path: /_query
275+
parameters: [ ]
276+
capabilities: [ match_phrase_function ]
277+
reason: "Uses MATCH_PHRASE function"
235278
- do:
236279
catch: bad_request
237280
esql.query:
@@ -373,7 +416,10 @@ Foldable query using KQL on name but with non-foldable expression:
373416
| KEEP hire_date, salary, salary_change, salary_change_long, name
374417
| LIMIT 5
375418
- match: { error.type: "verification_exception" }
376-
- contains: { error.reason: "Query must be a valid string in [KQL(name)], found [name" }
419+
# We only check that the problematic string is there, because the error message is slightly different in old versions
420+
#Query must be a valid string in [KQL(name)], found [name
421+
#argument of [KQL(name)] must be a constant, received [name]
422+
- contains: { error.reason: "[KQL(name)]" }
377423

378424
---
379425

0 commit comments

Comments
 (0)