test: add a test for unary retries of UNAVAILABLE (#1376) · googleapis/python-spanner@1f4e98c · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 1f4e98c

Browse files
authored
test: add a test for unary retries of UNAVAILABLE (#1376)
1 parent 3a91671 commit 1f4e98c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/mockserver_tests/test_basics.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ def test_dbapi_partitioned_dml(self):
9393
TransactionOptions(dict(partitioned_dml={})), begin_request.options
9494
)
9595

96+
def test_batch_create_sessions_unavailable(self):
97+
add_select1_result()
98+
add_error(SpannerServicer.BatchCreateSessions.__name__, unavailable_status())
99+
with self.database.snapshot() as snapshot:
100+
results = snapshot.execute_sql("select 1")
101+
result_list = []
102+
for row in results:
103+
result_list.append(row)
104+
self.assertEqual(1, row[0])
105+
self.assertEqual(1, len(result_list))
106+
requests = self.spanner_service.requests
107+
self.assertEqual(3, len(requests), msg=requests)
108+
# The BatchCreateSessions call should be retried.
109+
self.assertTrue(isinstance(requests[0], BatchCreateSessionsRequest))
110+
self.assertTrue(isinstance(requests[1], BatchCreateSessionsRequest))
111+
self.assertTrue(isinstance(requests[2], ExecuteSqlRequest))
112+
96113
def test_execute_streaming_sql_unavailable(self):
97114
add_select1_result()
98115
# Add an UNAVAILABLE error that is returned the first time the

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.