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
Copy file name to clipboardExpand all lines: test/spec/change-stream/README.rst
+17-3
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,15 @@ drivers can use to prove their conformance to the Change Streams Spec.
18
18
Several prose tests, which are not easily expressed in YAML, are also presented
19
19
in this file. Those tests will need to be manually implemented by each driver.
20
20
21
+
Subdirectories for Test Formats
22
+
-------------------------------
23
+
24
+
This document describes the legacy format for change streams tests.
25
+
Tests in this legacy format are located under ``./legacy/``.
26
+
27
+
New change streams tests should be written in the `unified test format <../../unified-test-format/unified-test-format.rst>`__
28
+
and placed under ``./unified/``.
29
+
21
30
Spec Test Format
22
31
================
23
32
@@ -33,14 +42,14 @@ Each YAML file has the following keys:
33
42
- ``description``: The name of the test.
34
43
- ``minServerVersion``: The minimum server version to run this test against. If not present, assume there is no minimum server version.
35
44
- ``maxServerVersion``: Reserved for later use
36
-
- ``failPoint``(optional): The configureFailPoint command document to run to configure a fail point on the primary server.
45
+
- ``failPoint``: Optional configureFailPoint command document to run to configure a fail point on the primary server.
37
46
- ``target``: The entity on which to run the change stream. Valid values are:
38
47
39
48
- ``collection``: Watch changes on collection ``database_name.collection_name``
40
49
- ``database``: Watch changes on database ``database_name``
41
50
- ``client``: Watch changes on entire clusters
42
51
- ``topology``: An array of server topologies against which to run the test.
43
-
Valid topologies are ``single``, ``replicaset``, and ``sharded``.
52
+
Valid topologies are ``single``, ``replicaset``, ``sharded``, and "load-balanced".
44
53
- ``changeStreamPipeline``: An array of additional aggregation pipeline stages to add to the change stream
45
54
- ``changeStreamOptions``: Additional options to add to the changeStream
46
55
- ``operations``: Array of documents, each describing an operation. Each document has the following fields:
@@ -133,6 +142,11 @@ For each YAML file, for each element in ``tests``:
133
142
- For each (``expected``, ``idx``) in ``expectations``
134
143
- If ``actual[idx]`` is a ``killCursors`` event, skip it and move to ``actual[idx+1]``.
135
144
- Else assert that ``actual[idx]`` MATCHES ``expected``
145
+
- Note: the change stream test command event expectations cover a
146
+
prefix subset of all command events published by the driver.
147
+
The test runner MUST verify that, if there are N expectations, that the
148
+
first N events published by the driver match the expectations, and
149
+
MUST NOT inspect any subsequent events published by the driver.
136
150
137
151
- Close the MongoClient ``client``
138
152
@@ -171,7 +185,7 @@ The following tests have not yet been automated, but MUST still be tested. All t
171
185
#. ``ChangeStream`` must continuously track the last seen ``resumeToken``
172
186
#. ``ChangeStream`` will throw an exception if the server response is missing the resume token (if wire version is < 8, this is a driver-side error; for 8+, this is a server-side error)
173
187
#. After receiving a ``resumeToken``, ``ChangeStream`` will automatically resume one time on a resumable error with the initial pipeline and options, except for the addition/update of a ``resumeToken``.
174
-
#. ``ChangeStream`` will not attempt to resume on any error encountered while executing an ``aggregate`` command. Note that retryable reads may retry ``aggregate`` commands. Drivers should be careful to distinguish retries from resume attempts. Alternatively, drivers may specify `retryReads=false` or avoid using a [retryable error](../../retryable-reads/retryable-reads.rst#retryable-error) for this test.
188
+
#. ``ChangeStream`` will not attempt to resume on any error encountered while executing an ``aggregate`` command. Note that retryable reads may retry ``aggregate`` commands. Drivers should be careful to distinguish retries from resume attempts. Alternatively, drivers may specify ``retryReads=false`` or avoid using a `retryable error<../../retryable-reads/retryable-reads.rst#retryable-error>`_ for this test.
175
189
#. **Removed**
176
190
#. ``ChangeStream`` will perform server selection before attempting to resume, using initial ``readPreference``
177
191
#. Ensure that a cursor returned from an aggregate command with a cursor id and an initial empty batch is not closed on the driver side.
0 commit comments