Skip to content

Commit d05a231

Browse files
committed
Force unique clusterTime values by splitting insert into two commands (#1356)
JAVA-5397
1 parent 1b8bce4 commit d05a231

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

driver-core/src/test/functional/com/mongodb/internal/operation/ChangeStreamOperationSpecification.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,13 @@ class ChangeStreamOperationSpecification extends OperationFunctionalSpecificatio
519519
def cursor = execute(operation, async)
520520

521521
when:
522-
def expected = insertDocuments(helper, [1, 2])
522+
// split into two insert commands, because starting in MongoDB 8.0 the same clusterTime is applied to all documents in a bulk
523+
// write operation, and the test relies on the clusterTime values being both ascending _and_ unique.
524+
def expectedOne = insertDocuments(helper, [1])
525+
def expectedTwo = insertDocuments(helper, [2])
526+
def expected = []
527+
expected.addAll(expectedOne)
528+
expected.addAll(expectedTwo)
523529
def result = next(cursor, async, 2)
524530

525531
then:

0 commit comments

Comments
 (0)