You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ja...@apache.org on 2022/09/23 16:41:57 UTC

[iceberg] branch master updated: AWS: update AWS Integration Test to fix false positives (#5784)

This is an automated email from the ASF dual-hosted git repository.

jackye pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 08a733af9b AWS: update AWS Integration Test to fix false positives (#5784)
08a733af9b is described below

commit 08a733af9ba69e708a844a1485df2a044f88aab6
Author: Rushan Jiang <ru...@andrew.cmu.edu>
AuthorDate: Fri Sep 23 12:41:48 2022 -0400

    AWS: update AWS Integration Test to fix false positives (#5784)
---
 .../iceberg/aws/TestAssumeRoleAwsClientFactory.java     |  3 ++-
 .../apache/iceberg/aws/TestDefaultAwsClientFactory.java |  7 ++++++-
 .../java/org/apache/iceberg/aws/glue/GlueTestBase.java  | 14 +++++++++++---
 .../apache/iceberg/aws/glue/TestGlueCatalogLock.java    |  4 +++-
 .../org/apache/iceberg/aws/glue/TestGlueCatalog.java    | 17 +++++++++++++----
 5 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/aws/src/integration/java/org/apache/iceberg/aws/TestAssumeRoleAwsClientFactory.java b/aws/src/integration/java/org/apache/iceberg/aws/TestAssumeRoleAwsClientFactory.java
index 8fea6544a6..b5dd0358db 100644
--- a/aws/src/integration/java/org/apache/iceberg/aws/TestAssumeRoleAwsClientFactory.java
+++ b/aws/src/integration/java/org/apache/iceberg/aws/TestAssumeRoleAwsClientFactory.java
@@ -81,7 +81,8 @@ public class TestAssumeRoleAwsClientFactory {
     assumeRoleProperties.put(
         AwsProperties.CLIENT_FACTORY, AssumeRoleAwsClientFactory.class.getName());
     assumeRoleProperties.put(AwsProperties.HTTP_CLIENT_TYPE, AwsProperties.HTTP_CLIENT_TYPE_APACHE);
-    assumeRoleProperties.put(AwsProperties.CLIENT_ASSUME_ROLE_REGION, "us-east-1");
+    assumeRoleProperties.put(
+        AwsProperties.CLIENT_ASSUME_ROLE_REGION, AwsIntegTestUtil.testRegion());
     assumeRoleProperties.put(AwsProperties.CLIENT_ASSUME_ROLE_ARN, response.role().arn());
     assumeRoleProperties.put(AwsProperties.CLIENT_ASSUME_ROLE_TAGS_PREFIX + "key1", "value1");
     assumeRoleProperties.put(AwsProperties.CLIENT_ASSUME_ROLE_TAGS_PREFIX + "key2", "value2");
diff --git a/aws/src/integration/java/org/apache/iceberg/aws/TestDefaultAwsClientFactory.java b/aws/src/integration/java/org/apache/iceberg/aws/TestDefaultAwsClientFactory.java
index 2c6c16bb48..fd3a19ffe4 100644
--- a/aws/src/integration/java/org/apache/iceberg/aws/TestDefaultAwsClientFactory.java
+++ b/aws/src/integration/java/org/apache/iceberg/aws/TestDefaultAwsClientFactory.java
@@ -69,7 +69,12 @@ public class TestDefaultAwsClientFactory {
         "Should fail request because of bad access key",
         S3Exception.class,
         "The AWS Access Key Id you provided does not exist in our records",
-        () -> s3Client.getObject(GetObjectRequest.builder().bucket("bucket").key("key").build()));
+        () ->
+            s3Client.getObject(
+                GetObjectRequest.builder()
+                    .bucket(AwsIntegTestUtil.testBucketName())
+                    .key("key")
+                    .build()));
   }
 
   @Test
diff --git a/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java b/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
index 683c5259f8..359d06db04 100644
--- a/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
+++ b/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
@@ -86,13 +86,20 @@ public class GlueTestBase {
         new AwsProperties(),
         glue,
         LockManagers.defaultLockManager(),
-        fileIO);
+        fileIO,
+        ImmutableMap.of());
     AwsProperties properties = new AwsProperties();
     properties.setGlueCatalogSkipArchive(true);
     properties.setS3FileIoDeleteBatchSize(10);
     glueCatalogWithSkip = new GlueCatalog();
     glueCatalogWithSkip.initialize(
-        catalogName, testBucketPath, properties, glue, LockManagers.defaultLockManager(), fileIO);
+        catalogName,
+        testBucketPath,
+        properties,
+        glue,
+        LockManagers.defaultLockManager(),
+        fileIO,
+        ImmutableMap.of());
     glueCatalogWithSkipNameValidation = new GlueCatalog();
     AwsProperties propertiesSkipNameValidation = new AwsProperties();
     propertiesSkipNameValidation.setGlueCatalogSkipNameValidation(true);
@@ -102,7 +109,8 @@ public class GlueTestBase {
         propertiesSkipNameValidation,
         glue,
         LockManagers.defaultLockManager(),
-        fileIO);
+        fileIO,
+        ImmutableMap.of());
   }
 
   @AfterClass
diff --git a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
index 1c61aaed31..ad428b8277 100644
--- a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
+++ b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
@@ -35,6 +35,7 @@ import org.apache.iceberg.aws.AwsProperties;
 import org.apache.iceberg.aws.dynamodb.DynamoDbLockManager;
 import org.apache.iceberg.aws.s3.S3FileIO;
 import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
 import org.apache.iceberg.relocated.com.google.common.util.concurrent.MoreExecutors;
 import org.apache.iceberg.util.Tasks;
 import org.junit.AfterClass;
@@ -64,7 +65,8 @@ public class TestGlueCatalogLock extends GlueTestBase {
         awsProperties,
         glue,
         new DynamoDbLockManager(dynamo, lockTableName),
-        fileIO);
+        fileIO,
+        ImmutableMap.of());
   }
 
   @AfterClass
diff --git a/aws/src/test/java/org/apache/iceberg/aws/glue/TestGlueCatalog.java b/aws/src/test/java/org/apache/iceberg/aws/glue/TestGlueCatalog.java
index 7902164f82..d2f54aafd4 100644
--- a/aws/src/test/java/org/apache/iceberg/aws/glue/TestGlueCatalog.java
+++ b/aws/src/test/java/org/apache/iceberg/aws/glue/TestGlueCatalog.java
@@ -80,7 +80,8 @@ public class TestGlueCatalog {
         new AwsProperties(),
         glue,
         LockManagers.defaultLockManager(),
-        null);
+        null,
+        ImmutableMap.of());
   }
 
   @Test
@@ -97,7 +98,8 @@ public class TestGlueCatalog {
               new AwsProperties(),
               glue,
               LockManagers.defaultLockManager(),
-              null);
+              null,
+              ImmutableMap.of());
         });
   }
 
@@ -110,7 +112,8 @@ public class TestGlueCatalog {
         new AwsProperties(),
         glue,
         LockManagers.defaultLockManager(),
-        null);
+        null,
+        ImmutableMap.of());
     Mockito.doReturn(
             GetDatabaseResponse.builder().database(Database.builder().name("db").build()).build())
         .when(glue)
@@ -582,7 +585,13 @@ public class TestGlueCatalog {
     AwsProperties props = new AwsProperties();
     props.setGlueCatalogSkipNameValidation(true);
     glueCatalog.initialize(
-        CATALOG_NAME, WAREHOUSE_PATH, props, glue, LockManagers.defaultLockManager(), null);
+        CATALOG_NAME,
+        WAREHOUSE_PATH,
+        props,
+        glue,
+        LockManagers.defaultLockManager(),
+        null,
+        ImmutableMap.of());
     Assert.assertEquals(glueCatalog.isValidIdentifier(TableIdentifier.parse("db-1.a-1")), true);
   }
 }