@@ -18,7 +18,7 @@ import {
18
18
ObjectId ,
19
19
promiseWithResolvers
20
20
} from '../../mongodb' ;
21
- import { type FailPoint } from '../../tools/utils' ;
21
+ import { type FailPoint , waitUntilPoolsFilled } from '../../tools/utils' ;
22
22
23
23
// TODO(NODE-5824): Implement CSOT prose tests
24
24
describe ( 'CSOT spec prose tests' , function ( ) {
@@ -1154,34 +1154,37 @@ describe('CSOT spec prose tests', function () {
1154
1154
*
1155
1155
* 7. Verify that two `bulkWrite` commands were executed as part of the `MongoClient.bulkWrite` call.
1156
1156
*/
1157
- const failpoint : FailPoint = {
1158
- configureFailPoint : 'failCommand' ,
1159
- mode : {
1160
- times : 2
1161
- } ,
1162
- data : {
1163
- failCommands : [ 'bulkWrite' ] ,
1164
- blockConnection : true ,
1165
- blockTimeMS : 1010
1166
- }
1167
- } ;
1168
-
1169
1157
let maxBsonObjectSize : number ;
1170
1158
let maxMessageSizeBytes : number ;
1171
1159
1172
1160
beforeEach ( async function ( ) {
1173
1161
await internalClient
1174
1162
. db ( 'db' )
1175
- . collection ( 'coll ' )
1163
+ . collection ( 'coll_bulk_write ' )
1176
1164
. drop ( )
1177
1165
. catch ( ( ) => null ) ;
1178
- await internalClient . db ( 'admin' ) . command ( failpoint ) ;
1166
+ await internalClient . db ( 'admin' ) . command ( < FailPoint > {
1167
+ configureFailPoint : 'failCommand' ,
1168
+ mode : {
1169
+ times : 2
1170
+ } ,
1171
+ data : {
1172
+ failCommands : [ 'bulkWrite' ] ,
1173
+ blockConnection : true ,
1174
+ blockTimeMS : 1000
1175
+ }
1176
+ } ) ;
1179
1177
1180
- const hello = await internalClient . db ( 'admin' ) . command ( { hello : 1 } ) ;
1178
+ const hello = await this . configuration . hello ( ) ;
1181
1179
maxBsonObjectSize = hello . maxBsonObjectSize ;
1182
1180
maxMessageSizeBytes = hello . maxMessageSizeBytes ;
1183
1181
1184
- client = this . configuration . newClient ( { timeoutMS : 2000 , monitorCommands : true } ) ;
1182
+ client = this . configuration . newClient (
1183
+ { timeoutMS : 4000 , monitorCommands : true } ,
1184
+ { minPoolSize : 5 }
1185
+ ) ;
1186
+
1187
+ await waitUntilPoolsFilled ( client , AbortSignal . timeout ( 30_000 ) , 5 ) ;
1185
1188
} ) ;
1186
1189
1187
1190
it ( 'performs two bulkWrites which fail to complete before 2000 ms' , async function ( ) {
@@ -1190,7 +1193,7 @@ describe('CSOT spec prose tests', function () {
1190
1193
1191
1194
const length = maxMessageSizeBytes / maxBsonObjectSize + 1 ;
1192
1195
const models = Array . from ( { length } , ( ) => ( {
1193
- namespace : 'db.coll ' ,
1196
+ namespace : 'db.coll_bulk_write ' ,
1194
1197
name : 'insertOne' as const ,
1195
1198
document : { a : 'b' . repeat ( maxBsonObjectSize - 500 ) }
1196
1199
} ) ) ;
0 commit comments