From 0bc376c60a40e9f67b19ff2dd886472a318b78fe Mon Sep 17 00:00:00 2001 From: Andrew Xie Date: Thu, 7 May 2026 13:21:21 -0400 Subject: [PATCH] test: Add property to filter specific scenario tests to run --- .../ice/rest/catalog/RESTCatalogTestBase.java | 12 ++++++++++++ .../src/test/resources/scenarios/README.md | 8 +++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/RESTCatalogTestBase.java b/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/RESTCatalogTestBase.java index bfdc07cd..b8b6d664 100644 --- a/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/RESTCatalogTestBase.java +++ b/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/RESTCatalogTestBase.java @@ -20,6 +20,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.iceberg.catalog.Catalog; @@ -219,6 +220,17 @@ public Object[][] scenarioProvider() throws Exception { ScenarioTestRunner runner = new ScenarioTestRunner(scenariosDir, Map.of()); List scenarios = runner.discoverScenarios(); + String filtered = System.getProperty("scenario"); + if (filtered != null && !filtered.isBlank()) { + List requested = + Arrays.stream(filtered.split(",")).map(String::trim).filter(s -> !s.isEmpty()).toList(); + scenarios = scenarios.stream().filter(requested::contains).toList(); + if (scenarios.isEmpty()) { + throw new IllegalArgumentException( + "No scenarios matched -Dscenario=" + filtered + " in " + scenariosDir); + } + } + if (scenarios.isEmpty()) { logger.warn("No test scenarios found in: {}", scenariosDir); return new Object[0][0]; diff --git a/ice-rest-catalog/src/test/resources/scenarios/README.md b/ice-rest-catalog/src/test/resources/scenarios/README.md index feb6de3e..96d34ab8 100644 --- a/ice-rest-catalog/src/test/resources/scenarios/README.md +++ b/ice-rest-catalog/src/test/resources/scenarios/README.md @@ -98,11 +98,9 @@ Scenarios are discovered and executed automatically by the `ScenarioBasedIT` tes mvn test -Dtest=ScenarioBasedIT ``` -To run a specific scenario: +To run a specific scenario, pass `-Dscenario=` (comma-separated for multiple): ```bash -mvn test -Dtest=ScenarioBasedIT#testScenario[basic-operations] +mvn test -Dtest=ScenarioBasedIT -Dscenario=basic-operations +mvn test -Dtest=ScenarioBasedIT -Dscenario=basic-operations,describe-parquet ``` - - -