Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force unique clusterTime values by splitting insert into two commands #1356

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,13 @@ class ChangeStreamOperationSpecification extends OperationFunctionalSpecificatio
def cursor = execute(operation, async)

when:
def expected = insertDocuments(helper, [1, 2])
// split into two insert commands, because starting in MongoDB 8.0 the same clusterTime is applied to all documents in a bulk
// write operation, and the test relies on the clusterTime values being both ascending _and_ unique.
def expectedOne = insertDocuments(helper, [1])
def expectedTwo = insertDocuments(helper, [2])
def expected = []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure there is a more idiomatic one liner that will do this but I didn't think it was important enough to research. :)

expected.addAll(expectedOne)
expected.addAll(expectedTwo)
def result = next(cursor, async, 2)

then:
Expand Down