Skip to content

tests(spanner): avoid table name collisions in tests - #18001

Merged
parthea merged 3 commits into
mainfrom
fix/spanner-table-collisions
Aug 5, 2026
Merged

tests(spanner): avoid table name collisions in tests#18001
parthea merged 3 commits into
mainfrom
fix/spanner-table-collisions

Conversation

@chalmerlowe

Copy link
Copy Markdown
Contributor

Fix Spanner Test Flakes: Avoid Generic Table Names

Problem

The sqlalchemy-spanner test suite occasionally fails with Duplicate name in schema: t. errors. This happens because multiple tests use the generic table name t. In a shared database environment, or due to buffered DDL statements in Spanner (which are non-transactional), a table from a previous test might still exist when a new test tries to create it.

Solution

Renamed the generic table name t to more specific names in several tests and fixtures to avoid collisions.

  • In tests/conftest.py, renamed t to t_literal_round_trip_spanner.
  • In tests/test_suite_14.py:
    • Renamed t to t_nullable_reflection in test_nullable_reflection.
    • Renamed t to t_type_round_trip in _type_round_trip.
    • Renamed t to t_percent_signs in EscapingTest.
    • Renamed t to t_do_numeric in NumericTest.

Notes to Reviewers

These changes are purely in test code and aim to improve test stability by eliminating shared resource name collisions.

@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 reorganizes imports in test_suite_14.py and renames generic test table names (from "t" to more descriptive, unique names like "t_literal_round_trip_spanner", "t_nullable_reflection", etc.) across the test suite to prevent potential table name collisions. There are no review comments, so I have no feedback to provide.

@chalmerlowe chalmerlowe self-assigned this Aug 5, 2026
@chalmerlowe chalmerlowe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 5, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 5, 2026
@parthea parthea changed the title fix(spanner): avoid table name collisions in tests tests(spanner): avoid table name collisions in tests Aug 5, 2026
@chalmerlowe
chalmerlowe marked this pull request as ready for review August 5, 2026 14:29
@chalmerlowe
chalmerlowe requested a review from a team as a code owner August 5, 2026 14:29
@parthea
parthea merged commit 32fd479 into main Aug 5, 2026
45 checks passed
@parthea
parthea deleted the fix/spanner-table-collisions branch August 5, 2026 14:53
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.

4 participants