Abacn commented on code in PR #33218:
URL: https://github.com/apache/beam/pull/33218#discussion_r1857376930
##########
sdks/java/io/iceberg/src/test/java/org/apache/beam/sdk/io/iceberg/IcebergIOIT.java:
##########
@@ -176,27 +181,40 @@ public Record apply(Row input) {
@Rule public TestName testName = new TestName();
- private String warehouseLocation;
+ private static String warehouseLocation;
private String tableId;
- private Catalog catalog;
+ private static Catalog catalog;
@BeforeClass
public static void beforeClass() {
options = TestPipeline.testingPipelineOptions().as(GcpOptions.class);
-
+ warehouseLocation =
+ String.format("%s/IcebergIOIT/%s", options.getTempLocation(),
UUID.randomUUID());
catalogHadoopConf = new Configuration();
catalogHadoopConf.set("fs.gs.project.id", options.getProject());
catalogHadoopConf.set("fs.gs.auth.type", "APPLICATION_DEFAULT");
+ catalog = new HadoopCatalog(catalogHadoopConf, warehouseLocation);
}
@Before
public void setUp() {
- warehouseLocation =
- String.format("%s/IcebergIOIT/%s", options.getTempLocation(),
UUID.randomUUID());
-
tableId = testName.getMethodName() + ".test_table";
- catalog = new HadoopCatalog(catalogHadoopConf, warehouseLocation);
+ }
+
+ @AfterClass
+ public static void afterClass() throws IOException {
+ GcsUtil gcsUtil = options.as(GcsOptions.class).getGcsUtil();
+ GcsPath path = GcsPath.fromUri(warehouseLocation);
+
+ Objects objects =
+ gcsUtil.listObjects(path.getBucket(), "IcebergIOIT/" +
path.getFileName().toString(), null);
Review Comment:
I was syncing this changer to internal test, and found that if the test is
not run, and no file in the path, gcsUtil.listObjects will return null and
raise NPE in the invocation below. My fix was to put the following lines into
an if clause (sent review request internally), otherwise LGTM
--
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]