>From Hussain Towaileb <[email protected]>:

Hussain Towaileb has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21351?usp=email )


Change subject: [NO ISSUE][EXT]: allow custom iceberg catalog endpoint in tests
......................................................................

[NO ISSUE][EXT]: allow custom iceberg catalog endpoint in tests

Ext-ref: MB-72418
Change-Id: I8667ce486c480757784046b77747a9b9f756026b
---
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
4 files changed, 13 insertions(+), 3 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/51/21351/1

diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
index b9b0858..a767228 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
@@ -32,6 +32,7 @@

 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.testcontainers.containers.Network;

 import com.adobe.testing.s3mock.testcontainers.S3MockContainer;

@@ -75,11 +76,16 @@
     }

     public static S3MockContainer startS3CloudEnvironment(boolean cleanStart) 
throws IOException {
-        return startS3CloudEnvironment(cleanStart, false);
+        return startS3CloudEnvironment(cleanStart, false, null);
     }

     public static S3MockContainer startS3CloudEnvironment(boolean cleanStart, 
boolean createPlaygroundContainer)
             throws IOException {
+        return startS3CloudEnvironment(cleanStart, createPlaygroundContainer, 
null);
+    }
+
+    public static S3MockContainer startS3CloudEnvironment(boolean cleanStart, 
boolean createPlaygroundContainer,
+            Network network) throws IOException {
         // Testcontainers 1.21.x defaults to Docker API version 1.32, but 
Docker Desktop 4.65.0+ requires
         // minimum API version 1.44. Set the api.version system property so 
the shaded docker-java client
         // inside testcontainers negotiates with a supported version.
@@ -90,6 +96,9 @@
         // Starting S3 mock server to be used instead of real S3 server
         LOGGER.info("Starting S3 mock server");
         s3Mock = new 
S3MockContainer(S3MOCK_VERSION_TAG).withRetainFilesOnExit(!cleanStart);
+        if (network != null) {
+            s3Mock.withNetwork(network);
+        }
         if (!cleanStart) {
             Path s3MockDataDir = Path.of("target", "s3mock");
             boolean existingData = s3MockDataDir.toFile().exists();
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
index d745c55..5512604 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
@@ -110,6 +110,7 @@

     public static class Iceberg {
         public static final String NESSIE_SERVER_URI_PLACEHOLDER = 
"%NESSIE_SERVER_URI%";
+        public static String NESSIE_URI;
         public static final String SNAPSHOT_1_SNAPSHOT_ID_PLACEHOLDER = 
"%SNAPSHOT_1_SNAPSHOT_ID%";
         public static final String SNAPSHOT_1_TIMESTAMP_LONG_PLACEHOLDER = 
"%SNAPSHOT_1_TIMESTAMP_LONG_PLACEHOLDER%";
         public static final String SNAPSHOT_2_TIMESTAMP_DATETIME_PLACEHOLDER =
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index 6f680d5..91afeb1 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -121,7 +121,6 @@
 import org.apache.asterix.common.utils.Servlets;
 import org.apache.asterix.lang.sqlpp.util.SqlppStatementUtil;
 import org.apache.asterix.runtime.evaluators.common.NumberUtils;
-import org.apache.asterix.test.iceberg.IcebergTest;
 import org.apache.asterix.test.server.ITestServer;
 import org.apache.asterix.test.server.TestServerProvider;
 import org.apache.asterix.testframework.context.TestCaseContext;
@@ -2514,7 +2513,7 @@
     }

     protected String replaceIcebergPlaceholders(String str) {
-        str = str.replace(TestConstants.Iceberg.NESSIE_SERVER_URI_PLACEHOLDER, 
IcebergTest.NESSIE_URI);
+        str = str.replace(TestConstants.Iceberg.NESSIE_SERVER_URI_PLACEHOLDER, 
TestConstants.Iceberg.NESSIE_URI);
         str = str.replace(SNAPSHOT_1_SNAPSHOT_ID_PLACEHOLDER, 
String.valueOf(SNAPSHOT_1_SNAPSHOT_ID_VALUE));
         str = str.replace(SNAPSHOT_1_TIMESTAMP_LONG_PLACEHOLDER, 
String.valueOf(SNAPSHOT_1_TIMESTAMP_LONG_VALUE));
         str = SNAPSHOT_2_TIMESTAMP_DATETIME_VALUE != null
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
index c2b731b..6b0d4c1 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
@@ -150,6 +150,7 @@
         nessie = new 
GenericContainer<>(NESSIE_IMAGE).withExposedPorts(NESSIE_PORT);
         nessie.setPortBindings(List.of(NESSIE_PORT + ":" + NESSIE_PORT));
         nessie.start();
+        TestConstants.Iceberg.NESSIE_URI = NESSIE_URI;

         prepareIcebergContainer();
         prepareIcebergData();

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21351?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I8667ce486c480757784046b77747a9b9f756026b
Gerrit-Change-Number: 21351
Gerrit-PatchSet: 1
Gerrit-Owner: Hussain Towaileb <[email protected]>

Reply via email to