Skip to content

test: add a test for unary retries of UNAVAILABLE #1376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Changes from all commits
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
17 changes: 17 additions & 0 deletions tests/mockserver_tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ def test_dbapi_partitioned_dml(self):
TransactionOptions(dict(partitioned_dml={})), begin_request.options
)

def test_batch_create_sessions_unavailable(self):
add_select1_result()
add_error(SpannerServicer.BatchCreateSessions.__name__, unavailable_status())
with self.database.snapshot() as snapshot:
results = snapshot.execute_sql("select 1")
result_list = []
for row in results:
result_list.append(row)
self.assertEqual(1, row[0])
self.assertEqual(1, len(result_list))
requests = self.spanner_service.requests
self.assertEqual(3, len(requests), msg=requests)
# The BatchCreateSessions call should be retried.
self.assertTrue(isinstance(requests[0], BatchCreateSessionsRequest))
self.assertTrue(isinstance(requests[1], BatchCreateSessionsRequest))
self.assertTrue(isinstance(requests[2], ExecuteSqlRequest))

def test_execute_streaming_sql_unavailable(self):
add_select1_result()
# Add an UNAVAILABLE error that is returned the first time the
Expand Down
Loading