Skip to content

test(spanner): reuse shared database in session API system tests - #18665

Open
olavloite wants to merge 2 commits into
mainfrom
spanner-reuse-shared-db-for-tests
Open

olavloite wants to merge 2 commits into
mainfrom
spanner-reuse-shared-db-for-tests

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Reuse shared_database instead of creating and dropping a dedicated database in test_session_api.py.

Previously, sessions_database provisioned a separate Spanner database with all 20 schema tables and protobuf descriptors, duplicating what shared_database already provides in conftest.py.

Changes:

  • Refactor the sessions_database fixture to wrap and return shared_database.
  • Pre-warm a session in the pool so OpenTelemetry span tests expecting session_found=True continue to pass.
  • Eliminate redundant database creation, DDL execution, and teardown drop calls, saving ~1 minute in standard CI.

Reuse `shared_database` instead of creating and dropping a dedicated
database in `test_session_api.py`.

Previously, `sessions_database` provisioned a separate Spanner database
with all 20 schema tables and protobuf descriptors, duplicating what
`shared_database` already provides in `conftest.py`.

Changes:
- Refactor the `sessions_database` fixture to wrap and return `shared_database`.
- Pre-warm a session in the pool so OpenTelemetry span tests expecting
  `session_found=True` continue to pass.
- Eliminate redundant database creation, DDL execution, and teardown drop
  calls, saving ~1 minute in standard CI.
@olavloite
olavloite requested a review from a team as a code owner October 13, 2026 14:24

@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 refactors the sessions_database fixture in packages/google-cloud-spanner/tests/system/test_session_api.py to utilize the shared_database fixture, removing the redundant database creation and teardown logic. There are no review comments, and we have no feedback to provide.

@parthea parthea added kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests. labels Oct 13, 2026
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Oct 13, 2026
@parthea

parthea commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@olavloite Please could you take a look at the failing system test?

@parthea
parthea marked this pull request as draft October 13, 2026 15:58
@olavloite
olavloite marked this pull request as ready for review October 14, 2026 11:56
@olavloite

Copy link
Copy Markdown
Contributor Author

@parthea Fixed in 5620068

This branch has not been deployed

No deployments
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.

3 participants