chore: make precommit token check emulator-proof #1402
Merged
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.
The Emulator returns an empty pre-commit token when a commit is attempted
without a pre-commit token. This is different from not returning any
pre-commit token at all. The check for 'did the Commit return a pre-commit
token?' did not take this into account, which caused commits on the
Emulator that needed to be retried, not to be retried. This again caused
multiple test errors when running on the Emulator, as this would keep a
transaction present on the test database on the Emulator, and the Emulator
only supports one transaction at a time. These test failures went unnoticed,
because the test configuration for the Emulator had pinned the Emulator
version to 1.5.37, which did not support multiplexed sessions. This again
caused the tests to fall back to using regular sessions.
This change fixes the check for whether a pre-commit token was returned by
a Commit. It also unpins the Emulator version for the system tests using
default settings. This ensures that the tests actually use multiplexed
sessions.
See this failed test run from before making these changes (the only change for this test run was to use the latest emulator version, which triggered multiplexed sessions to be used): https://github.com/googleapis/python-spanner/actions/runs/16940453081/job/48007847941?pr=1402