File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
tests/MongoDB.Driver.TestHelpers Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 29
29
using MongoDB . Driver . Core . Operations ;
30
30
using MongoDB . Driver . Core . Servers ;
31
31
using MongoDB . Driver . Core . WireProtocol . Messages . Encoders ;
32
- using MongoDB . Driver . Encryption ;
33
32
using MongoDB . Driver . TestHelpers ;
34
33
using Xunit . Sdk ;
35
34
@@ -127,7 +126,16 @@ public static ClusterBuilder ConfigureCluster(ClusterBuilder builder)
127
126
{
128
127
builder = builder
129
128
. ConfigureWithConnectionString ( __connectionString . Value , __serverApi . Value )
130
- . ConfigureCluster ( c => c . With ( serverSelectionTimeout : __defaultServerSelectionTimeout . Value ) ) ;
129
+ . ConfigureCluster ( c => c . With ( serverSelectionTimeout : __defaultServerSelectionTimeout . Value ) )
130
+ . ConfigureServer ( s =>
131
+ {
132
+ if ( Debugger . IsAttached )
133
+ {
134
+ s = s . With ( heartbeatTimeout : TimeSpan . FromDays ( 1 ) , serverMonitoringMode : ServerMonitoringMode . Poll ) ;
135
+ }
136
+
137
+ return s ;
138
+ } ) ; ;
131
139
132
140
if ( __connectionString . Value . Tls . HasValue &&
133
141
__connectionString . Value . Tls . Value &&
Original file line number Diff line number Diff line change 24
24
using MongoDB . Driver . Core . Clusters ;
25
25
using MongoDB . Driver . Core . Configuration ;
26
26
using MongoDB . Driver . Core . Connections ;
27
- using MongoDB . Driver . Core . Logging ;
28
27
using MongoDB . Driver . Core . Servers ;
29
28
using MongoDB . Driver . Encryption ;
30
29
@@ -184,6 +183,13 @@ public static MongoClientSettings GetClientSettings()
184
183
{
185
184
serverSelectionTimeoutString = "30000" ;
186
185
}
186
+
187
+ if ( System . Diagnostics . Debugger . IsAttached )
188
+ {
189
+ clientSettings . HeartbeatTimeout = TimeSpan . FromDays ( 1 ) ;
190
+ clientSettings . ServerMonitoringMode = ServerMonitoringMode . Poll ;
191
+ }
192
+
187
193
clientSettings . ServerSelectionTimeout = TimeSpan . FromMilliseconds ( int . Parse ( serverSelectionTimeoutString ) ) ;
188
194
clientSettings . ClusterConfigurator = cb => CoreTestConfiguration . ConfigureLogging ( cb ) ;
189
195
clientSettings . ServerApi = CoreTestConfiguration . ServerApi ;
You can’t perform that action at this time.
0 commit comments