Skip to content

Commit abfffbf

Browse files
committed
Make ServerSelectionTimeout configurable via an environment variable and change the default value to 10 seconds in DriverTestConfiguration also.
1 parent 9e8e3d2 commit abfffbf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/MongoDB.Driver.TestHelpers/DriverTestConfiguration.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ static DriverTestConfiguration()
4040
clientSettings.WriteConcern = WriteConcern.Acknowledged; // ensure WriteConcern is enabled regardless of what the URL says
4141
}
4242

43-
clientSettings.ServerSelectionTimeout = TimeSpan.FromMilliseconds(500);
43+
var serverSelectionTimeoutString = Environment.GetEnvironmentVariable("MONGO_SERVER_SELECTION_TIMEOUT_MS");
44+
if (serverSelectionTimeoutString == null)
45+
{
46+
serverSelectionTimeoutString = "10000";
47+
}
48+
clientSettings.ServerSelectionTimeout = TimeSpan.FromMilliseconds(int.Parse(serverSelectionTimeoutString));
4449

4550
__client = new MongoClient(clientSettings);
4651
__databaseNamespace = mongoUrl.DatabaseName == null ? CoreTestConfiguration.DatabaseNamespace : new DatabaseNamespace(mongoUrl.DatabaseName);

0 commit comments

Comments
 (0)