This is an automated email from the ASF dual-hosted git repository. pingtimeout pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push: new 850792c14 chore(deps): bump s3mock from 3.11.0 to 4.7.0 (#2375) 850792c14 is described below commit 850792c14417729cff7840fc8dbaaf06b2466558 Author: Artur Rakhmatulin <from_git...@binaryc.at> AuthorDate: Tue Aug 19 10:11:11 2025 +0100 chore(deps): bump s3mock from 3.11.0 to 4.7.0 (#2375) Updates S3Mock testcontainer dependency from 3.11.0 to 4.7.0 and refactors usage into a centralized wrapper class in runtime/test-common. Changes Upgraded S3Mock testcontainer to 4.7.0 Created S3Mock wrapper class for consistent configuration Consolidated S3 config properties generation Updated integration tests to use new wrapper No functional changes to test behavior. --- integration-tests/build.gradle.kts | 6 +-- .../it/ext/PolarisSparkIntegrationTestBase.java | 50 +++---------------- .../spark/quarkus/it/SparkIntegrationBase.java | 28 ++--------- runtime/test-common/build.gradle.kts | 1 + .../apache/polaris/test/commons/s3mock/S3Mock.java | 56 ++++++++++++++++++++++ .../test/commons/s3mock/Dockerfile-s3mock-version | 22 +++++++++ 6 files changed, 91 insertions(+), 72 deletions(-) diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index fca66bc18..7bd8f8459 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -48,10 +48,6 @@ dependencies { implementation(libs.auth0.jwt) - implementation(platform(libs.testcontainers.bom)) - implementation("org.testcontainers:testcontainers") - implementation(libs.s3mock.testcontainers) - implementation("org.apache.iceberg:iceberg-spark-3.5_2.12") implementation("org.apache.iceberg:iceberg-spark-extensions-3.5_2.12") implementation("org.apache.spark:spark-sql_2.12:3.5.6") { @@ -69,6 +65,8 @@ dependencies { implementation(libs.assertj.core) implementation(libs.mockito.core) implementation(libs.awaitility) + implementation(libs.s3mock.testcontainers) + implementation(project(":polaris-runtime-test-common")) } copiedCodeChecks { diff --git a/integration-tests/src/main/java/org/apache/polaris/service/it/ext/PolarisSparkIntegrationTestBase.java b/integration-tests/src/main/java/org/apache/polaris/service/it/ext/PolarisSparkIntegrationTestBase.java index 922278f3c..15e10aa65 100644 --- a/integration-tests/src/main/java/org/apache/polaris/service/it/ext/PolarisSparkIntegrationTestBase.java +++ b/integration-tests/src/main/java/org/apache/polaris/service/it/ext/PolarisSparkIntegrationTestBase.java @@ -20,12 +20,10 @@ package org.apache.polaris.service.it.ext; import static org.apache.polaris.service.it.env.PolarisClient.polarisClient; -import com.adobe.testing.s3mock.testcontainers.S3MockContainer; import java.io.IOException; import java.net.URI; import java.nio.file.Path; import java.util.List; -import java.util.Map; import org.apache.polaris.core.admin.model.AwsStorageConfigInfo; import org.apache.polaris.core.admin.model.Catalog; import org.apache.polaris.core.admin.model.CatalogProperties; @@ -38,6 +36,7 @@ import org.apache.polaris.service.it.env.IntegrationTestsHelper; import org.apache.polaris.service.it.env.ManagementApi; import org.apache.polaris.service.it.env.PolarisApiEndpoints; import org.apache.polaris.service.it.env.PolarisClient; +import org.apache.polaris.test.commons.s3mock.S3Mock; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; @@ -52,8 +51,7 @@ import org.slf4j.LoggerFactory; @ExtendWith(PolarisIntegrationTestExtension.class) public abstract class PolarisSparkIntegrationTestBase { - protected static final S3MockContainer s3Container = - new S3MockContainer("3.11.0").withInitialBuckets("my-bucket,my-old-bucket"); + protected static final S3Mock s3Container = new S3Mock(); protected static SparkSession spark; protected PolarisApiEndpoints endpoints; protected PolarisClient client; @@ -98,26 +96,8 @@ public abstract class PolarisSparkIntegrationTestBase { .setAllowedLocations(List.of("s3://my-old-bucket/path/to/data")) .build(); CatalogProperties props = new CatalogProperties("s3://my-bucket/path/to/data"); - props.putAll( - Map.of( - "table-default.s3.endpoint", - s3Container.getHttpEndpoint(), - "table-default.s3.path-style-access", - "true", - "table-default.s3.access-key-id", - "foo", - "table-default.s3.secret-access-key", - "bar", - "s3.endpoint", - s3Container.getHttpEndpoint(), - "s3.path-style-access", - "true", - "s3.access-key-id", - "foo", - "s3.secret-access-key", - "bar", - "polaris.config.drop-with-purge.enabled", - "true")); + props.putAll(s3Container.getS3ConfigProperties()); + props.put("polaris.config.drop-with-purge.enabled", "true"); Catalog catalog = PolarisCatalog.builder() .setType(Catalog.TypeEnum.INTERNAL) @@ -129,26 +109,8 @@ public abstract class PolarisSparkIntegrationTestBase { managementApi.createCatalog(catalog); CatalogProperties externalProps = new CatalogProperties("s3://my-bucket/path/to/data"); - externalProps.putAll( - Map.of( - "table-default.s3.endpoint", - s3Container.getHttpEndpoint(), - "table-default.s3.path-style-access", - "true", - "table-default.s3.access-key-id", - "foo", - "table-default.s3.secret-access-key", - "bar", - "s3.endpoint", - s3Container.getHttpEndpoint(), - "s3.path-style-access", - "true", - "s3.access-key-id", - "foo", - "s3.secret-access-key", - "bar", - "polaris.config.drop-with-purge.enabled", - "true")); + externalProps.putAll(s3Container.getS3ConfigProperties()); + externalProps.put("polaris.config.drop-with-purge.enabled", "true"); Catalog externalCatalog = ExternalCatalog.builder() .setType(Catalog.TypeEnum.EXTERNAL) diff --git a/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkIntegrationBase.java b/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkIntegrationBase.java index bd30997d9..d2fa1b4a6 100644 --- a/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkIntegrationBase.java +++ b/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkIntegrationBase.java @@ -18,7 +18,6 @@ */ package org.apache.polaris.spark.quarkus.it; -import com.adobe.testing.s3mock.testcontainers.S3MockContainer; import com.google.common.collect.ImmutableList; import com.google.errorprone.annotations.FormatMethod; import java.io.File; @@ -26,7 +25,6 @@ import java.io.IOException; import java.net.URI; import java.nio.file.Path; import java.util.List; -import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -44,6 +42,7 @@ import org.apache.polaris.service.it.env.ManagementApi; import org.apache.polaris.service.it.env.PolarisApiEndpoints; import org.apache.polaris.service.it.ext.PolarisIntegrationTestExtension; import org.apache.polaris.service.it.ext.SparkSessionBuilder; +import org.apache.polaris.test.commons.s3mock.S3Mock; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; @@ -58,8 +57,7 @@ import org.slf4j.LoggerFactory; @ExtendWith(PolarisIntegrationTestExtension.class) public abstract class SparkIntegrationBase { - protected static final S3MockContainer s3Container = - new S3MockContainer("3.11.0").withInitialBuckets("my-bucket,my-old-bucket"); + protected static final S3Mock s3Container = new S3Mock(); protected static SparkSession spark; protected PolarisApiEndpoints endpoints; protected PolarisManagementClient client; @@ -100,26 +98,8 @@ public abstract class SparkIntegrationBase { .setAllowedLocations(List.of("s3://my-old-bucket/path/to/data")) .build(); CatalogProperties props = new CatalogProperties("s3://my-bucket/path/to/data"); - props.putAll( - Map.of( - "table-default.s3.endpoint", - s3Container.getHttpEndpoint(), - "table-default.s3.path-style-access", - "true", - "table-default.s3.access-key-id", - "foo", - "table-default.s3.secret-access-key", - "bar", - "s3.endpoint", - s3Container.getHttpEndpoint(), - "s3.path-style-access", - "true", - "s3.access-key-id", - "foo", - "s3.secret-access-key", - "bar", - "polaris.config.drop-with-purge.enabled", - "true")); + props.putAll(s3Container.getS3ConfigProperties()); + props.put("polaris.config.drop-with-purge.enabled", "true"); Catalog catalog = PolarisCatalog.builder() .setType(Catalog.TypeEnum.INTERNAL) diff --git a/runtime/test-common/build.gradle.kts b/runtime/test-common/build.gradle.kts index 51433665a..564ad5aaf 100644 --- a/runtime/test-common/build.gradle.kts +++ b/runtime/test-common/build.gradle.kts @@ -32,6 +32,7 @@ configurations.all { } dependencies { + implementation(libs.s3mock.testcontainers) implementation(project(":polaris-core")) implementation(libs.jakarta.ws.rs.api) implementation(enforcedPlatform(libs.quarkus.bom)) diff --git a/runtime/test-common/src/main/java/org/apache/polaris/test/commons/s3mock/S3Mock.java b/runtime/test-common/src/main/java/org/apache/polaris/test/commons/s3mock/S3Mock.java new file mode 100644 index 000000000..c0a10ab2e --- /dev/null +++ b/runtime/test-common/src/main/java/org/apache/polaris/test/commons/s3mock/S3Mock.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.polaris.test.commons.s3mock; + +import com.adobe.testing.s3mock.testcontainers.S3MockContainer; +import java.util.Map; +import org.apache.polaris.containerspec.ContainerSpecHelper; + +public class S3Mock extends S3MockContainer { + + private static final String DEFAULT_BUCKETS = "my-bucket,my-old-bucket"; + private static final String DEFAULT_ACCESS_KEY = "ap1"; + private static final String DEFAULT_SECRET_KEY = "s3cr3t"; + + public S3Mock() { + this(DEFAULT_BUCKETS); + } + + public S3Mock(String initialBuckets) { + super( + ContainerSpecHelper.containerSpecHelper("s3mock", S3Mock.class) + .dockerImageName(null) + .asCompatibleSubstituteFor("adobe/s3mock")); + this.withInitialBuckets(initialBuckets); + } + + public Map<String, String> getS3ConfigProperties() { + String endpoint = this.getHttpEndpoint(); + return Map.of( + "table-default.s3.endpoint", endpoint, + "table-default.s3.path-style-access", "true", + "table-default.s3.access-key-id", DEFAULT_ACCESS_KEY, + "table-default.s3.secret-access-key", DEFAULT_SECRET_KEY, + "s3.endpoint", endpoint, + "s3.path-style-access", "true", + "s3.access-key-id", DEFAULT_ACCESS_KEY, + "s3.secret-access-key", DEFAULT_SECRET_KEY); + } +} diff --git a/runtime/test-common/src/main/resources/org/apache/polaris/test/commons/s3mock/Dockerfile-s3mock-version b/runtime/test-common/src/main/resources/org/apache/polaris/test/commons/s3mock/Dockerfile-s3mock-version new file mode 100644 index 000000000..e6af6c12e --- /dev/null +++ b/runtime/test-common/src/main/resources/org/apache/polaris/test/commons/s3mock/Dockerfile-s3mock-version @@ -0,0 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +# Dockerfile to provide the image name and tag to a test. +# Version is managed by Renovate - do not edit. +FROM docker.io/adobe/s3mock:4.7.0