@@ -9,163 +9,14 @@ Convenient API for Transactions Tests
99Introduction
1010============
1111
12- The YAML and JSON files in this directory are platform-independent tests that
13- drivers can use to prove their conformance to the Convenient API for
14- Transactions spec. They are designed with the intention of sharing some
15- test-runner code with the CRUD, Command Monitoring, and Transaction spec tests .
12+ The YAML and JSON files in this directory are platform-independent tests
13+ meant to exercise a driver's implementation of the Convenient API for
14+ Transactions spec. These tests utilize the
15+ ` Unified Test Format < ../../unified-test-format/unified-test-format.rst >`__ .
1616
1717Several prose tests, which are not easily expressed in YAML, are also presented
1818in this file. Those tests will need to be manually implemented by each driver.
1919
20- Server Fail Point
21- =================
22-
23- See: `Server Fail Point <../../transactions/tests#server-fail-point >`_ in the
24- Transactions spec test suite.
25-
26- Test Format
27- ===========
28-
29- Each YAML file has the following keys:
30-
31- - ``runOn `` (optional): An array of server version and/or topology requirements
32- for which the tests can be run. If the test environment satisfies one or more
33- of these requirements, the tests may be executed; otherwise, this file should
34- be skipped. If this field is omitted, the tests can be assumed to have no
35- particular requirements and should be executed. Each element will have some or
36- all of the following fields:
37-
38- - ``minServerVersion `` (optional): The minimum server version (inclusive)
39- required to successfully run the tests. If this field is omitted, it should
40- be assumed that there is no lower bound on the required server version.
41-
42- - ``maxServerVersion `` (optional): The maximum server version (inclusive)
43- against which the tests can be run successfully. If this field is omitted,
44- it should be assumed that there is no upper bound on the required server
45- version.
46-
47- - ``topology `` (optional): An array of server topologies against which the
48- tests can be run successfully. Valid topologies are "single", "replicaset",
49- and "sharded". If this field is omitted, the default is all topologies (i.e.
50- ``["single", "replicaset", "sharded"] ``).
51-
52- - ``database_name `` and ``collection_name ``: The database and collection to use
53- for testing.
54-
55- - ``data ``: The data that should exist in the collection under test before each
56- test run.
57-
58- - ``tests ``: An array of tests that are to be run independently of each other.
59- Each test will have some or all of the following fields:
60-
61- - ``description ``: The name of the test.
62-
63- - ``skipReason `` (optional): If present, the test should be skipped and the
64- string value will specify a reason.
65-
66- - ``failPoint `` (optional): The ``configureFailPoint `` command document to run
67- to configure a fail point on the primary server. This option and
68- ``useMultipleMongoses: true `` are mutually exclusive.
69-
70- - ``useMultipleMongoses `` (optional): If ``true ``, the MongoClient for this
71- test should be initialized with multiple mongos seed addresses. If ``false ``
72- or omitted, only a single mongos address should be specified. This field has
73- no effect for non-sharded topologies.
74-
75- - ``clientOptions `` (optional): Names and values of options to pass to
76- ``MongoClient() ``.
77-
78- - ``sessionOptions `` (optional): Names and values of options to pass to
79- ``MongoClient.startSession() ``.
80-
81- - ``operations ``: Array of documents, each describing an operation to be
82- executed. Each document has the following fields:
83-
84- - ``name ``: The name of the operation on ``object ``.
85-
86- - ``object ``: The name of the object on which to perform the operation. The
87- value will be either "collection" or "session0".
88-
89- - ``arguments `` (optional): Names and values of arguments to pass to the
90- operation.
91-
92- - ``result `` (optional): The return value from the operation. This will
93- correspond to an operation's result object as defined in the CRUD
94- specification. If the operation is expected to return an error, the
95- ``result `` is a single document that has one or more of the following
96- fields:
97-
98- - ``errorContains ``: A substring of the expected error message.
99-
100- - ``errorCodeName ``: The expected "codeName" field in the server
101- error response.
102-
103- - ``errorLabelsContain ``: A list of error label strings that the
104- error is expected to have.
105-
106- - ``errorLabelsOmit ``: A list of error label strings that the
107- error is expected not to have.
108-
109- - ``expectations `` (optional): List of command-started events.
110-
111- - ``outcome ``: Document describing the return value and/or expected state of
112- the collection after the operation is executed. Contains the following
113- fields:
114-
115- - ``collection ``:
116-
117- - ``data ``: The data that should exist in the collection after the
118- operations have run.
119-
120- ``withTransaction `` Operation
121- `````````````````````````````
122-
123- These tests introduce a ``withTransaction `` operation, which may have the
124- following fields:
125-
126- - ``callback ``: Document containing the following field:
127-
128- - ``operations ``: Array of documents, each describing an operation to be
129- executed. Elements in this array will follow the same structure as the
130- ``operations `` field defined above (and in the CRUD and Transactions specs).
131-
132- Note that drivers are expected to evaluate ``error `` and ``result ``
133- assertions when executing operations within ``callback.operations ``.
134-
135- - ``options `` (optional): Names and values of options to pass to
136- ``withTransaction() ``, which will in turn be used for ``startTransaction() ``.
137-
138- Use as Integration Tests
139- ========================
140-
141- Testing against a replica set will require server version 4.0.0 or later. The
142- replica set should include a primary, a secondary, and an arbiter. Including a
143- secondary ensures that server selection in a transaction works properly.
144- Including an arbiter helps ensure that no new bugs have been introduced related
145- to arbiters.
146-
147- Testing against a sharded cluster will require server version 4.1.6 or later.
148- A driver that implements support for sharded transactions MUST also run these
149- tests against a MongoDB sharded cluster with multiple mongoses. Including
150- multiple mongoses (and initializing the MongoClient with multiple mongos seeds!)
151- ensures that mongos transaction pinning works properly.
152-
153- See: `Use as Integration Tests <../../transactions/tests#use-as-integration-tests >`_
154- in the Transactions spec test suite for instructions on executing each test.
155-
156- Take note of the following:
157-
158- - Most tests will consist of a single "withTransaction" operation to be invoked
159- on the "session0" object. The ``callback `` argument of that operation will
160- resemble the ``operations `` array found in transaction spec tests.
161-
162- Command-Started Events
163- ``````````````````````
164-
165- See: `Command-Started Events <../../transactions/tests#command-started-events >`_
166- in the Transactions spec test suite for instructions on asserting
167- command-started events.
168-
16920Prose Tests
17021===========
17122
@@ -212,11 +63,6 @@ should be checked:
21263Changelog
21364=========
21465
215- :2021-04-29: Remove text about write concern timeouts from prose test.
216-
217- :2019-03-01: Add top-level ``runOn `` field to denote server version and/or
218- topology requirements requirements for the test file. Removes the
219- ``minServerVersion `` top-level field, which is now expressed within
220- ``runOn `` elements.
66+ :2024-02-08: Converted legacy tests to unified format.
22167
222- Add test-level `` useMultipleMongoses `` field .
68+ :2021-04-29: Remove text about write concern timeouts from prose test.
0 commit comments