Skip to content

Commit 73658e0

Browse files
committed
fix(tests): ensure commit_table is not called when no snapshots are expired
1 parent 635a1d9 commit 73658e0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tests/table/test_retention_strategies.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,15 @@ def test_expire_snapshots_by_timestamp_skips_protected(table_v2: Table) -> None:
234234
table_v2.catalog.commit_table.return_value = mock_response
235235

236236
table_v2.maintenance.expire_snapshots_older_than(future_timestamp)
237-
# Update metadata to reflect the commit (as in other tests)
238-
table_v2.metadata = mock_response.metadata
239237

240238
# Both protected snapshots should remain
241239
remaining_ids = {s.snapshot_id for s in table_v2.metadata.snapshots}
242240
assert HEAD_SNAPSHOT in remaining_ids
243241
assert TAGGED_SNAPSHOT in remaining_ids
244242

245-
# No snapshots should have been expired (commit_table called, but with empty snapshot_ids)
246-
args, _ = table_v2.catalog.commit_table.call_args
247-
updates = args[2] if len(args) > 2 else ()
248-
# Find RemoveSnapshotsUpdate in updates
249-
remove_update = next((u for u in updates if getattr(u, "action", None) == "remove-snapshots"), None)
250-
assert remove_update is not None
251-
assert remove_update.snapshot_ids == []
243+
# No snapshots should have been expired, so commit_table should not have been called
244+
# This is the correct behavior - don't create unnecessary transactions when there's nothing to do
245+
table_v2.catalog.commit_table.assert_not_called()
252246

253247

254248
def test_expire_snapshots_by_ids(table_v2: Table) -> None:

0 commit comments

Comments
 (0)