steveloughran commented on code in PR #15304:
URL: https://github.com/apache/iceberg/pull/15304#discussion_r3021148661


##########
aws/src/test/java/org/apache/iceberg/aws/s3/TestDefaultS3FileIOAwsClientFactory.java:
##########
@@ -140,6 +201,36 @@ public void close() {
     }
   }
 
+  public static class NoCreatePublisher implements MetricPublisher {
+    @Override
+    public void publish(MetricCollection metricCollection) {
+      // no-op
+    }
+
+    @Override
+    public void close() {
+      // no-op
+    }
+  }
+
+  public static class OopsPublisher implements MetricPublisher {

Review Comment:
   I'd suggest a more boring name like "PublisherThatFailsToCreate"



##########
aws/src/test/java/org/apache/iceberg/aws/s3/TestDefaultS3FileIOAwsClientFactory.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * 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 static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.SetSystemProperty;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+import software.amazon.awssdk.metrics.MetricCollection;
+import software.amazon.awssdk.metrics.MetricPublisher;
+
+// disable loading (unexpected) profiles
+@SetSystemProperty(key = "aws.sharedCredentialsFile", value = 
"target/missing/ignore")
+@SetSystemProperty(key = "aws.configFile", value = "target/missing/ignore")
+class TestDefaultS3FileIOAwsClientFactory {

Review Comment:
   
   common in my code, so it's always something I look for in tests. All to 
common in production too 😁
   
   Note that I'm not personally a strong fan of testing for text, but iceberg 
tooling expects it. My PoV: if you do test for text, have the text in a 
constant in production code and look for that. But again, not common in this 
repo, so I'm not going to suggest it in this PR.
   
   What is important _and I've been burned by it_ is don't look for error text 
from AWS services.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to