Skip to content

Commit fe455fb

Browse files
committed
tests(Spanner): Fix flakes in PooledSessionTests.
When using ForPartsOf NSubstitute calls the base methods, even on setup. Our base client SpannerClient implements all methods by throwing NotImplementedException. It seems there are cases where NSubstitute does not gracefully handle the exception.
1 parent 0be97a7 commit fe455fb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.Tests/V1/PooledSessionTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ await client.Received(1).ExecuteSqlAsync(
140140
Assert.Equal(s_readWriteOptions, request.Transaction.Begin);
141141
}),
142142
Arg.Any<CallSettings>());
143+
await client.DidNotReceive().BeginTransactionAsync(Arg.Any<BeginTransactionRequest>(), Arg.Any<CallSettings>());
143144
}
144145

145146
[Fact]

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.Tests/V1/SpannerClientHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal static SpannerClient CreateMockClient(Logger logger)
5858
settings.Scheduler = fakeScheduler;
5959
settings.Clock = fakeScheduler.Clock;
6060
settings.Logger = logger;
61-
var mock = Substitute.ForPartsOf<SpannerClient>();
61+
var mock = Substitute.For<SpannerClient>();
6262
mock.Settings.Returns(settings);
6363
return mock;
6464
}

0 commit comments

Comments
 (0)