You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- ``outcome`` (optional): Document describing the expected state of the
123
-
collection after the operation is executed. Contains the following fields:
124
-
125
-
- ``collection``:
126
-
127
-
- ``name`` (optional): The name of the collection to verify. If this isn't
128
-
present then use the collection under test.
129
-
130
-
- ``data``: The data that should exist in the collection after the
131
-
operation has been run, sorted by "_id".
132
-
133
-
Legacy Test Format for Single Operations
134
-
----------------------------------------
35
+
Legacy-v1 Test Format for Single Operations
36
+
-------------------------------------------
135
37
136
38
*Note: this section pertains to test files in the "v1" directory.*
137
39
138
40
The test format above supports both multiple operations and APM expectations,
139
41
and is consistent with the formats used by other specifications. Previously, the
140
42
CRUD spec tests used a simplified format that only allowed for executing a
141
-
single operation. Notable differences from the current format are as follows:
43
+
single operation. Notable differences from the legacy-v2 format are as follows:
142
44
143
45
- Instead of a ``tests[i].operations`` array, a single operation was defined as
144
46
a document in ``tests[i].operation``. That document consisted of only the
@@ -150,15 +52,17 @@ single operation. Notable differences from the current format are as follows:
150
52
fields.
151
53
152
54
- Instead of a top-level ``runOn`` field, server requirements are denoted by
153
-
separate top-level ``minServerVersion`` and ``maxServerVersion`` fields. The
154
-
minimum server version is an inclusive lower bound for running the test. The
155
-
maximum server version is an exclusive upper bound for running the test. If a
156
-
field is not present, it should be assumed that there is no corresponding bound
157
-
on the required server version.
158
-
159
-
The legacy format should not conflict with the newer, multi-operation format
55
+
separate top-level ``minServerVersion``, ``maxServerVersion``, and
56
+
``serverless`` fields. The minimum server version is an inclusive lower bound
57
+
for running the test. The maximum server version is an exclusive upper bound
58
+
for running the test. If a field is not present, it should be assumed that
59
+
there is no corresponding bound on the required server version. The
60
+
``serverless`` requirement behaves the same as the ``serverless`` field of the
61
+
`unified test format's runOnRequirement <../../unified-test-format/unified-test-format.rst#runonrequirement>`_.
62
+
63
+
The legacy-v1 format should not conflict with the newer, multi-operation format
160
64
used by other specs (e.g. Transactions). It is possible to create a unified test
161
-
runner capable of executing both formats (as some drivers do).
65
+
runner capable of executing both legacy formats (as some drivers do).
162
66
163
67
Error Assertions for Bulk Write Operations
164
68
==========================================
@@ -172,7 +76,9 @@ messages into the bulk write exception's top-level message.
172
76
Test Runner Implementation
173
77
==========================
174
78
175
-
This section provides guidance for implementing a test runner.
79
+
This section provides guidance for implementing a test runner for legacy-v1
80
+
tests. See the `unified test format spec <../../../../unified-test-format/unified-test-format.rst>`_ for how to run tests under
81
+
``unified/``.
176
82
177
83
Before running the tests:
178
84
@@ -216,8 +122,8 @@ For each test file:
216
122
217
123
- Activate command monitoring for ``localMongoClient`` and begin capturing
218
124
events. Note that some events may need to be filtered out if the driver
219
-
uses global listeners or reports internal commands (e.g. ``isMaster``,
220
-
authentication).
125
+
uses global listeners or reports internal commands (e.g. ``hello``, legacy
126
+
hello, authentication).
221
127
222
128
- For each element in the ``operations`` array:
223
129
@@ -310,9 +216,13 @@ Prose Tests
310
216
311
217
The following tests have not yet been automated, but MUST still be tested.
312
218
313
-
"errInfo" is propagated
314
-
-----------------------
315
-
Test that a writeConcernError "errInfo" is propagated to the user in whatever way is idiomatic to the driver (exception, error object, etc.). Using a 4.0+ server, set the following failpoint:
Test that ``writeConcernError.errInfo`` in a command response is propagated as
223
+
``WriteConcernError.details`` (or equivalent) in the driver.
224
+
225
+
Using a 4.0+ server, set the following failpoint:
316
226
317
227
.. code:: javascript
318
228
@@ -335,4 +245,34 @@ Test that a writeConcernError "errInfo" is propagated to the user in whatever wa
335
245
},
336
246
"mode": { "times":1 }
337
247
}
338
-
Then, perform an insert on the same database. Assert that an error occurs and that the "errInfo" is accessible and matches the one set in the failpoint.
248
+
249
+
Then, perform an insert operation and assert that a WriteConcernError occurs and
250
+
that its ``details`` property is both accessible and matches the ``errInfo``
0 commit comments