Skip to content

Commit c097273

Browse files
committed
test: Adding some logging for emulator testing
test: Adding some logging for emulator testing test: Special conditioning for emulator
1 parent ab528a1 commit c097273

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.CommonTesting/SpannerTestDatabaseBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ public SpannerConnection GetConnection(Logger logger, bool logCommitStats = fals
185185

186186
public async Task<ManagedSession> GetManagedSession()
187187
{
188-
if (_multiplexSession != null)
188+
if (_multiplexSession != null && GetEnvironmentVariableOrDefault("SPANNER_EMULATOR_HOST", null) == null)
189189
{
190+
// Only return the same multiplex session if we are NOT testing on the emulator
190191
return _multiplexSession;
191192
}
192193

apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data/SessionPoolManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static SessionPoolManager()
4949
/// is specified on construction.
5050
/// </summary>
5151
public static SessionPoolManager Default { get; } =
52-
new SessionPoolManager(new SessionPoolOptions(), CreateDefaultSpannerSettings(), Logger.DefaultLogger, CreateClientAsync);
52+
new SessionPoolManager(new ManagedSessionOptions(), CreateDefaultSpannerSettings(), Logger.DefaultLogger, CreateClientAsync);
5353

5454
private readonly Func<SpannerClientCreationOptions, SpannerSettings, Task<SpannerClient>> _clientFactory;
5555

@@ -161,6 +161,7 @@ internal Task<ManagedSession> AcquireManagedSessionAsync(SpannerClientCreationOp
161161
{
162162
SessionPoolSegmentKey segmentKey = SessionPoolSegmentKey.Create(dbName).WithDatabaseRole(dbRole);
163163
GaxPreconditions.CheckNotNull(options, nameof(options));
164+
Logger.Warn($"SessionPoolManager AcquireManagedSessionAsync SegmentKey {segmentKey} existing in dictionary {_targetedMuxSessions.ContainsKey((options, segmentKey))}");
164165
var muxSession = _targetedMuxSessions.GetOrAdd((options, segmentKey), CreateMultiplexSessionAsync());
165166
return muxSession;
166167

0 commit comments

Comments
 (0)