Skip to content

Commit 84f10fc

Browse files
committed
Update tests with session.getRequestIdCreator
1 parent f880d1c commit 84f10fc

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/PartitionedDmlTransactionTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public void setup() {
9797
MockitoAnnotations.initMocks(this);
9898
when(session.getName()).thenReturn(sessionId);
9999
when(session.getOptions()).thenReturn(Collections.EMPTY_MAP);
100+
when(session.getRequestIdCreator())
101+
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());
100102
when(rpc.beginTransaction(any(BeginTransactionRequest.class), anyMap(), eq(true)))
101103
.thenReturn(Transaction.newBuilder().setId(txId).build());
102104

google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,8 @@ public void testSessionNotFoundReadWriteTransaction() {
14811481
when(closedSession.getName())
14821482
.thenReturn("projects/dummy/instances/dummy/database/dummy/sessions/session-closed");
14831483
when(closedSession.getErrorHandler()).thenReturn(DefaultErrorHandler.INSTANCE);
1484+
when(closedSession.getRequestIdCreator())
1485+
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());
14841486

14851487
Span oTspan = mock(Span.class);
14861488
ISpan span = new OpenTelemetrySpan(oTspan);
@@ -1521,6 +1523,8 @@ public void testSessionNotFoundReadWriteTransaction() {
15211523
TransactionRunnerImpl openTransactionRunner = new TransactionRunnerImpl(openSession);
15221524
openTransactionRunner.setSpan(span);
15231525
when(openSession.readWriteTransaction()).thenReturn(openTransactionRunner);
1526+
when(openSession.getRequestIdCreator())
1527+
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());
15241528

15251529
ResultSet openResultSet = mock(ResultSet.class);
15261530
when(openResultSet.next()).thenReturn(true, false);

google-cloud-spanner/src/test/java/com/google/cloud/spanner/TransactionContextImplTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public void setup() {
6767
.setCommitTimestamp(Timestamp.newBuilder().setSeconds(99L).setNanos(10).build())
6868
.build()));
6969
when(session.getName()).thenReturn("test");
70+
when(session.getRequestIdCreator())
71+
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());
7072
doNothing().when(span).setStatus(any(Throwable.class));
7173
doNothing().when(span).end();
7274
doNothing().when(span).addAnnotation("Starting Commit");
@@ -210,6 +212,8 @@ public void testReturnCommitStats() {
210212
private void batchDml(int status) {
211213
SessionImpl session = mock(SessionImpl.class);
212214
when(session.getName()).thenReturn("test");
215+
when(session.getRequestIdCreator())
216+
.thenReturn(new XGoogSpannerRequestId.NoopRequestIdCreator());
213217
SpannerRpc rpc = mock(SpannerRpc.class);
214218
ExecuteBatchDmlResponse response =
215219
ExecuteBatchDmlResponse.newBuilder()

0 commit comments

Comments
 (0)