...
1description: "timeoutMS behaves correctly for bulkWrite operations"
2
3schemaVersion: "1.9"
4
5runOnRequirements:
6 - minServerVersion: "4.4"
7
8createEntities:
9 - client:
10 id: &failPointClient failPointClient
11 useMultipleMongoses: false
12 - client:
13 id: &client client
14 useMultipleMongoses: false
15 observeEvents:
16 - commandStartedEvent
17 - database:
18 id: &database database
19 client: *client
20 databaseName: &databaseName test
21 - collection:
22 id: &collection collection
23 database: *database
24 collectionName: &collectionName coll
25
26initialData:
27 - collectionName: *collectionName
28 databaseName: *databaseName
29 documents: []
30
31tests:
32 # Test that drivers do not refresh timeoutMS between commands. This is done by running a bulkWrite that will require
33 # two commands with timeoutMS=200 and blocking each command for 120ms. The server should take over 200ms total, so the
34 # bulkWrite should fail with a timeout error.
35 - description: "timeoutMS applied to entire bulkWrite, not individual commands"
36 operations:
37 - name: failPoint
38 object: testRunner
39 arguments:
40 client: *failPointClient
41 failPoint:
42 configureFailPoint: failCommand
43 mode: { times: 2 }
44 data:
45 failCommands: ["insert", "update"]
46 blockConnection: true
47 blockTimeMS: 120
48 # Do an operation without a timeout to ensure the servers are discovered.
49 - name: find
50 object: *collection
51 arguments:
52 filter: { _id : 1 }
53 - name: bulkWrite
54 object: *collection
55 arguments:
56 requests:
57 - insertOne:
58 document: { _id: 1 }
59 - replaceOne:
60 filter: { _id: 1 }
61 replacement: { x: 1 }
62 timeoutMS: 200
63 expectError:
64 isTimeoutError: true
65 expectEvents:
66 - client: *client
67 events:
68 - commandStartedEvent:
69 commandName: find
70 databaseName: *databaseName
71 command:
72 find: *collectionName
73 - commandStartedEvent:
74 commandName: insert
75 databaseName: *databaseName
76 command:
77 insert: *collectionName
78 maxTimeMS: { $$type: ["int", "long"] }
79 - commandStartedEvent:
80 commandName: update
81 databaseName: *databaseName
82 command:
83 update: *collectionName
84 maxTimeMS: { $$type: ["int", "long"] }
View as plain text