pvary commented on code in PR #10016:
URL: https://github.com/apache/iceberg/pull/10016#discussion_r1537095790


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java:
##########
@@ -397,6 +399,36 @@ public void testLockExceptionUnknownSuccessCommit() throws 
TException, Interrupt
         .isTrue();
   }
 
+  @Test
+  public void testChangeLockWithAlterTable() throws Exception {
+    Table table = catalog.loadTable(TABLE_IDENTIFIER);
+    HiveTableOperations ops = (HiveTableOperations) ((HasTableOperations) 
table).operations();
+    TableMetadata base = ops.current();
+    final HiveLock initialLock = ops.lockObject(base);
+
+    AtomicReference<HiveLock> lockRef = new AtomicReference<>();
+    HiveTableOperations spyOps = spy(ops);
+    doAnswer(
+            i -> {
+              lockRef.set(ops.lockObject(i.getArgument(0)));
+              return lockRef.get();
+            })
+        .when(spyOps)
+        .lockObject(any());

Review Comment:
   If we check the argument, then we also check, that our assumptions about the 
tests are correct. I recently faced an issue when an unrelated change made the 
test irrelevant (the methods called with different parameter values), but the 
tests were green, because `any` were used to match the arguments



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