@@ -19,7 +19,7 @@ const failPoint = {
19
19
20
20
const POOL_SIZE = 100 ;
21
21
22
- async function runTaskGroup ( collection : Collection , count : 10 | 100 ) {
22
+ async function runTaskGroup ( collection : Collection , count : 10 | 100 | 500 ) {
23
23
for ( let i = 0 ; i < count ; ++ i ) {
24
24
await collection . findOne ( { } ) ;
25
25
}
@@ -147,13 +147,19 @@ describe('operationCount-based Selection Within Latency Window - Prose Test', fu
147
147
it ( 'equally distributes operations with both hosts are fine' , TEST_METADATA , async function ( ) {
148
148
const collection = client . db ( 'test-db' ) . collection ( 'collection0' ) ;
149
149
150
+ const numberTaskGroups = 10 ;
151
+ const numberOfTasks = 500 ;
152
+ const totalNumberOfTasks = numberTaskGroups * numberOfTasks ;
153
+
150
154
// Step 8: Start 10 concurrent threads / tasks that each run 100 findOne operations with empty filters using that client.
151
- await Promise . all ( Array . from ( { length : 10 } , ( ) => runTaskGroup ( collection , 100 ) ) ) ;
155
+ await Promise . all (
156
+ Array . from ( { length : numberTaskGroups } , ( ) => runTaskGroup ( collection , numberOfTasks ) )
157
+ ) ;
152
158
153
159
// Step 9: Using command monitoring events, assert that each mongos was selected roughly 50% of the time (within +/- 10%).
154
160
const [ host1 , host2 ] = seeds . map ( seed => seed . split ( ':' ) [ 1 ] ) ;
155
- const percentageToHost1 = ( counts [ host1 ] / 1000 ) * 100 ;
156
- const percentageToHost2 = ( counts [ host2 ] / 1000 ) * 100 ;
161
+ const percentageToHost1 = ( counts [ host1 ] / totalNumberOfTasks ) * 100 ;
162
+ const percentageToHost2 = ( counts [ host2 ] / totalNumberOfTasks ) * 100 ;
157
163
expect ( percentageToHost1 ) . to . be . greaterThan ( 40 ) . and . lessThan ( 60 ) ;
158
164
expect ( percentageToHost2 ) . to . be . greaterThan ( 40 ) . and . lessThan ( 60 ) ;
159
165
} ) ;
0 commit comments