Skip to content
Open
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 @@ -17,6 +17,8 @@
import com.google.common.collect.ImmutableSet;
import org.testcontainers.containers.Network;

import java.util.Locale;
import java.util.Map;
import java.util.Optional;

import static io.trino.testing.containers.Minio.MINIO_REGION;
Expand All @@ -36,16 +38,16 @@ public IcebergRestCatalogBackendContainer(
"iceberg-rest",
ImmutableSet.of(8181),
ImmutableMap.of(),
ImmutableMap.of(
"CATALOG_INCLUDE__CREDENTIALS", "true",
"CATALOG_WAREHOUSE", warehouseLocation,
"CATALOG_IO__IMPL", "org.apache.iceberg.aws.s3.S3FileIO",
"AWS_REGION", MINIO_REGION,
"CATALOG_S3_ACCESS__KEY__ID", minioAccessKey,
"CATALOG_S3_SECRET__ACCESS__KEY", minioSecretKey,
"CATALOG_S3_SESSION__TOKEN", minioSessionToken,
"CATALOG_S3_ENDPOINT", "http://minio:4566",
"CATALOG_S3_PATH__STYLE__ACCESS", "true"),
toCatalogEnvVars(ImmutableMap.of(
"include-credentials", "true",
"warehouse", warehouseLocation,
"io-impl", "org.apache.iceberg.aws.s3.S3FileIO",
"s3.access-key-id", minioAccessKey,
"s3.secret-access-key", minioSecretKey,
"s3.session-token", minioSessionToken,
"s3.endpoint", "http://minio:4566",
"s3.path-style-access", "true",
"client.region", MINIO_REGION)),
Copy link
Author

@smaheshwar-pltr smaheshwar-pltr Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do this, using an explicit Iceberg property, instead of setting AWS_REGION as an env var for the AWS SDK to derive region from

network,
5);
}
Expand All @@ -54,4 +56,18 @@ public String getRestCatalogEndpoint()
{
return getMappedHostAndPortForExposedPort(8181).toString();
}

private static Map<String, String> toCatalogEnvVars(Map<String, String> properties)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
ImmutableMap.Builder<String, String> envVars = ImmutableMap.builder();
properties.forEach((key, value) -> {
String envVarName = "CATALOG_" +
key.toUpperCase(Locale.ROOT)
.replaceAll("-", "__")
.replaceAll("\\.", "_");

envVars.put(envVarName, value);
});
return envVars.buildOrThrow();
}
}
Loading