Skip to content

Commit 98f8b32

Browse files
committed
test: check ES|QL SAMPLE capability before running analyzer/parser tests (elastic#127382)
This commit resolves release test failures by checking the ES|QL SAMPLE capability before running the tests.
1 parent d81660d commit 98f8b32

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
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
@@ -3167,6 +3167,8 @@ private boolean isMultiTypeEsField(Expression e) {
31673167
}
31683168

31693169
public void testRandomSampleProbability() {
3170+
assumeTrue("requires SAMPLE capability", EsqlCapabilities.Cap.SAMPLE.isEnabled());
3171+
31703172
var e = expectThrows(VerificationException.class, () -> analyze("FROM test | SAMPLE 1."));
31713173
assertThat(e.getMessage(), containsString("RandomSampling probability must be strictly between 0.0 and 1.0, was [1.0]"));
31723174

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
@@ -3454,6 +3454,7 @@ public void testInvalidCompletion() {
34543454
}
34553455

34563456
public void testSample() {
3457+
assumeTrue("SAMPLE requires corresponding capability", EsqlCapabilities.Cap.SAMPLE.isEnabled());
34573458
expectError("FROM test | SAMPLE .1 2 3", "line 1:25: extraneous input '3' expecting <EOF>");
34583459
expectError("FROM test | SAMPLE .1 \"2\"", "line 1:23: extraneous input '\"2\"' expecting <EOF>");
34593460
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ setup:
123123
- do: {xpack.usage: {}}
124124
- match: { esql.available: true }
125125
- match: { esql.enabled: true }
126-
- length: { esql.features: 21 }
126+
- length: { esql.features: 22 }
127127
- set: {esql.features.dissect: dissect_counter}
128128
- set: {esql.features.drop: drop_counter}
129129
- set: {esql.features.eval: eval_counter}
@@ -143,6 +143,7 @@ setup:
143143
- set: {esql.features.lookup: lookup_counter}
144144
- set: {esql.features.change_point: change_point_counter}
145145
- set: {esql.features.inlinestats: inlinestats_counter}
146+
- set: {esql.features.sample: sample_counter}
146147
- length: { esql.queries: 3 }
147148
- set: {esql.queries.rest.total: rest_total_counter}
148149
- set: {esql.queries.rest.failed: rest_failed_counter}

0 commit comments

Comments
 (0)