nastra commented on code in PR #6499:
URL: https://github.com/apache/iceberg/pull/6499#discussion_r1069502841


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java:
##########
@@ -307,6 +312,61 @@ public void testAlreadyExistsException() {
         () -> catalog.createTable(TABLE_IDENTIFIER, schema, 
PartitionSpec.unpartitioned()));
   }
 
+  @Test
+  public void testCreateTableCommitFailure() throws TException, 
InterruptedException {
+    String namespace = DB_NAME;
+    String tableName = getRandomName();
+    TableIdentifier tableIdentifier = TableIdentifier.of(namespace, tableName);
+
+    HiveTableOperations hiveTableOperations =
+        (HiveTableOperations) catalog.newTableOps(tableIdentifier);
+
+    String tableLocation = catalog.defaultWarehouseLocation(tableIdentifier);
+    TableMetadata metadataV1 = createTableMetadata(tableLocation);
+
+    HiveTableOperations spyOps = spy(hiveTableOperations);
+    failCommitAndThrowException(spyOps, new InvalidObjectException());
+
+    AssertHelpers.assertThrows(
+        "Should throw invalid object exception",
+        ValidationException.class,

Review Comment:
   it would be better to use `Assertions.assertThatThrownBy(...)` here, similar 
to 
https://github.com/apache/iceberg/blob/223177faf955bd8f11864477da16013cf5d7cc75/api/src/test/java/org/apache/iceberg/transforms/TestResiduals.java#L147-L149



##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java:
##########
@@ -307,6 +312,61 @@ public void testAlreadyExistsException() {
         () -> catalog.createTable(TABLE_IDENTIFIER, schema, 
PartitionSpec.unpartitioned()));
   }
 
+  @Test
+  public void testCreateTableCommitFailure() throws TException, 
InterruptedException {

Review Comment:
   both of these tests actually never reach the point where `checkCommitStatus` 
is being called, meaning that they will pass with/without the null check that 
has been added



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

Reply via email to