sullis commented on code in PR #11349:
URL: https://github.com/apache/iceberg/pull/11349#discussion_r1813357582


##########
aws/src/test/java/org/apache/iceberg/aws/s3/MinioUtil.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.iceberg.aws.s3;
+
+import java.net.URI;
+import org.testcontainers.containers.MinIOContainer;
+import org.testcontainers.utility.DockerImageName;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.S3ClientBuilder;
+
+public class MinioUtil {
+
+  public static MinIOContainer createContainer() {
+    return createContainer(null);
+  }
+
+  public static MinIOContainer createContainer(AwsCredentials credentials) {
+    var container = new 
MinIOContainer(DockerImageName.parse("minio/minio:latest"));
+
+    // this enables virtual-host-style requests. see
+    // https://github.com/minio/minio/tree/master/docs/config#domain
+    container.withEnv("MINIO_DOMAIN", "localhost");
+
+    if (credentials != null) {
+      container.withUserName(credentials.accessKeyId());
+      container.withPassword(credentials.secretAccessKey());
+    }
+
+    return container;
+  }
+
+  public static S3Client createS3Client(MinIOContainer container) {
+    URI uri = URI.create("http://127.0.0.1:"; + container.getFirstMappedPort());

Review Comment:
   GitHub Actions CI passed.  But my laptop (MacOS) is unhappy about the S3 
Minio URL 
    
   ```
   URI.create(container.getS3URL())
   ```
   
   Exception on MacOS:
   ```
   Received an UnknownHostException when attempting to interact with a service. 
See cause for the exact endpoint that is failing to resolve. If this is 
happening on an endpoint that previously worked, there may be a network 
connectivity issue or your DNS cache could be storing endpoints for too long.
   software.amazon.awssdk.core.exception.SdkClientException
   ```
   
    



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to