1{
2 "description": "server-selection-logging",
3 "schemaVersion": "1.14",
4 "runOnRequirements": [
5 {
6 "topologies": [
7 "sharded"
8 ]
9 }
10 ],
11 "createEntities": [
12 {
13 "client": {
14 "id": "client",
15 "uriOptions": {
16 "retryWrites": false,
17 "heartbeatFrequencyMS": 500,
18 "appName": "loggingClient",
19 "serverSelectionTimeoutMS": 2000
20 },
21 "observeLogMessages": {
22 "serverSelection": "debug"
23 },
24 "observeEvents": [
25 "serverDescriptionChangedEvent",
26 "topologyDescriptionChangedEvent"
27 ],
28 "useMultipleMongoses": false
29 }
30 },
31 {
32 "database": {
33 "id": "database",
34 "client": "client",
35 "databaseName": "logging-tests"
36 }
37 },
38 {
39 "collection": {
40 "id": "collection",
41 "database": "database",
42 "collectionName": "server-selection"
43 }
44 },
45 {
46 "client": {
47 "id": "failPointClient",
48 "useMultipleMongoses": false
49 }
50 }
51 ],
52 "tests": [
53 {
54 "description": "A successful operation",
55 "operations": [
56 {
57 "name": "waitForEvent",
58 "object": "testRunner",
59 "arguments": {
60 "client": "client",
61 "event": {
62 "topologyDescriptionChangedEvent": {}
63 },
64 "count": 2
65 }
66 },
67 {
68 "name": "insertOne",
69 "object": "collection",
70 "arguments": {
71 "document": {
72 "x": 1
73 }
74 }
75 }
76 ],
77 "expectLogMessages": [
78 {
79 "client": "client",
80 "messages": [
81 {
82 "level": "debug",
83 "component": "serverSelection",
84 "data": {
85 "message": "Server selection started",
86 "selector": {
87 "$$exists": true
88 },
89 "operation": "insert",
90 "topologyDescription": {
91 "$$exists": true
92 }
93 }
94 },
95 {
96 "level": "debug",
97 "component": "serverSelection",
98 "data": {
99 "message": "Server selection succeeded",
100 "selector": {
101 "$$exists": true
102 },
103 "operation": "insert",
104 "topologyDescription": {
105 "$$exists": true
106 },
107 "serverHost": {
108 "$$type": "string"
109 },
110 "serverPort": {
111 "$$type": [
112 "int",
113 "long"
114 ]
115 }
116 }
117 }
118 ]
119 }
120 ]
121 },
122 {
123 "description": "Failure due to unreachable server",
124 "runOnRequirements": [
125 {
126 "minServerVersion": "4.4"
127 }
128 ],
129 "operations": [
130 {
131 "name": "failPoint",
132 "object": "testRunner",
133 "arguments": {
134 "client": "failPointClient",
135 "failPoint": {
136 "configureFailPoint": "failCommand",
137 "mode": "alwaysOn",
138 "data": {
139 "failCommands": [
140 "hello",
141 "ismaster"
142 ],
143 "appName": "loggingClient",
144 "closeConnection": true
145 }
146 }
147 }
148 },
149 {
150 "name": "waitForEvent",
151 "object": "testRunner",
152 "arguments": {
153 "client": "client",
154 "event": {
155 "serverDescriptionChangedEvent": {
156 "newDescription": {
157 "type": "Unknown"
158 }
159 }
160 },
161 "count": 1
162 }
163 },
164 {
165 "name": "insertOne",
166 "object": "collection",
167 "arguments": {
168 "document": {
169 "x": 1
170 }
171 },
172 "expectError": {
173 "isClientError": true
174 }
175 }
176 ],
177 "expectLogMessages": [
178 {
179 "client": "client",
180 "messages": [
181 {
182 "level": "debug",
183 "component": "serverSelection",
184 "data": {
185 "message": "Server selection started",
186 "selector": {
187 "$$exists": true
188 },
189 "operation": "insert",
190 "topologyDescription": {
191 "$$exists": true
192 }
193 }
194 },
195 {
196 "level": "info",
197 "component": "serverSelection",
198 "data": {
199 "message": "Waiting for suitable server to become available",
200 "selector": {
201 "$$exists": true
202 },
203 "operation": "insert",
204 "topologyDescription": {
205 "$$exists": true
206 },
207 "remainingTimeMS": {
208 "$$type": [
209 "int",
210 "long"
211 ]
212 }
213 }
214 },
215 {
216 "level": "debug",
217 "component": "serverSelection",
218 "data": {
219 "message": "Server selection failed",
220 "selector": {
221 "$$exists": true
222 },
223 "operation": "insert",
224 "topologyDescription": {
225 "$$exists": true
226 },
227 "failure": {
228 "$$exists": true
229 }
230 }
231 }
232 ]
233 }
234 ]
235 }
236 ]
237}
View as plain text