...
1# Test SDAM error handling.
2runOn:
3 # failCommand appName requirements
4 - minServerVersion: "4.4"
5
6database_name: &database_name "sdam-tests"
7collection_name: &collection_name "insert-network-error"
8
9data: &data
10 - {_id: 1}
11 - {_id: 2}
12
13tests:
14 - description: Reset server and pool after network error on insert
15 failPoint:
16 configureFailPoint: failCommand
17 mode: { times: 1 }
18 data:
19 failCommands: ["insert"]
20 closeConnection: true
21 appName: insertNetworkErrorTest
22 clientOptions:
23 retryWrites: false
24 appname: insertNetworkErrorTest
25 operations:
26 - name: insertMany
27 object: collection
28 arguments:
29 documents:
30 - _id: 3
31 - _id: 4
32 error: true
33 - name: waitForEvent
34 object: testRunner
35 arguments:
36 event: ServerMarkedUnknownEvent
37 count: 1
38 - name: waitForEvent
39 object: testRunner
40 arguments:
41 event: PoolClearedEvent
42 count: 1
43 # Perform another operation to ensure the node is rediscovered.
44 - name: insertMany
45 object: collection
46 arguments:
47 documents:
48 - _id: 5
49 - _id: 6
50 # Assert the server was marked Unknown and pool was cleared exactly once.
51 - name: assertEventCount
52 object: testRunner
53 arguments:
54 event: ServerMarkedUnknownEvent
55 count: 1
56 - name: assertEventCount
57 object: testRunner
58 arguments:
59 event: PoolClearedEvent
60 count: 1
61
62 expectations:
63 - command_started_event:
64 command:
65 insert: *collection_name
66 documents:
67 - _id: 3
68 - _id: 4
69 command_name: insert
70 database_name: *database_name
71 - command_started_event:
72 command:
73 insert: *collection_name
74 documents:
75 - _id: 5
76 - _id: 6
77 command_name: insert
78 database_name: *database_name
79
80 outcome:
81 collection:
82 data:
83 - {_id: 1}
84 - {_id: 2}
85 - {_id: 5}
86 - {_id: 6}
View as plain text