73
73
import static com .mongodb .ClusterFixture .getServerVersion ;
74
74
import static com .mongodb .client .Fixture .getMongoClient ;
75
75
import static com .mongodb .client .Fixture .getMongoClientSettings ;
76
+ import static com .mongodb .client .test .CollectionHelper .getCurrentClusterTime ;
76
77
import static com .mongodb .client .unified .RunOnRequirementsMatcher .runOnRequirementsMet ;
77
78
import static java .util .Collections .singletonList ;
78
79
import static java .util .stream .Collectors .toList ;
@@ -105,6 +106,7 @@ public abstract class UnifiedTest {
105
106
private final UnifiedClientEncryptionHelper clientEncryptionHelper = new UnifiedClientEncryptionHelper (entities );
106
107
private final List <FailPoint > failPoints = new ArrayList <>();
107
108
private final UnifiedTestContext rootContext = new UnifiedTestContext ();
109
+ private BsonDocument startingClusterTime ;
108
110
109
111
private class UnifiedTestContext {
110
112
private final AssertionContext context = new AssertionContext ();
@@ -212,12 +214,12 @@ public void setUp() {
212
214
if (definition .containsKey ("skipReason" )) {
213
215
throw new AssumptionViolatedException (definition .getString ("skipReason" ).getValue ());
214
216
}
215
- entities .init (entitiesArray ,
217
+ startingClusterTime = addInitialData ();
218
+ entities .init (entitiesArray , startingClusterTime ,
216
219
fileDescription != null && PRESTART_POOL_ASYNC_WORK_MANAGER_FILE_DESCRIPTIONS .contains (fileDescription ),
217
220
this ::createMongoClient ,
218
221
this ::createGridFSBucket ,
219
222
this ::createClientEncryption );
220
- addInitialData ();
221
223
}
222
224
223
225
@ After
@@ -561,6 +563,7 @@ protected boolean terminateLoop() {
561
563
562
564
private OperationResult executeCreateEntities (final BsonDocument operation ) {
563
565
entities .init (operation .getDocument ("arguments" ).getArray ("entities" ),
566
+ startingClusterTime ,
564
567
false ,
565
568
this ::createMongoClient ,
566
569
this ::createGridFSBucket ,
@@ -890,7 +893,7 @@ private List<CommandEvent> lastTwoCommandEvents(final TestCommandListener listen
890
893
return events .subList (events .size () - 2 , events .size ());
891
894
}
892
895
893
- private void addInitialData () {
896
+ private BsonDocument addInitialData () {
894
897
for (BsonValue cur : initialData .getValues ()) {
895
898
BsonDocument curDataSet = cur .asDocument ();
896
899
CollectionHelper <BsonDocument > helper = new CollectionHelper <>(new BsonDocumentCodec (),
@@ -905,5 +908,6 @@ private void addInitialData() {
905
908
WriteConcern .MAJORITY );
906
909
}
907
910
}
911
+ return getCurrentClusterTime ();
908
912
}
909
913
}
0 commit comments