haizhou-zhao commented on code in PR #11093:
URL: https://github.com/apache/iceberg/pull/11093#discussion_r1823145510


##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/TestBaseWithCatalog.java:
##########
@@ -36,16 +42,55 @@
 import org.apache.iceberg.catalog.SupportsNamespaces;
 import org.apache.iceberg.catalog.TableIdentifier;
 import org.apache.iceberg.hadoop.HadoopCatalog;
+import org.apache.iceberg.inmemory.InMemoryCatalog;
+import org.apache.iceberg.rest.RCKUtils;
+import org.apache.iceberg.rest.RESTCatalog;
+import org.apache.iceberg.rest.RESTCatalogServer;
+import org.apache.iceberg.rest.RESTServerExtension;
 import org.apache.iceberg.util.PropertyUtil;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
 
 @ExtendWith(ParameterizedTestExtension.class)
 public abstract class TestBaseWithCatalog extends TestBase {
-  protected static File warehouse = null;
+  protected static File warehouse;
+
+  static {
+    try {
+      warehouse = File.createTempFile("warehouse", null);
+      assertThat(warehouse.delete()).isTrue();
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private static final Map<String, String> CONFIG;
+
+  static {
+    try {
+      CONFIG =
+          Map.of(
+              RESTCatalogServer.REST_PORT, 
String.valueOf(MetaStoreUtils.findFreePort()),
+              CatalogProperties.WAREHOUSE_LOCATION, 
warehouse.getAbsolutePath(),
+              // In-memory sqlite database by default is private to the 
connection that created it.
+              // If more than 1 jdbc connection backed by in-memory sqlite is 
created behind one
+              // JdbcCatalog, then different jdbc connections could provide 
different views of table
+              // status even belonging to the same catalog. Reference:
+              // https://www.sqlite.org/inmemorydb.html
+              CatalogProperties.CLIENT_POOL_SIZE, "1");
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @RegisterExtension
+  private static RESTServerExtension restServerExtension = new 
RESTServerExtension(CONFIG);

Review Comment:
   Done, config in-lined.



-- 
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