Skip to content

Commit

Permalink
DRIVERS-2617 Add prose test for change stream splitting (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
abr-egn authored Jun 14, 2023
1 parent 3880a6a commit a10e270
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/change-streams/change-streams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ Reference Implementations
Changelog
=========

:2023-05-22: Add spec test for ``$changeStreamSplitLargeEvent``.
:2022-10-20: Reformat changelog.
:2022-10-05: Remove spec front matter.
:2022-08-22: Add ``clusterTime`` to ``ChangeStreamDocument``.
Expand Down
10 changes: 10 additions & 0 deletions source/change-streams/tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,13 @@ The following tests have not yet been automated, but MUST still be tested. All t
#. **Removed**
#. ``$changeStream`` stage for ``ChangeStream`` started with ``startAfter`` against a server ``>=4.1.1`` that has not received any results yet MUST include a ``startAfter`` option and MUST NOT include a ``resumeAfter`` option when resuming a change stream.
#. ``$changeStream`` stage for ``ChangeStream`` started with ``startAfter`` against a server ``>=4.1.1`` that has received at least one result MUST include a ``resumeAfter`` option and MUST NOT include a ``startAfter`` option when resuming a change stream.

#. Validate that large ``ChangeStream`` events are split when using ``$changeStreamSplitLargeEvent``:

#. Run only against servers ``>=7.0``
#. Create a new collection _C_ with ``changeStreamPreAndPostImages`` enabled.
#. Insert into _C_ a document at least 10mb in size, e.g. ``{ "value": "q"*10*1024*1024 }``
#. Create a change stream _S_ by calling ``watch`` on _C_ with pipeline ``[{ "$changeStreamSplitLargeEvent": {} }]`` and ``fullDocumentBeforeChange=required``.
#. Call ``updateOne`` on _C_ with an empty ``query`` and an update setting the field to a new large value, e.g. ``{ "$set": { "value": "z"*10*1024*1024 } }``.
#. Collect two events from _S_.
#. Assert that the events collected have ``splitEvent`` fields ``{ "fragment": 1, "of": 2 }`` and ``{ "fragment": 2, "of": 2 }``, in that order.

0 comments on commit a10e270

Please sign in to comment.