File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments