chore(spanner): fix instance partition test configuration and snippets test flakes - #18251
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the test_create_instance_partition test in snippets_test.py to explicitly create a Spanner instance with the ENTERPRISE_PLUS edition and wait for its completion. The review feedback recommends wrapping the instance creation and test assertions in a try...finally block to guarantee that the Spanner instance is cleaned up even if the test fails or times out, preventing resource leaks.
…create_instance_partition
sakthivelmanii
force-pushed
the
fix-spanner-snippets-429-quota
branch
from
September 1, 2026 17:49
7471fff to
872fda3
Compare
sinhasubham
reviewed
Sep 1, 2026
| def test_create_instance_partition( | ||
| capsys, instance_partition_instance_id, multi_region_instance_config | ||
| ): | ||
| from google.cloud.spanner_admin_instance_v1.types import spanner_instance_admin |
Contributor
There was a problem hiding this comment.
nit: import can be moved to top
sinhasubham
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
test_create_instance_partitioninpackages/google-cloud-spanner/samples/samples/snippets_test.py:Cloud Spanner enforces
CreateInstancePartitionInSingleRegionInstance("Cannot create an instance partition in a single region instance"). Previously, the test invokedcreate_instance_with_processing_units, which hardcodesregional-us-central1(single-region), and then attempted to create a partition innam3. This fix updates the test to create a multi-regionENTERPRISE_PLUSinstance usingmulti_region_instance_config(nam3), matching the partition configuration.retry_429to mitigate transient 429 quota exhaustion.dorny/paths-filterpin in.github/workflows/django-spanner-django5.2_tests.ymlto# v4.0.1to align with the rest of the repository and satisfy thezizmoraction version check.