Skip to content

Commit 6dfb824

Browse files
authored
test: check ES|QL SAMPLE capability before running analyzer/parser tests (#127382)
This commit resolves release test failures by checking the ES|QL SAMPLE capability before running the tests.
1 parent c3e8a9f commit 6dfb824

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,6 +3405,8 @@ public void testRrfError() {
34053405
}
34063406

34073407
public void testRandomSampleProbability() {
3408+
assumeTrue("requires SAMPLE capability", EsqlCapabilities.Cap.SAMPLE.isEnabled());
3409+
34083410
var e = expectThrows(VerificationException.class, () -> analyze("FROM test | SAMPLE 1."));
34093411
assertThat(e.getMessage(), containsString("RandomSampling probability must be strictly between 0.0 and 1.0, was [1.0]"));
34103412

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,6 +3486,7 @@ public void testInvalidCompletion() {
34863486
}
34873487

34883488
public void testSample() {
3489+
assumeTrue("SAMPLE requires corresponding capability", EsqlCapabilities.Cap.SAMPLE.isEnabled());
34893490
expectError("FROM test | SAMPLE .1 2 3", "line 1:25: extraneous input '3' expecting <EOF>");
34903491
expectError("FROM test | SAMPLE .1 \"2\"", "line 1:23: extraneous input '\"2\"' expecting <EOF>");
34913492
expectError("FROM test | SAMPLE 1", "line 1:20: mismatched input '1' expecting {DECIMAL_LITERAL, '+', '-'}");

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ setup:
139139
- do: {xpack.usage: {}}
140140
- match: { esql.available: true }
141141
- match: { esql.enabled: true }
142-
- length: { esql.features: 25 }
142+
- length: { esql.features: 26 }
143143
- set: {esql.features.dissect: dissect_counter}
144144
- set: {esql.features.drop: drop_counter}
145145
- set: {esql.features.eval: eval_counter}
@@ -165,6 +165,7 @@ setup:
165165
- set: {esql.features.fork: fork_counter}
166166
- set: {esql.features.rrf: rrf_counter}
167167
- set: {esql.features.completion: completion_counter}
168+
- set: {esql.features.sample: sample_counter}
168169
- length: { esql.queries: 3 }
169170
- set: {esql.queries.rest.total: rest_total_counter}
170171
- set: {esql.queries.rest.failed: rest_failed_counter}
@@ -220,7 +221,7 @@ setup:
220221
- gt: {esql.functions.to_long: $functions_to_long}
221222
- match: {esql.functions.coalesce: $functions_coalesce}
222223
- gt: {esql.functions.categorize: $functions_categorize}
223-
- length: {esql.functions: 131} # check the "sister" test above for a likely update to the same esql.functions length check
224+
- length: {esql.functions: 132} # check the "sister" test above for a likely update to the same esql.functions length check
224225

225226
---
226227
took:

0 commit comments

Comments
 (0)