Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -219,6 +220,17 @@ public Object[][] scenarioProvider() throws Exception {
ScenarioTestRunner runner = new ScenarioTestRunner(scenariosDir, Map.of());
List<String> scenarios = runner.discoverScenarios();

String filtered = System.getProperty("scenario");
if (filtered != null && !filtered.isBlank()) {
List<String> 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];
Expand Down
8 changes: 3 additions & 5 deletions ice-rest-catalog/src/test/resources/scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<name>` (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
```



Loading