danielcweeks commented on code in PR #11093:
URL: https://github.com/apache/iceberg/pull/11093#discussion_r1824745679
##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/TestBaseWithCatalog.java:
##########
@@ -59,18 +86,30 @@ protected static Object[][] parameters() {
}
@BeforeAll
- public static void createWarehouse() throws IOException {
+ public static void setUpAll() throws IOException {
TestBaseWithCatalog.warehouse = File.createTempFile("warehouse", null);
assertThat(warehouse.delete()).isTrue();
+ initRESTCatalog();
}
@AfterAll
- public static void dropWarehouse() throws IOException {
+ public static void tearDownAll() throws Exception {
if (warehouse != null && warehouse.exists()) {
Path warehousePath = new Path(warehouse.getAbsolutePath());
FileSystem fs = warehousePath.getFileSystem(hiveConf);
assertThat(fs.delete(warehousePath, true)).as("Failed to delete " +
warehousePath).isTrue();
}
+ stopRESTCatalog();
+ }
+
+ private static void initRESTCatalog() {
+ restCatalog = RCKUtils.initCatalogClient(REST_SERVER_EXTENSION.config());
Review Comment:
So rather than making the client like theis and making the RESTUtils public.
I think you can actually create the client in the extension and just grab it
out of the context:
```java
// In the RESTServerExtension class
@Override
public void beforeAll(ExtensionContext extensionContext) throws Exception {
// ... other init
// store the client
Store store = context.getStore(Namespace.GLOBAL);
store.put("rest-client", RCKUtils.initCatalogClient(...));
}
}
```
In this class then just use
```java
@Override
public void beforeEach(ExtensionContext context) {
// get the rest catalog client from the context store
Store store = context.getStore(Namespace.GLOBAL);
this.restCatalog = store.get("rest-client");
}
```
--
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]