Skip to content

test(spanner): fix backup restore TimeoutError and premature instance cleanup#17150

Open
sakthivelmanii wants to merge 1 commit into
mainfrom
fix-spanner-samples-backup-restore-timeout
Open

test(spanner): fix backup restore TimeoutError and premature instance cleanup#17150
sakthivelmanii wants to merge 1 commit into
mainfrom
fix-spanner-samples-backup-restore-timeout

Conversation

@sakthivelmanii
Copy link
Copy Markdown
Contributor

No description provided.

@sakthivelmanii sakthivelmanii requested a review from a team as a code owner May 15, 2026 09:31
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the test suite to include TimeoutError in retry logic and extends the instance cleanup threshold from one to four hours. Feedback was provided regarding the exception handling in conftest.py, where catching the broad GoogleAPICallError might mask critical issues like permission or authentication failures; using more specific exceptions like NotFound and DeadlineExceeded was recommended.


retry_cleanup(to_scrub.delete)()
except exceptions.NotFound:
except exceptions.GoogleAPICallError:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Catching exceptions.GoogleAPICallError is overly broad for a function named scrub_instance_ignore_not_found. This base class includes critical errors such as PermissionDenied or Unauthenticated, which, if ignored, could lead to silent failures and resource leaks in the test environment. If the goal is to handle timeouts during cleanup in addition to missing instances, it is safer to catch specific exceptions to avoid masking configuration or permission issues. As per repository rules, avoid broad exception blocks and consider logging the exception (e.g., using logger.warning) instead of returning silently to aid in debugging.

Suggested change
except exceptions.GoogleAPICallError:
except (exceptions.NotFound, exceptions.DeadlineExceeded):
References
  1. Avoid broad except blocks that can mask underlying issues. Catching specific exceptions and logging them helps prevent masking critical failures like permission or authentication issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant