Skip to content

Commit

Permalink
chore: remove GetSession requests
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Dec 6, 2024
1 parent 65d7d3b commit 8379c74
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions test/mockserver_tests/test_stale_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
FixedSizePool,
BatchCreateSessionsRequest,
ExecuteSqlRequest,
GetSessionRequest,
BeginTransactionRequest,
TransactionOptions,
)
Expand Down Expand Up @@ -55,19 +54,16 @@ def test_stale_read_multi_use(self):

# Verify the requests that we got.
requests = self.spanner_service.requests
eq_(9, len(requests))
eq_(7, len(requests))
is_instance_of(requests[0], BatchCreateSessionsRequest)
# We should get rid of this extra round-trip for GetSession....
is_instance_of(requests[1], GetSessionRequest)
is_instance_of(requests[2], BeginTransactionRequest)
is_instance_of(requests[1], BeginTransactionRequest)
is_instance_of(requests[2], ExecuteSqlRequest)
is_instance_of(requests[3], ExecuteSqlRequest)
is_instance_of(requests[4], ExecuteSqlRequest)
is_instance_of(requests[5], GetSessionRequest)
is_instance_of(requests[6], BeginTransactionRequest)
is_instance_of(requests[7], ExecuteSqlRequest)
is_instance_of(requests[8], ExecuteSqlRequest)
is_instance_of(requests[4], BeginTransactionRequest)
is_instance_of(requests[5], ExecuteSqlRequest)
is_instance_of(requests[6], ExecuteSqlRequest)
# Verify that the transaction is a read-only transaction.
for index in [2, 6]:
for index in [1, 4]:
begin_request: BeginTransactionRequest = requests[index]
eq_(
TransactionOptions(
Expand Down Expand Up @@ -105,15 +101,12 @@ def test_stale_read_single_use(self):

# Verify the requests that we got.
requests = self.spanner_service.requests
eq_(5, len(requests))
eq_(3, len(requests))
is_instance_of(requests[0], BatchCreateSessionsRequest)
# We should get rid of this extra round-trip for GetSession....
is_instance_of(requests[1], GetSessionRequest)
is_instance_of(requests[1], ExecuteSqlRequest)
is_instance_of(requests[2], ExecuteSqlRequest)
is_instance_of(requests[3], GetSessionRequest)
is_instance_of(requests[4], ExecuteSqlRequest)
# Verify that the requests use a stale read.
for index in [2, 4]:
for index in [1, 2]:
execute_request: ExecuteSqlRequest = requests[index]
eq_(
TransactionOptions(
Expand Down

0 comments on commit 8379c74

Please sign in to comment.