Skip to content

Commit 68bf3b3

Browse files
authored
DRIVERS-1130 Convert crud-v2 tests to the unified format (#962)
* Convert crud-v2 tests to the unified format * Remove test with invalid readConcern This test will cause all tests in the file for drivers that don't allow creating read concerns with invalid modes.
1 parent 3586db8 commit 68bf3b3

File tree

198 files changed

+14697
-9785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+14697
-9785
lines changed

source/crud/tests/README.rst

Lines changed: 6 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -19,118 +19,19 @@ version requirements as noted by the ``runOn`` section, if provided.
1919
Subdirectories for Test Formats
2020
-------------------------------
2121

22-
This document describes two legacy formats for CRUD tests: legacy-v1, which dates back
23-
to the first version of the CRUD specification, and legacy-v2, which was an update to
24-
the initial format. New CRUD tests should be written in the `unified test format <../../../../unified-test-format/unified-test-format.rst>`_
22+
This document describes a legacy format for CRUD tests: legacy-v1, which dates back
23+
to the first version of the CRUD specification. New CRUD tests should be written
24+
in the `unified test format <../../../../unified-test-format/unified-test-format.rst>`_
2525
and placed under ``unified/``. Until such time that all original tests have been ported
2626
to the unified test format, tests in each format will be grouped in their own subdirectory:
2727

2828
- ``v1/``: Legacy-v1 format tests
29-
- ``v2/``: Legacy-v2 format tests
3029
- ``unified/``: Tests using the `unified test format <../../../../unified-test-format/unified-test-format.rst>`_
3130

3231
Since some drivers may not have a unified test runner capable of executing tests
33-
in all three formats, segregating tests in this manner will make it easier for
32+
in all two formats, segregating tests in this manner will make it easier for
3433
drivers to sync and feed test files to different test runners.
3534

36-
Legacy-v2 Test Format
37-
=====================
38-
39-
*Note: this section pertains to test files in the "v2" directory.*
40-
41-
Each YAML file has the following keys:
42-
43-
- ``runOn`` (optional): An array of server version and/or topology requirements
44-
for which the tests can be run. If the test environment satisfies one or more
45-
of these requirements, the tests may be executed; otherwise, this file should
46-
be skipped. If this field is omitted, the tests can be assumed to have no
47-
particular requirements and should be executed. Each element will have some or
48-
all of the following fields:
49-
50-
- ``minServerVersion`` (optional): The minimum server version (inclusive)
51-
required to successfully run the tests. If this field is omitted, it should
52-
be assumed that there is no lower bound on the required server version.
53-
54-
- ``maxServerVersion`` (optional): The maximum server version (inclusive)
55-
against which the tests can be run successfully. If this field is omitted,
56-
it should be assumed that there is no upper bound on the required server
57-
version.
58-
59-
- ``topology`` (optional): An array of server topologies against which the
60-
tests can be run successfully. Valid topologies are "single", "replicaset",
61-
and "sharded". If this field is omitted, the default is all topologies (i.e.
62-
``["single", "replicaset", "sharded"]``).
63-
64-
- ``collection_name`` (optional): The collection to use for testing.
65-
66-
- ``database_name`` (optional): The database to use for testing.
67-
68-
- ``data`` (optional): The data that should exist in the collection under test before each
69-
test run.
70-
71-
- ``tests``: An array of tests that are to be run independently of each other.
72-
Each test will have some or all of the following fields:
73-
74-
- ``description``: The name of the test.
75-
76-
- ``skipReason`` (optional): If present, the test should be skipped and the
77-
string value will specify a reason.
78-
79-
- ``failPoint`` (optional): The ``configureFailPoint`` command document to run
80-
to configure a fail point on the primary server.
81-
82-
- ``clientOptions`` (optional): Names and values of options used to construct
83-
the MongoClient for this test.
84-
85-
- ``operations``: Array of documents, each describing an operation to be
86-
executed. Each document has the following fields:
87-
88-
- ``object`` (optional): The name of the object to perform the operation on. Can be
89-
"database" or "collection". Defaults to "collection" if undefined.
90-
91-
- ``collectionOptions`` (optional): Names and values of options used to
92-
construct the collection object for this test.
93-
94-
- ``name``: The name of the operation as defined in the specification.
95-
96-
- ``arguments``: The names and values of arguments from the specification.
97-
98-
- ``error`` (optional): If ``true``, the test should expect the operation
99-
to emit an error or exception. If ``false`` or omitted, drivers MUST
100-
assert that no error occurred.
101-
102-
- ``result`` (optional): The result of executing the operation. This will
103-
correspond to operation's return value as defined in the specification.
104-
This field may be omitted if ``error`` is ``true``. If this field is
105-
present and ``error`` is ``true`` (generally for multi-statement tests),
106-
the result reports information about statements that succeeded before an
107-
unrecoverable failure. In that case, drivers may choose to check the
108-
result object if their BulkWriteException (or equivalent) provides access
109-
to a write result object.
110-
111-
- ``expectations`` (optional): Array of documents, each describing a
112-
`CommandStartedEvent <../../command-monitoring/command-monitoring.rst#api>`_
113-
from the
114-
`Command Monitoring <../../command-monitoring/command-monitoring.rst>`_
115-
specification. If present, drivers should use command monitoring to observe
116-
events emitted during execution of the test operation(s) and assert that
117-
they match the expected CommandStartedEvent(s). Each document will have the
118-
following field:
119-
120-
- ``command_started_event``: Document corresponding to an expected
121-
`CommandStartedEvent <../../command-monitoring/command-monitoring.rst#api>`_.
122-
123-
- ``outcome`` (optional): Document describing the expected state of the
124-
collection after the operation is executed. Contains the following fields:
125-
126-
- ``collection``:
127-
128-
- ``name`` (optional): The name of the collection to verify. If this isn't
129-
present then use the collection under test.
130-
131-
- ``data``: The data that should exist in the collection after the
132-
operation has been run, sorted by "_id".
133-
13435
Legacy-v1 Test Format for Single Operations
13536
-------------------------------------------
13637

@@ -173,8 +74,8 @@ messages into the bulk write exception's top-level message.
17374
Test Runner Implementation
17475
==========================
17576

176-
This section provides guidance for implementing a test runner for legacy-v1 and
177-
legacy-v2 tests. See the `unified test format spec <../../../../unified-test-format/unified-test-format.rst>`_ for how to run tests under
77+
This section provides guidance for implementing a test runner for legacy-v1
78+
tests. See the `unified test format spec <../../../../unified-test-format/unified-test-format.rst>`_ for how to run tests under
17879
``unified/``.
17980

18081
Before running the tests:

0 commit comments

Comments
 (0)