...
1#hello Test SDAM error handling.
2runOn:
3 # failCommand appName requirements
4 - minServerVersion: "4.9"
5
6database_name: &database_name "sdam-tests"
7collection_name: &collection_name "hello-network-error"
8
9data: []
10
11tests:
12 - description: Network error on Monitor handshake
13 # Configure the initial handshake to fail with a network error.
14 # Use times: 2 so that the RTT hello fails as well.
15 failPoint:
16 configureFailPoint: failCommand
17 mode: { times: 2 }
18 data:
19 failCommands: ["hello", "isMaster"]
20 appName: networkErrorHandshakeTest
21 closeConnection: true
22 clientOptions:
23 retryWrites: false
24 connectTimeoutMS: 250
25 heartbeatFrequencyMS: 500
26 appname: networkErrorHandshakeTest
27 operations:
28 # The network error on the initial handshake should mark the server
29 # Unknown (emitting a ServerDescriptionChangedEvent) and clear the pool.
30 - name: waitForEvent
31 object: testRunner
32 arguments:
33 event: ServerMarkedUnknownEvent
34 count: 1
35 # Perform an operation to ensure the node is discovered.
36 - name: insertMany
37 object: collection
38 arguments:
39 documents:
40 - _id: 1
41 - _id: 2
42 # We cannot assert the server was marked Unknown and pool was cleared an
43 # exact number of times because the RTT hello may or may not have
44 # triggered this failpoint as well.
45
46 expectations:
47 - command_started_event:
48 command:
49 insert: *collection_name
50 documents:
51 - _id: 1
52 - _id: 2
53 command_name: insert
54 database_name: *database_name
55
56 outcome:
57 collection:
58 data:
59 - {_id: 1}
60 - {_id: 2}
61
62 - description: Network error on Monitor check
63 clientOptions:
64 retryWrites: false
65 connectTimeoutMS: 250
66 heartbeatFrequencyMS: 500
67 appname: networkErrorCheckTest
68 operations:
69 # Perform an operation to ensure the node is discovered.
70 - name: insertMany
71 object: collection
72 arguments:
73 documents:
74 - _id: 1
75 - _id: 2
76 # Configure the next streaming hello check to fail with a non-timeout
77 # network error. Use "times: 4" to increase the probability that the
78 # Monitor check fails since the RTT hello may trigger this failpoint one
79 # or many times as well.
80 - name: configureFailPoint
81 object: testRunner
82 arguments:
83 failPoint:
84 configureFailPoint: failCommand
85 mode: { times: 4 }
86 data:
87 failCommands: ["hello", "isMaster"]
88 appName: networkErrorCheckTest
89 closeConnection: true
90 # The network error on the next check should mark the server Unknown and
91 # clear the pool.
92 - name: waitForEvent
93 object: testRunner
94 arguments:
95 event: ServerMarkedUnknownEvent
96 count: 1
97 - name: waitForEvent
98 object: testRunner
99 arguments:
100 event: PoolClearedEvent
101 count: 1
102 # Perform an operation to ensure the node is rediscovered.
103 - name: insertMany
104 object: collection
105 arguments:
106 documents:
107 - _id: 3
108 - _id: 4
109 # We cannot assert the server was marked Unknown and pool was cleared an
110 # exact number of times because the RTT hello may have triggered this
111 # failpoint one or many times as well.
112 # - name: assertEventCount
113 # object: testRunner
114 # arguments:
115 # event: ServerMarkedUnknownEvent
116 # count: 1
117 # - name: assertEventCount
118 # object: testRunner
119 # arguments:
120 # event: PoolClearedEvent
121 # count: 1
122
123 expectations:
124 - command_started_event:
125 command:
126 insert: *collection_name
127 documents:
128 - _id: 1
129 - _id: 2
130 command_name: insert
131 database_name: *database_name
132 - command_started_event:
133 command:
134 insert: *collection_name
135 documents:
136 - _id: 3
137 - _id: 4
138 command_name: insert
139 database_name: *database_name
140
141 outcome:
142 collection:
143 data:
144 - {_id: 1}
145 - {_id: 2}
146 - {_id: 3}
147 - {_id: 4}
View as plain text