Repository navigation
test(spanner): unflake test_create_backup - #19171
sakthivelmanii wants to merge 2 commits into
Conversation
Align backup creation and copy sample LRO polling timeouts with the 3600s DatabaseAdmin GAPIC default timeout and add hermetic timeout unit tests.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request increases the backup operation polling timeout from 2100 to 3600 seconds across multiple functions in backup_sample.py and adds a new test file backup_sample_timeout_test.py to verify this behavior. Feedback on the new test file suggests a more idiomatic approach to setting the mock return value by directly assigning to the attribute instead of using setattr.
There was a problem hiding this comment.
Code Review
This pull request increases the backup and copy backup LRO polling timeout from 2100 to 3600 seconds across several functions in backup_sample.py. It also introduces a new test file, backup_sample_timeout_test.py, to verify these timeout settings. A review comment suggests a more idiomatic way to configure the mock's return value in the test by directly assigning to the attribute returned by getattr instead of using setattr.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request increases the long-running operation (LRO) polling timeout from 2100 to 3600 seconds for backup creation and copying functions in backup_sample.py. It also adds a new unit test file, backup_sample_timeout_test.py, to verify that the updated timeout is correctly used. There are no review comments, so no further feedback is provided.
Problem
create_backup,create_backup_with_encryption_key,create_backup_with_multiple_kms_keys,copy_backup, andcopy_backup_with_multiple_kms_keysinpackages/google-cloud-spanner/samples/samples/backup_sample.pypoll the backup long-running operation withoperation.result(2100)(35 minutes).CreateBackupoperations routinely take 25–36 minutes; when an operation slightly exceeds 2100 seconds,PollingFuture._blocking_pollraisesTimeoutErrorintest_create_backupwithout cancelling the server-side backup operation.test_create_backup_with_encryption_keyto fail withFailedPrecondition(maximum number of pending backups (1) for the database has been reached) and module teardown (sample_database.drop()) to fail withFailedPrecondition(backups pending creation).Solution
operation.result(...)polling timeout from2100to3600seconds across all five backup creation and copy sample functions inpackages/google-cloud-spanner/samples/samples/backup_sample.py, matching theDatabaseAdminGAPICdefault_timeout(3600.0seconds).packages/google-cloud-spanner/samples/samples/backup_sample_timeout_test.pyverifying that all five sample functions polloperation.result(3600)and assertBackup.State.READY.