diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-count-over-time.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-count-over-time.csv-spec index 74340b4336b07..447e6d90716b6 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-count-over-time.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-count-over-time.csv-spec @@ -178,9 +178,8 @@ last_up:long | cluster:keyword | time_bucket:date_nanos 5 | staging | 2024-05-10T00:20:00.000Z ; -count_over_time_of_date_nanos_promql +count_over_time_of_date_nanos_promql-Ignore required_capability: promql_command_v0 -required_capability: promql_date_nanos_support_v0 PROMQL index=datenanos-k8s step=10m last_up=(max by (cluster) (count_over_time(network.eth0.last_up[10m]))) | SORT step, cluster | LIMIT 10; diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/rerank.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/rerank.csv-spec index 56d79fef13e37..8221060e4bc32 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/rerank.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/rerank.csv-spec @@ -236,9 +236,8 @@ FINAL WITNESS | 1.4 // end::two-queries-result[] ; -combine +combine-Ignore required_capability: rerank -required_capability: rerank_combine // tag::combine[] FROM books METADATA _score diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java index b6c1ffb2aa003..d9f23759aace7 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java @@ -134,7 +134,9 @@ import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import java.util.stream.Stream; +import static java.util.stream.Collectors.toSet; import static org.elasticsearch.xpack.esql.CsvSpecReader.specParser; import static org.elasticsearch.xpack.esql.CsvTestUtils.ExpectedResults; import static org.elasticsearch.xpack.esql.CsvTestUtils.isEnabled; @@ -196,6 +198,10 @@ // @TestLogging(value = "org.elasticsearch.xpack.esql:TRACE,org.elasticsearch.compute:TRACE", reason = "debug") public class CsvTests extends ESTestCase { + private static final Set ALL_ESQL_CAPABILITIES = Stream.of(EsqlCapabilities.Cap.values()) + .map(EsqlCapabilities.Cap::capabilityName) + .collect(toSet()); + private static final Logger LOGGER = LogManager.getLogger(CsvTests.class); private final String fileName; @@ -278,6 +284,9 @@ public CsvTests( public final void test() throws Throwable { try { + for (String capability : testCase.requiredCapabilities) { + assertTrue("Requested capability does not exist: " + capability, ALL_ESQL_CAPABILITIES.contains(capability)); + } assumeTrueLogging("Test " + testName + " is not enabled", isEnabled(testName, instructions, Version.CURRENT)); /* * The csv tests support all but a few features. The unsupported features @@ -549,7 +558,7 @@ private static MergedResult mergeMappings(List mappingsPerIndex .stream() .filter(e -> e.getValue().size() < numberOfIndices) .map(Map.Entry::getKey) - .collect(Collectors.toSet()); + .collect(toSet()); var mappings = columnNamesToFieldByIndices.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> mergeFields(e.getKey(), e.getValue())));