Skip to content

Commit

Permalink
Renamed MinIO credentials constants
Browse files Browse the repository at this point in the history
Renamed `ACCESS_KEY` and `SECRET_KEY` to `MINIO_ACCESS_KEY` and `MINIO_SECRET_KEY` for readability
  • Loading branch information
mdesmet authored and ebyhr committed Jul 13, 2022
1 parent af73f3b commit e73567b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import static io.airlift.testing.Closeables.closeAllSuppress;
import static io.airlift.units.Duration.nanosSince;
import static io.trino.plugin.deltalake.DeltaLakeConnectorFactory.CONNECTOR_NAME;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.SECRET_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_SECRET_KEY;
import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME;
import static io.trino.testing.TestingSession.testSessionBuilder;
import static java.lang.String.format;
Expand Down Expand Up @@ -163,8 +163,8 @@ public static DistributedQueryRunner createS3DeltaLakeQueryRunner(
coordinatorProperties,
extraProperties,
ImmutableMap.<String, String>builder()
.put("hive.s3.aws-access-key", ACCESS_KEY)
.put("hive.s3.aws-secret-key", SECRET_KEY)
.put("hive.s3.aws-access-key", MINIO_ACCESS_KEY)
.put("hive.s3.aws-secret-key", MINIO_SECRET_KEY)
.put("hive.s3.endpoint", minioAddress)
.put("hive.s3.path-style-access", "true")
.putAll(connectorProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
import static com.google.inject.multibindings.OptionalBinder.newOptionalBinder;
import static io.airlift.configuration.ConfigBinder.configBinder;
import static io.trino.plugin.deltalake.DeltaLakeQueryRunner.DELTA_CATALOG;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.SECRET_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_SECRET_KEY;
import static io.trino.testing.TestingSession.testSessionBuilder;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -139,8 +139,8 @@ public HiveMetastore createMetastore(Optional<ConnectorIdentity> identity)

ImmutableMap.Builder<String, String> deltaLakeProperties = ImmutableMap.builder();
deltaLakeProperties.put("hive.metastore.uri", "thrift://" + hiveMinioDataLake.getHiveHadoop().getHiveMetastoreEndpoint());
deltaLakeProperties.put("hive.s3.aws-access-key", ACCESS_KEY);
deltaLakeProperties.put("hive.s3.aws-secret-key", SECRET_KEY);
deltaLakeProperties.put("hive.s3.aws-access-key", MINIO_ACCESS_KEY);
deltaLakeProperties.put("hive.s3.aws-secret-key", MINIO_SECRET_KEY);
deltaLakeProperties.put("hive.s3.endpoint", hiveMinioDataLake.getMinioAddress());
deltaLakeProperties.put("hive.s3.path-style-access", "true");
deltaLakeProperties.put("hive.metastore", "test"); // use test value so we do not get clash with default bindings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import java.util.Map;

import static io.trino.plugin.hive.containers.HiveMinioDataLake.ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.SECRET_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_SECRET_KEY;
import static io.trino.testing.sql.TestTable.randomTableSuffix;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
Expand Down Expand Up @@ -57,8 +57,8 @@ protected QueryRunner createQueryRunner()

queryRunner.installPlugin(new TestingHivePlugin());
Map<String, String> s3Properties = ImmutableMap.<String, String>builder()
.put("hive.s3.aws-access-key", ACCESS_KEY)
.put("hive.s3.aws-secret-key", SECRET_KEY)
.put("hive.s3.aws-access-key", MINIO_ACCESS_KEY)
.put("hive.s3.aws-secret-key", MINIO_SECRET_KEY)
.put("hive.s3.endpoint", hiveMinioDataLake.getMinioAddress())
.put("hive.s3.path-style-access", "true")
.buildOrThrow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
public class HiveMinioDataLake
implements AutoCloseable
{
public static final String ACCESS_KEY = "accesskey";
public static final String SECRET_KEY = "secretkey";
public static final String MINIO_ACCESS_KEY = "accesskey";
public static final String MINIO_SECRET_KEY = "secretkey";

private final String bucketName;
private final Minio minio;
Expand Down Expand Up @@ -70,8 +70,8 @@ public HiveMinioDataLake(String bucketName, Map<String, String> hiveHadoopFilesT
Minio.builder()
.withNetwork(network)
.withEnvVars(ImmutableMap.<String, String>builder()
.put("MINIO_ACCESS_KEY", ACCESS_KEY)
.put("MINIO_SECRET_KEY", SECRET_KEY)
.put("MINIO_ACCESS_KEY", MINIO_ACCESS_KEY)
.put("MINIO_SECRET_KEY", MINIO_SECRET_KEY)
.buildOrThrow())
.build());

Expand Down Expand Up @@ -160,7 +160,7 @@ public void close()

private MinioClient initMinioClient()
{
MinioClient minioClient = new MinioClient(getMinioAddress(), ACCESS_KEY, SECRET_KEY);
MinioClient minioClient = new MinioClient(getMinioAddress(), MINIO_ACCESS_KEY, MINIO_SECRET_KEY);
closer.register(minioClient);

// use retry loop for minioClient.makeBucket as minio container tends to return "Server not initialized, please try again" error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public static Builder builder(HiveMinioDataLake hiveMinioDataLake)
return builder()
.setHiveMetastoreEndpoint(hiveMinioDataLake.getHiveHadoop().getHiveMetastoreEndpoint())
.setS3Endpoint("http://" + hiveMinioDataLake.getMinio().getMinioApiEndpoint())
.setS3AccessKey(HiveMinioDataLake.ACCESS_KEY)
.setS3SecretKey(HiveMinioDataLake.SECRET_KEY)
.setS3AccessKey(HiveMinioDataLake.MINIO_ACCESS_KEY)
.setS3SecretKey(HiveMinioDataLake.MINIO_SECRET_KEY)
.setBucketName(hiveMinioDataLake.getBucketName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.util.Locale;
import java.util.Map;

import static io.trino.plugin.hive.containers.HiveMinioDataLake.ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.SECRET_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_ACCESS_KEY;
import static io.trino.plugin.hive.containers.HiveMinioDataLake.MINIO_SECRET_KEY;
import static io.trino.testing.sql.TestTable.randomTableSuffix;
import static java.lang.String.format;

Expand Down Expand Up @@ -55,8 +55,8 @@ protected QueryRunner createQueryRunner()
.put("iceberg.file-format", format.name())
.put("iceberg.catalog.type", "HIVE_METASTORE")
.put("hive.metastore.uri", "thrift://" + hiveMinioDataLake.getHiveHadoop().getHiveMetastoreEndpoint())
.put("hive.s3.aws-access-key", ACCESS_KEY)
.put("hive.s3.aws-secret-key", SECRET_KEY)
.put("hive.s3.aws-access-key", MINIO_ACCESS_KEY)
.put("hive.s3.aws-secret-key", MINIO_SECRET_KEY)
.put("hive.s3.endpoint", "http://" + hiveMinioDataLake.getMinio().getMinioApiEndpoint())
.put("hive.s3.path-style-access", "true")
.put("hive.s3.streaming.part-size", "5MB")
Expand Down

0 comments on commit e73567b

Please sign in to comment.