From 98963bf3ce24753e4c7426910b6a6cd959da7792 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Wed, 11 Oct 2023 14:52:54 +0200 Subject: [PATCH 1/2] Support injecting system properties into JUnit tests This PR switched ensureTestNamingConvention to run in JUnit to reduce test setups --- .../deltalake/TestDeltaLakeAdlsStorage.java | 14 +++-- plugin/trino-hive-hadoop2/pom.xml | 6 ++ .../hive/TestHiveThriftMetastoreWithS3.java | 19 +++---- .../TestIcebergAbfsConnectorSmokeTest.java | 14 +++-- testing/trino-testing-containers/pom.xml | 2 +- testing/trino-testing-kafka/pom.xml | 2 +- testing/trino-testing-services/pom.xml | 5 ++ .../SystemPropertyParameterResolver.java | 57 +++++++++++++++++++ .../TestSystemPropertyParameterResolver.java | 40 +++++++++++++ .../testing/AbstractTestQueryFramework.java | 2 +- 10 files changed, 135 insertions(+), 26 deletions(-) create mode 100644 testing/trino-testing-services/src/main/java/io/trino/junit/SystemPropertyParameterResolver.java create mode 100644 testing/trino-testing-services/src/test/java/io/trino/junit/TestSystemPropertyParameterResolver.java diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsStorage.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsStorage.java index 8bfcf5f1582a..9667e16ec757 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsStorage.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsStorage.java @@ -16,13 +16,15 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.io.Resources; +import io.trino.junit.SystemPropertyParameterResolver; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.plugin.hive.containers.HiveHadoop; import io.trino.testing.AbstractTestQueryFramework; import io.trino.testing.QueryRunner; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.Network; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; -import org.testng.annotations.Parameters; import org.testng.annotations.Test; import java.nio.file.Files; @@ -44,6 +46,7 @@ import static java.util.Objects.requireNonNull; import static java.util.UUID.randomUUID; +@ExtendWith(SystemPropertyParameterResolver.class) public class TestDeltaLakeAdlsStorage extends AbstractTestQueryFramework { @@ -58,11 +61,10 @@ public class TestDeltaLakeAdlsStorage private HiveHadoop hiveHadoop; - @Parameters({ - "hive.hadoop2.azure-abfs-container", - "hive.hadoop2.azure-abfs-account", - "hive.hadoop2.azure-abfs-access-key"}) - public TestDeltaLakeAdlsStorage(String container, String account, String accessKey) + public TestDeltaLakeAdlsStorage( + @SystemProperty("hive.hadoop2.azure-abfs-container") String container, + @SystemProperty("hive.hadoop2.azure-abfs-account") String account, + @SystemProperty("hive.hadoop2.azure-abfs-access-key") String accessKey) { requireNonNull(container, "container is null"); this.account = requireNonNull(account, "account is null"); diff --git a/plugin/trino-hive-hadoop2/pom.xml b/plugin/trino-hive-hadoop2/pom.xml index 2a9a334266b5..e17d2135413d 100644 --- a/plugin/trino-hive-hadoop2/pom.xml +++ b/plugin/trino-hive-hadoop2/pom.xml @@ -198,6 +198,12 @@ test + + org.junit.jupiter + junit-jupiter-api + test + + org.testng testng diff --git a/plugin/trino-hive-hadoop2/src/test/java/io/trino/plugin/hive/TestHiveThriftMetastoreWithS3.java b/plugin/trino-hive-hadoop2/src/test/java/io/trino/plugin/hive/TestHiveThriftMetastoreWithS3.java index d5d3659f291d..6f73a2b87361 100644 --- a/plugin/trino-hive-hadoop2/src/test/java/io/trino/plugin/hive/TestHiveThriftMetastoreWithS3.java +++ b/plugin/trino-hive-hadoop2/src/test/java/io/trino/plugin/hive/TestHiveThriftMetastoreWithS3.java @@ -21,14 +21,16 @@ import com.amazonaws.services.s3.model.S3ObjectSummary; import com.google.common.collect.ImmutableMap; import com.google.common.io.Resources; +import io.trino.junit.SystemPropertyParameterResolver; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.plugin.hive.containers.HiveHadoop; import io.trino.plugin.hive.metastore.thrift.ThriftMetastoreConfig; import io.trino.plugin.hive.s3.S3HiveQueryRunner; import io.trino.testing.AbstractTestQueryFramework; import io.trino.testing.QueryRunner; +import org.junit.jupiter.api.extension.ExtendWith; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; -import org.testng.annotations.Parameters; import org.testng.annotations.Test; import java.io.IOException; @@ -42,6 +44,7 @@ import static java.util.Objects.requireNonNull; import static org.assertj.core.api.Assertions.assertThat; +@ExtendWith(SystemPropertyParameterResolver.class) public class TestHiveThriftMetastoreWithS3 extends AbstractTestQueryFramework { @@ -53,17 +56,11 @@ public class TestHiveThriftMetastoreWithS3 private final Path hadoopCoreSiteXmlTempFile; private final AmazonS3 s3Client; - @Parameters({ - "hive.hadoop2.s3.endpoint", - "hive.hadoop2.s3.awsAccessKey", - "hive.hadoop2.s3.awsSecretKey", - "hive.hadoop2.s3.writableBucket", - }) public TestHiveThriftMetastoreWithS3( - String s3endpoint, - String awsAccessKey, - String awsSecretKey, - String writableBucket) + @SystemProperty("hive.hadoop2.s3.endpoint") String s3endpoint, + @SystemProperty("hive.hadoop2.s3.awsAccessKey") String awsAccessKey, + @SystemProperty("hive.hadoop2.s3.awsSecretKey") String awsSecretKey, + @SystemProperty("hive.hadoop2.s3.writableBucket") String writableBucket) throws IOException { this.s3endpoint = requireNonNull(s3endpoint, "s3endpoint is null"); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergAbfsConnectorSmokeTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergAbfsConnectorSmokeTest.java index 26875693c34b..8a7317ff0c2a 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergAbfsConnectorSmokeTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergAbfsConnectorSmokeTest.java @@ -16,12 +16,14 @@ import com.google.common.collect.ImmutableMap; import com.google.common.io.Resources; import io.trino.filesystem.Location; +import io.trino.junit.SystemPropertyParameterResolver; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.plugin.hive.containers.HiveHadoop; import io.trino.plugin.hive.metastore.HiveMetastore; import io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore; import io.trino.testing.QueryRunner; import org.junit.jupiter.api.Test; -import org.testng.annotations.Parameters; +import org.junit.jupiter.api.extension.ExtendWith; import java.nio.file.Path; import java.nio.file.attribute.FileAttribute; @@ -40,6 +42,7 @@ import static org.apache.iceberg.FileFormat.ORC; import static org.assertj.core.api.Assertions.assertThat; +@ExtendWith(SystemPropertyParameterResolver.class) public class TestIcebergAbfsConnectorSmokeTest extends BaseIcebergConnectorSmokeTest { @@ -51,11 +54,10 @@ public class TestIcebergAbfsConnectorSmokeTest private HiveHadoop hiveHadoop; - @Parameters({ - "hive.hadoop2.azure-abfs-container", - "hive.hadoop2.azure-abfs-account", - "hive.hadoop2.azure-abfs-access-key"}) - public TestIcebergAbfsConnectorSmokeTest(String container, String account, String accessKey) + public TestIcebergAbfsConnectorSmokeTest( + @SystemProperty("hive.hadoop2.azure-abfs-container") String container, + @SystemProperty("hive.hadoop2.azure-abfs-account") String account, + @SystemProperty("hive.hadoop2.azure-abfs-access-key") String accessKey) { super(ORC); this.container = requireNonNull(container, "container is null"); diff --git a/testing/trino-testing-containers/pom.xml b/testing/trino-testing-containers/pom.xml index 034276c31326..bfb11b9aeaa0 100644 --- a/testing/trino-testing-containers/pom.xml +++ b/testing/trino-testing-containers/pom.xml @@ -75,7 +75,7 @@ org.junit.jupiter junit-jupiter-api - test + runtime diff --git a/testing/trino-testing-kafka/pom.xml b/testing/trino-testing-kafka/pom.xml index b8a50cad1125..dac30ee869d1 100644 --- a/testing/trino-testing-kafka/pom.xml +++ b/testing/trino-testing-kafka/pom.xml @@ -70,7 +70,7 @@ org.junit.jupiter junit-jupiter-api - test + runtime diff --git a/testing/trino-testing-services/pom.xml b/testing/trino-testing-services/pom.xml index 3fcb3ba08125..b74cbdeb04d1 100644 --- a/testing/trino-testing-services/pom.xml +++ b/testing/trino-testing-services/pom.xml @@ -53,6 +53,11 @@ true + + org.junit.jupiter + junit-jupiter-api + + org.openjdk.jmh jmh-core diff --git a/testing/trino-testing-services/src/main/java/io/trino/junit/SystemPropertyParameterResolver.java b/testing/trino-testing-services/src/main/java/io/trino/junit/SystemPropertyParameterResolver.java new file mode 100644 index 000000000000..502deccb879d --- /dev/null +++ b/testing/trino-testing-services/src/main/java/io/trino/junit/SystemPropertyParameterResolver.java @@ -0,0 +1,57 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.trino.junit; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +public class SystemPropertyParameterResolver + implements ParameterResolver +{ + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException + { + return parameterContext.isAnnotated(SystemProperty.class); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException + { + SystemProperty annotation = parameterContext.findAnnotation(SystemProperty.class).orElseThrow(() -> + new ParameterResolutionException("Missing @SystemProperty for class: %s, parameter: %s".formatted(extensionContext.getRequiredTestClass(), parameterContext.getParameter().getName()))); + + String propertyName = annotation.value(); + String value = System.getProperty(propertyName); + if (value == null) { + throw new ParameterResolutionException("Could not resolve system property '%s' for class: %s, parameter: %s".formatted(propertyName, extensionContext.getRequiredTestClass(), parameterContext.getParameter().getName())); + } + return value; + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.PARAMETER) + public @interface SystemProperty + { + String value(); + } +} diff --git a/testing/trino-testing-services/src/test/java/io/trino/junit/TestSystemPropertyParameterResolver.java b/testing/trino-testing-services/src/test/java/io/trino/junit/TestSystemPropertyParameterResolver.java new file mode 100644 index 000000000000..debd6bc84cbf --- /dev/null +++ b/testing/trino-testing-services/src/test/java/io/trino/junit/TestSystemPropertyParameterResolver.java @@ -0,0 +1,40 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.trino.junit; + +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import static org.assertj.core.api.Assertions.assertThat; + +@ExtendWith(SystemPropertyParameterResolver.class) +public class TestSystemPropertyParameterResolver +{ + private static final String PROPERTY_NAME = "somePropertyNameToPass"; + private static final String PROPERTY_VALUE = "secretValue"; + + @BeforeAll + public static void init() + { + System.setProperty(PROPERTY_NAME, PROPERTY_VALUE); + } + + @Test + public void testPropertySet(@SystemProperty(PROPERTY_NAME) String property) + { + assertThat(property).isEqualTo(PROPERTY_VALUE); + } +} diff --git a/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestQueryFramework.java b/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestQueryFramework.java index 65fa71c8acdb..e7b83f68092a 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestQueryFramework.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestQueryFramework.java @@ -56,10 +56,10 @@ import org.intellij.lang.annotations.Language; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import java.util.List; import java.util.Map; From 2af5b90a4a56be9c92a49ed05c975bdfc5747560 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Wed, 11 Oct 2023 14:14:20 +0200 Subject: [PATCH 2/2] Convert existing getProperty calls in JUnit tests --- ...yWithDifferentProjectIdConnectorSmokeTest.java | 11 +++++++++-- .../TestDeltaLakeAdlsConnectorSmokeTest.java | 15 +++++++++++---- .../TestDeltaLakeGcsConnectorSmokeTest.java | 9 ++++++--- .../iceberg/TestIcebergGcsConnectorSmokeTest.java | 12 +++++++++--- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/TestBigQueryWithDifferentProjectIdConnectorSmokeTest.java b/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/TestBigQueryWithDifferentProjectIdConnectorSmokeTest.java index 46d92cb7d98e..c32bfc10fb24 100644 --- a/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/TestBigQueryWithDifferentProjectIdConnectorSmokeTest.java +++ b/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/TestBigQueryWithDifferentProjectIdConnectorSmokeTest.java @@ -14,8 +14,11 @@ package io.trino.plugin.bigquery; import com.google.common.collect.ImmutableMap; +import io.trino.junit.SystemPropertyParameterResolver; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.testing.QueryRunner; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import java.util.Map; @@ -23,6 +26,7 @@ import static java.util.Objects.requireNonNull; import static org.assertj.core.api.Assertions.assertThat; +@ExtendWith(SystemPropertyParameterResolver.class) public class TestBigQueryWithDifferentProjectIdConnectorSmokeTest extends BaseBigQueryConnectorSmokeTest { @@ -31,12 +35,15 @@ public class TestBigQueryWithDifferentProjectIdConnectorSmokeTest protected String alternateProjectId; + public TestBigQueryWithDifferentProjectIdConnectorSmokeTest(@SystemProperty("testing.alternate-bq-project-id") String alternateProjectId) + { + this.alternateProjectId = requireNonNull(alternateProjectId, "alternateProjectId is null"); + } + @Override protected QueryRunner createQueryRunner() throws Exception { - this.alternateProjectId = requireNonNull(System.getProperty("testing.alternate-bq-project-id"), "testing.alternate-bq-project-id system property not set"); - QueryRunner queryRunner = BigQueryQueryRunner.createQueryRunner( ImmutableMap.of(), ImmutableMap.of("bigquery.project-id", alternateProjectId), diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsConnectorSmokeTest.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsConnectorSmokeTest.java index af5126549cf5..b1b63cfd7d3c 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsConnectorSmokeTest.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAdlsConnectorSmokeTest.java @@ -22,10 +22,13 @@ import com.google.common.io.ByteSource; import com.google.common.io.Resources; import com.google.common.reflect.ClassPath; +import io.trino.junit.SystemPropertyParameterResolver; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.plugin.hive.containers.HiveHadoop; import io.trino.testing.QueryRunner; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; import java.io.IOException; import java.io.UncheckedIOException; @@ -53,6 +56,7 @@ import static org.testcontainers.containers.Network.newNetwork; @TestInstance(PER_CLASS) +@ExtendWith(SystemPropertyParameterResolver.class) public class TestDeltaLakeAdlsConnectorSmokeTest extends BaseDeltaLakeConnectorSmokeTest { @@ -62,11 +66,14 @@ public class TestDeltaLakeAdlsConnectorSmokeTest private final BlobContainerClient azureContainerClient; private final String adlsDirectory; - public TestDeltaLakeAdlsConnectorSmokeTest() + public TestDeltaLakeAdlsConnectorSmokeTest( + @SystemProperty("hive.hadoop2.azure-abfs-container") String container, + @SystemProperty("hive.hadoop2.azure-abfs-account") String account, + @SystemProperty("hive.hadoop2.azure-abfs-access-key") String accessKey) { - this.container = requireNonNull(System.getProperty("hive.hadoop2.azure-abfs-container"), "container is null"); - this.account = requireNonNull(System.getProperty("hive.hadoop2.azure-abfs-account"), "account is null"); - this.accessKey = requireNonNull(System.getProperty("hive.hadoop2.azure-abfs-access-key"), "accessKey is null"); + this.container = requireNonNull(container, "container is null"); + this.account = requireNonNull(account, "account is null"); + this.accessKey = requireNonNull(accessKey, "accessKey is null"); String connectionString = format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=core.windows.net", account, accessKey); BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().connectionString(connectionString).buildClient(); diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeGcsConnectorSmokeTest.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeGcsConnectorSmokeTest.java index 5570743d3df0..63892663e626 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeGcsConnectorSmokeTest.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeGcsConnectorSmokeTest.java @@ -27,6 +27,7 @@ import io.trino.hadoop.ConfigurationInstantiator; import io.trino.hdfs.gcs.GoogleGcsConfigurationInitializer; import io.trino.hdfs.gcs.HiveGcsConfig; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.plugin.hive.containers.HiveHadoop; import io.trino.testing.QueryRunner; import org.apache.hadoop.conf.Configuration; @@ -76,10 +77,12 @@ public class TestDeltaLakeGcsConnectorSmokeTest private String gcpCredentials; private TrinoFileSystem fileSystem; - public TestDeltaLakeGcsConnectorSmokeTest() + public TestDeltaLakeGcsConnectorSmokeTest( + @SystemProperty("testing.gcp-storage-bucket") String gcpStorageBucket, + @SystemProperty("testing.gcp-credentials-key") String gcpCredentialKey) { - this.gcpStorageBucket = requireNonNull(System.getProperty("testing.gcp-storage-bucket"), "GCP storage bucket is null"); - this.gcpCredentialKey = requireNonNull(System.getProperty("testing.gcp-credentials-key"), "GCP credential key is null"); + this.gcpStorageBucket = requireNonNull(gcpStorageBucket, "gcpStorageBucket is null"); + this.gcpCredentialKey = requireNonNull(gcpCredentialKey, "gcpCredentialKey is null"); } @Override diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGcsConnectorSmokeTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGcsConnectorSmokeTest.java index 34248811d9fb..94d480314f7d 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGcsConnectorSmokeTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGcsConnectorSmokeTest.java @@ -17,6 +17,8 @@ import com.google.common.io.Resources; import io.airlift.log.Logger; import io.trino.filesystem.Location; +import io.trino.junit.SystemPropertyParameterResolver; +import io.trino.junit.SystemPropertyParameterResolver.SystemProperty; import io.trino.plugin.hive.containers.HiveHadoop; import io.trino.plugin.hive.metastore.HiveMetastore; import io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore; @@ -25,6 +27,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; import java.io.IOException; import java.io.UncheckedIOException; @@ -46,6 +49,7 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; @TestInstance(PER_CLASS) +@ExtendWith(SystemPropertyParameterResolver.class) public class TestIcebergGcsConnectorSmokeTest extends BaseIcebergConnectorSmokeTest { @@ -58,11 +62,13 @@ public class TestIcebergGcsConnectorSmokeTest private HiveHadoop hiveHadoop; - public TestIcebergGcsConnectorSmokeTest() + public TestIcebergGcsConnectorSmokeTest( + @SystemProperty("testing.gcp-storage-bucket") String gcpStorageBucket, + @SystemProperty("testing.gcp-credentials-key") String gcpCredentialKey) { super(ORC); - this.gcpStorageBucket = requireNonNull(System.getProperty("testing.gcp-storage-bucket"), "gcpStorageBucket is null"); - this.gcpCredentialKey = requireNonNull(System.getProperty("testing.gcp-credentials-key"), "gcpCredentialKey is null"); + this.gcpStorageBucket = requireNonNull(gcpStorageBucket, "gcpStorageBucket is null"); + this.gcpCredentialKey = requireNonNull(gcpCredentialKey, "gcpCredentialKey is null"); this.schema = "test_iceberg_gcs_connector_smoke_test_" + randomNameSuffix(); }