Skip to content

Commit 34de46d

Browse files
committed
CSHARP-3683: Stabilize server selection prose test
1 parent 67d6bb8 commit 34de46d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/MongoDB.Driver.Tests/ClusterTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public void SelectServer_loadbalancing_prose_test([Values(false, true)] bool asy
7070

7171
const string applicationName = "loadBalancingTest";
7272
const int threadsCount = 10;
73-
const int commandsPerThreadCount = 10;
73+
const int commandsFailPointPerThreadCount = 10;
74+
const int commandsPerThreadCount = 100;
7475
const double maxCommandsOnSlowServerRatio = 0.3; // temporary set slow server load to 30% from 25% until find timings are investigated
7576
const double operationsCountTolerance = 0.10;
7677

@@ -102,26 +103,26 @@ public void SelectServer_loadbalancing_prose_test([Values(false, true)] bool asy
102103
channel.Dispose();
103104
}
104105

105-
var (allCount, eventsOnSlowServerCount) = ExecuteFindOperations(collection, slowServer.ServerId);
106+
var (allCount, eventsOnSlowServerCount) = ExecuteFindOperations(collection, slowServer.ServerId, commandsFailPointPerThreadCount);
106107
eventsOnSlowServerCount.Should().BeLessThan((int)(allCount * maxCommandsOnSlowServerRatio));
107108

108109
failPoint.Dispose();
109110

110-
(allCount, eventsOnSlowServerCount) = ExecuteFindOperations(collection, slowServer.ServerId);
111+
(allCount, eventsOnSlowServerCount) = ExecuteFindOperations(collection, slowServer.ServerId, commandsPerThreadCount);
111112

112113
var singleServerOperationsPortion = allCount / 2;
113114
var singleServerOperationsRange = (int)Math.Ceiling(allCount * operationsCountTolerance);
114115

115116
eventsOnSlowServerCount.Should().BeInRange(singleServerOperationsPortion - singleServerOperationsRange, singleServerOperationsPortion + singleServerOperationsRange);
116117
}
117118

118-
(int allCount, int slowServerCount) ExecuteFindOperations(IMongoCollection<BsonDocument> collection, ServerId serverId)
119+
(int allCount, int slowServerCount) ExecuteFindOperations(IMongoCollection<BsonDocument> collection, ServerId serverId, int operationsCount)
119120
{
120121
eventCapturer.Clear();
121122

122123
ThreadingUtilities.ExecuteOnNewThreads(threadsCount, __ =>
123124
{
124-
for (int i = 0; i < commandsPerThreadCount; i++)
125+
for (int i = 0; i < operationsCount; i++)
125126
{
126127
if (async)
127128
{

0 commit comments

Comments
 (0)