Skip to content

Commit 0edabc1

Browse files
committed
test(spanner): mock _get_cloud_region to avoid flaky retry test
1 parent 7ff1476 commit 0edabc1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/google-cloud-spanner/tests/unit/test_batch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,11 @@ def test_commit_ok(self, mock_region):
288288
),
289289
)
290290

291-
def test_aborted_exception_on_commit_with_retries(self):
291+
@mock.patch(
292+
"google.cloud.spanner_v1._opentelemetry_tracing._get_cloud_region",
293+
return_value="global",
294+
)
295+
def test_aborted_exception_on_commit_with_retries(self, mock_region):
292296
# Test case to verify that an Aborted exception is raised when
293297
# batch.commit() is called and the transaction is aborted internally.
294298
# The exception has request_id attribute added.

0 commit comments

Comments
 (0)