Skip to content

chore(spanner): fix instance partition test configuration and snippets test flakes - #18251

Merged
sakthivelmanii merged 2 commits into
mainfrom
fix-spanner-snippets-429-quota
Sep 2, 2026
Merged

chore(spanner): fix instance partition test configuration and snippets test flakes#18251
sakthivelmanii merged 2 commits into
mainfrom
fix-spanner-snippets-429-quota

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Description

  • Fixes test_create_instance_partition in packages/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 invoked create_instance_with_processing_units, which hardcodes regional-us-central1 (single-region), and then attempted to create a partition in nam3. This fix updates the test to create a multi-region ENTERPRISE_PLUS instance using multi_region_instance_config (nam3), matching the partition configuration.
  • Wraps instance creation in retry_429 to mitigate transient 429 quota exhaustion.
  • Updates dorny/paths-filter pin in .github/workflows/django-spanner-django5.2_tests.yml to # v4.0.1 to align with the rest of the repository and satisfy the zizmor action version check.

@sakthivelmanii
sakthivelmanii requested review from a team as code owners September 1, 2026 10:02

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

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.

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.

Comment thread packages/google-cloud-spanner/samples/samples/snippets_test.py Outdated
@sakthivelmanii
sakthivelmanii force-pushed the fix-spanner-snippets-429-quota branch from 7471fff to 872fda3 Compare September 1, 2026 17:49
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

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.

nit: import can be moved to top

@sakthivelmanii
sakthivelmanii merged commit 5d82396 into main Sep 2, 2026
46 checks passed
@sakthivelmanii
sakthivelmanii deleted the fix-spanner-snippets-429-quota branch September 2, 2026 06:36
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.

2 participants