Repository navigation
Conversation
Delete backups under stale instances before calling delete_instance in clear_stale_instances so backed-up instances do not fail cleanup. Wire clear_stale_instances into v2_client/conftest.py, let data system tests use the full default prefix tuple, and wrap v2_client session fixture creation waits in try/finally so timed-out instances are still deleted.
There was a problem hiding this comment.
Code Review
This pull request introduces automatic cleanup of stale backups before deleting stale Bigtable instances during system tests. It adds a helper function _delete_instance_backups in utils.py to list and delete backups, updates clear_stale_instances to invoke this helper, and adds a session-scoped autouse fixture cleanup_old_instances in conftest.py to automate the cleanup process. Additionally, the fixtures admin_instance_populated and data_instance_populated are refactored to handle teardown exceptions more robustly, and comprehensive unit tests are added in test_system_cleanup.py to verify the new cleanup logic. No review comments were provided, so there is no feedback to address.
|
Splitting into 2 smaller independent PRs for easier review |
Context & Problem
Bigtable system tests can leak instances when v2_client runs leave stale instances unswept, when instance creation waits time out before yield, or when stale instances still hold backups that block delete_instance.
Summary of Changes
Why This Approach
Extends the existing clear_stale_instances helper and fixture patterns so all Bigtable system test suites share backup-aware cleanup without modifying production client code.
Diff size note: System test fixture and helper changes are 80 lines; the remaining lines are focused unit tests with 100% coverage in tests/unit/test_system_cleanup.py.
Intentionally Out of Scope
Verification
ruff check (including import sorting), ruff format --check, flake8, pytest with 100% coverage on test_system_cleanup.py, and two independent Owl review passes