...
1# Test SDAM error handling.
2runOn:
3 # failCommand appName requirements
4 - minServerVersion: "4.9"
5
6database_name: &database_name "sdam-tests"
7collection_name: &collection_name "sdam-minPoolSize-error"
8
9data: []
10
11tests:
12 - description: Network error on minPoolSize background creation
13 # Configure the initial monitor handshake to succeed but the
14 # first or second background minPoolSize establishments to fail.
15 failPoint:
16 configureFailPoint: failCommand
17 mode: { skip: 3 }
18 data:
19 failCommands: ["hello", "isMaster"]
20 appName: SDAMminPoolSizeError
21 closeConnection: true
22 clientOptions:
23 heartbeatFrequencyMS: 10000
24 appname: SDAMminPoolSizeError
25 minPoolSize: 10
26 serverSelectionTimeoutMS: 1000
27 directConnection: true
28 operations:
29 # Wait for monitor to succeed handshake and mark the pool as ready.
30 - name: waitForEvent
31 object: testRunner
32 arguments:
33 event: PoolReadyEvent
34 count: 1
35 # Background connection establishment ensuring minPoolSize should fail,
36 # causing the pool to be cleared.
37 - name: waitForEvent
38 object: testRunner
39 arguments:
40 event: PoolClearedEvent
41 count: 1
42 # The server should be marked as Unknown as part of this.
43 - name: waitForEvent
44 object: testRunner
45 arguments:
46 event: ServerMarkedUnknownEvent
47 count: 1
48 # Executing a command should fail server selection due to not being able
49 # to find the primary.
50 - name: runCommand
51 object: database
52 command_name: ping
53 arguments:
54 command:
55 ping: {}
56 error: true
57 # Disable the failpoint, allowing the monitor to discover the primary again.
58 - name: configureFailPoint
59 object: testRunner
60 arguments:
61 failPoint:
62 configureFailPoint: failCommand
63 mode: off
64 # Perform an operation to ensure the node is discovered.
65 - name: runCommand
66 object: database
67 command_name: ping
68 arguments:
69 command:
70 ping: 1
71 error: false
72 # Assert that the monitor discovered the primary and mark the pool as ready again.
73 - name: assertEventCount
74 object: testRunner
75 arguments:
76 event: PoolReadyEvent
77 count: 2
View as plain text