Repository navigation
Conversation
Spanner sync system test teardown can leak instances or crash when shared_instance creation times out, when backups or drop-protected databases remain, when scrub_referencing_databases calls nonexistent db.delete(), or when parallel CI runs race on NotFound.
There was a problem hiding this comment.
Code Review
This pull request improves the robustness of the system test cleanup and setup processes. It updates database deletion to use drop(), handles potential NotFound exceptions when scrubbing instance backups, wraps the database drop protection disabling in a try-except block, and handles ValueError when parsing instance creation times. Additionally, it refactors the shared_instance fixture in conftest.py to ensure instances are properly scrubbed in a finally block. The review feedback suggests making the database cleanup in scrub_instance_ignore_not_found even more robust by catching all exceptions during reload and update operations, preventing a single failure from aborting the entire cleanup process and causing resource leaks.
Context & Problem
Spanner sync system test teardown can leak instances or crash when shared_instance creation times out, when backups or drop-protected databases remain, when scrub_referencing_databases calls nonexistent db.delete(), or when parallel CI runs race on NotFound.
Summary of Changes
Why This Approach
Fixes concrete teardown bugs in the existing sync helpers and fixture without touching production client code or async test files.
Intentionally Out of Scope
Verification
nox -s lint mypy-3.14 unit-3.14 unit-3.10 cover and two independent Owl review passes