aokolnychyi commented on a change in pull request #2328:
URL: https://github.com/apache/iceberg/pull/2328#discussion_r593524866



##########
File path: 
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java
##########
@@ -66,4 +75,221 @@ public void testSuppressUnlockExceptions() throws 
TException, InterruptedExcepti
     // the commit must succeed
     Assert.assertEquals(1, ops.current().schema().columns().size());
   }
+
+  @Test
+  public void testThriftExceptionFailureOnCommit() throws TException, 
InterruptedException {
+    Table table = catalog.loadTable(TABLE_IDENTIFIER);
+    HiveTableOperations ops = (HiveTableOperations) ((HasTableOperations) 
table).operations();
+
+    TableMetadata metadataV1 = ops.current();
+
+    table.updateSchema()
+        .addColumn("n", Types.IntegerType.get())
+        .commit();
+
+    ops.refresh();
+
+    TableMetadata metadataV2 = ops.current();
+
+    Assert.assertEquals(2, ops.current().schema().columns().size());
+
+    HiveTableOperations spyOps = spy(ops);
+
+    failCommitAndThrowException(spyOps);
+
+    AssertHelpers.assertThrows("We should rethrow generic runtime errors if 
the " +
+        "commit actually doesn't succeed", RuntimeException.class, "Datacenter 
on fire",
+        () -> spyOps.commit(metadataV2, metadataV1));
+
+    ops.refresh();
+    Assert.assertTrue("Current metadata should not have changed", 
ops.current().equals(metadataV2));

Review comment:
       nit: `assertEquals`?




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

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