Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix flaky abort retry error
  • Loading branch information
rahul2393 committed Oct 28, 2025
commit 94d8f2a4d64505c68eb155bbfdfd36d3b7c4e6b0
5 changes: 3 additions & 2 deletions tests/unit/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,8 +1702,9 @@ def unit_of_work(txn, *args, **kw):
def _time(_results=[1, 2, 4, 8]):
return _results.pop(0)

with mock.patch("time.time", _time):
with mock.patch("time.sleep") as sleep_mock:
with mock.patch("time.time", _time), \
mock.patch("google.cloud.spanner_v1._helpers.random.random", return_value=0), \
mock.patch("time.sleep") as sleep_mock:
with self.assertRaises(Aborted):
session.run_in_transaction(unit_of_work, timeout_secs=8)

Expand Down
Loading