frankliee commented on code in PR #701: URL: https://github.com/apache/iceberg-python/pull/701#discussion_r1591985541
########## tests/integration/test_reads.py: ########## @@ -506,3 +508,40 @@ def test_hive_locking(session_catalog_hive: HiveCatalog) -> None: table.transaction().set_properties(lock="fail").commit_transaction() finally: open_client.unlock(UnlockRequest(lock.lockid)) + + +@pytest.mark.integration +def test_hive_locking_with_retry(session_catalog_hive: HiveCatalog) -> None: + table = create_table(session_catalog_hive) + database_name: str + table_name: str + _, database_name, table_name = table.identifier + + hive_client: _HiveClient = _HiveClient(session_catalog_hive.properties["uri"]) + + executor = ExecutorFactory.get_or_create() + + with hive_client as open_client: + + def another_task() -> None: + lock1: LockResponse = open_client.lock(session_catalog_hive._create_lock_request(database_name, table_name)) + time.sleep(5) Review Comment: I have added a new unit test `test_hive_wait_for_lock` in test_hive.py that uses mocked `lock` and `check_lock`. But I still keep an integration test based on the real hive metastore to simulate real-world cases. In order to reduce the test latency, I use fine-grained sleep time instead. WDYT? -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org