Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#4202] feat(trino-connector): Add addition parameters in TrinoQueryTestTool (#4203)

Yuhui7ae4e22de808
diff --git a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
index 1419164573..b7575f94f8 100644
--- a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
+++ b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
@@ -54,19 +54,19 @@ import org.slf4j.LoggerFactory;
public class TrinoQueryIT extends TrinoQueryITBase {
private static final Logger LOG = LoggerFactory.getLogger(TrinoQueryIT.class);
- protected static String testsetsDir = "";
- protected AtomicInteger passCount = new AtomicInteger(0);
- protected AtomicInteger totalCount = new AtomicInteger(0);
- protected static boolean exitOnFailed = true;
+ static String testsetsDir = "";
+ AtomicInteger passCount = new AtomicInteger(0);
+ AtomicInteger totalCount = new AtomicInteger(0);
+ static boolean exitOnFailed = true;
// key: tester name, value: tester result
private static Map<String, TestStatus> allTestStatus = new TreeMap<>();
private static int testParallelism = 2;
- private static Map<String, String> queryParams = new HashMap<>();
+ static Map<String, String> queryParams = new HashMap<>();
- public static Set<String> ciTestsets = new HashSet<>();
+ static Set<String> ciTestsets = new HashSet<>();
static {
testsetsDir = TrinoQueryIT.class.getClassLoader().getResource("trino-ci-testset").getPath();
diff --git a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
index 0bda5f28c6..236e994b0d 100644
--- a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
+++ b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
@@ -73,6 +73,12 @@ public class TrinoQueryTestTool {
options.addOption("tester_id", true, "Specify the tester file name prefix to select to test");
options.addOption("catalog", true, "Specify the catalog name to test");
+ options.addOption(
+ "params",
+ true,
+ "Additional parameters that can replace the value of ${key} in the testers contents, "
+ + "example: --params=key1,v1;key2,v2");
+
options.addOption("help", false, "Print this help message");
CommandLineParser parser = new PosixParser();
@@ -113,7 +119,7 @@ public class TrinoQueryTestTool {
break;
default:
System.out.println("The value of --auto must be 'all', 'gravitino' or 'none'");
- return;
+ System.exit(1);
}
}
@@ -139,6 +145,22 @@ public class TrinoQueryTestTool {
TrinoQueryIT.postgresqlUri =
Strings.isBlank(postgresqlUri) ? TrinoQueryIT.postgresqlUri : postgresqlUri;
+ String params = commandLine.getOptionValue("params");
+ if (Strings.isNotBlank(params)) {
+ for (String param : params.split(";")) {
+ String[] split = param.split(",");
+ String key = split[0].trim();
+ String value = split[1].trim();
+ if (Strings.isNotBlank(key) && Strings.isNotBlank(value)) {
+ TrinoQueryIT.queryParams.put(key, value);
+ } else {
+ System.out.println(
+ "Invalid parameters:" + param + "The format should like --params=key1,v1;key2,v2");
+ System.exit(1);
+ }
+ }
+ }
+
String testSet = commandLine.getOptionValue("test_set");
String testerId = commandLine.getOptionValue("tester_id", "");
String catalog = commandLine.getOptionValue("catalog", "");