@@ -188,196 +188,9 @@ Continue until all phases have been executed.
188
188
Integration Tests
189
189
-----------------
190
190
191
- Integration tests are provided in the "integration" directory.
192
-
193
- Test Format
194
- ~~~~~~~~~~~
195
-
196
- The same as the `Transactions Spec Test format
197
- </source/transactions/tests/README.rst#test-format> `_ with the following
198
- additions:
199
-
200
- - The ``runOn `` requirement gains a new field:
201
-
202
- - ``authEnabled `` (optional): If True, skip this test if auth is not enabled.
203
- If False, skip this test if auth is enabled. If this field is omitted,
204
- this test can be run on clusters with or without auth.
205
-
206
- Special Test Operations
207
- ~~~~~~~~~~~~~~~~~~~~~~~
208
-
209
- Certain operations that appear in the "operations" array do not correspond to
210
- API methods but instead represent special test operations. Such operations are
211
- defined on the "testRunner" object and are documented in the
212
- `Transactions Spec Test
213
- </source/transactions/tests/README.rst#special-test-operations> `_.
214
-
215
- Additional, SDAM test specific operations are documented here:
216
-
217
- configureFailPoint
218
- ''''''''''''''''''
219
-
220
- The "configureFailPoint" operation instructs the test runner to configure
221
- the given server failpoint on the "admin" database. The runner MUST disable
222
- this failpoint at the end of the test. For example::
223
-
224
- - name: configureFailPoint
225
- object: testRunner
226
- arguments:
227
- failPoint:
228
- configureFailPoint: failCommand
229
- mode: { times: 1 }
230
- data:
231
- failCommands: ["insert"]
232
- closeConnection: true
233
-
234
- Tests that use the "configureFailPoint" operation do not include
235
- ``configureFailPoint `` commands in their command expectations. Drivers MUST
236
- ensure that ``configureFailPoint `` commands do not appear in the list of logged
237
- commands, either by manually filtering it from the list of observed commands or
238
- by using a different MongoClient to execute ``configureFailPoint ``.
239
-
240
- Note, similar to the ``tests.failPoint `` field described in the `Transactions
241
- Spec Test format </source/transactions/tests/README.rst#test-format> `_ tests
242
- with ``useMultipleMongoses: true `` will not contain a ``configureFailPoint ``
243
- operation.
244
-
245
- wait
246
- ''''
247
-
248
- The "wait" operation instructs the test runner to sleep for "ms"
249
- milliseconds. For example::
250
-
251
- - name: wait
252
- object: testRunner
253
- arguments:
254
- ms: 1000
255
-
256
- waitForEvent
257
- ''''''''''''
258
-
259
- The "waitForEvent" operation instructs the test runner to wait until the test's
260
- MongoClient has published a specific event a given number of times. For
261
- example, the following instructs the test runner to wait for at least one
262
- PoolClearedEvent to be published::
263
-
264
- - name: waitForEvent
265
- object: testRunner
266
- arguments:
267
- event: PoolClearedEvent
268
- count: 1
269
-
270
- Note that "count" includes events that were published while running previous
271
- operations.
272
-
273
- If the "waitForEvent" operation is not satisfied after 10 seconds, the
274
- operation is considered an error.
275
-
276
- ServerMarkedUnknownEvent
277
- ````````````````````````
278
-
279
- The ServerMarkedUnknownEvent may appear as an event in `waitForEvent `_ and
280
- `assertEventCount `_. This event is defined as ServerDescriptionChangedEvent
281
- where newDescription.type is ``Unknown ``.
282
-
283
- assertEventCount
284
- ''''''''''''''''
285
-
286
- The "assertEventCount" operation instructs the test runner to assert the test's
287
- MongoClient has published a specific event a given number of times. For
288
- example, the following instructs the test runner to assert that a single
289
- PoolClearedEvent was published::
290
-
291
- - name: assertEventCount
292
- object: testRunner
293
- arguments:
294
- event: PoolClearedEvent
295
- count: 1
296
-
297
- recordPrimary
298
- '''''''''''''
299
-
300
- The "recordPrimary" operation instructs the test runner to record the current
301
- primary of the test's MongoClient. For example::
302
-
303
- - name: recordPrimary
304
- object: testRunner
305
-
306
- runAdminCommand
307
- '''''''''''''''
308
-
309
- The "runAdminCommand" operation instructs the test runner to run the given
310
- command on the admin database. Drivers MUST run this command on a different
311
- MongoClient from the one used for test operations. For example::
312
-
313
- - name: runAdminCommand
314
- object: testRunner
315
- command_name: replSetFreeze
316
- arguments:
317
- command:
318
- replSetFreeze: 0
319
- readPreference:
320
- mode: Secondary
321
-
322
- waitForPrimaryChange
323
- ''''''''''''''''''''
324
-
325
- The "waitForPrimaryChange" operation instructs the test runner to wait up to
326
- "timeoutMS" milliseconds for the MongoClient to discover a new primary server.
327
- The new primary should be different from the one recorded by "recordPrimary".
328
- For example::
329
-
330
- - name: waitForPrimaryChange
331
- object: testRunner
332
- arguments:
333
- timeoutMS: 15000
334
-
335
- To implement, Drivers can subscribe to ServerDescriptionChangedEvents and wait
336
- for an event where newDescription.type is ``RSPrimary `` and the address is
337
- different from the one previously recorded by "recordPrimary".
338
-
339
- startThread
340
- '''''''''''
341
-
342
- The "startThread" operation instructs the test runner to start a new thread
343
- with the provided "name". The `runOnThread `_ and `waitForThread `_ operations
344
- reference a thread by its "name". For example::
345
-
346
- - name: startThread
347
- object: testRunner
348
- arguments:
349
- name: thread1
350
-
351
- runOnThread
352
- '''''''''''
353
-
354
- The "runOnThread" operation instructs the test runner to schedule an operation
355
- to be run on the given thread. runOnThread MUST NOT wait for the scheduled
356
- operation to complete. For example::
357
-
358
- - name: runOnThread
359
- object: testRunner
360
- arguments:
361
- name: thread1
362
- operation:
363
- name: insertOne
364
- object: collection
365
- arguments:
366
- document:
367
- _id: 2
368
- error: true
369
-
370
- waitForThread
371
- '''''''''''''
372
-
373
- The "waitForThread" operation instructs the test runner to stop the given
374
- thread, wait for it to complete, and assert that the thread exited without
375
- any errors. For example::
376
-
377
- - name: waitForThread
378
- object: testRunner
379
- arguments:
380
- name: thread1
191
+ Integration tests are provided in the "unified" directory and are
192
+ written in the `Unified Test Format
193
+ <../unified-test-format/unified-test-format.rst> `_.
381
194
382
195
Prose Tests
383
196
-----------
0 commit comments