Skip to content

Commit 3e50c92

Browse files
committed
Change read preference for causal consistency test from secondary to secondaryPreferred so that
it succeeds trivially if run against a replica set (or sharded cluster with replica set shards) with a single, primary, member
1 parent cbf948f commit 3e50c92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

driver/src/test/functional/com/mongodb/MongoClientSessionSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
283283
Document document = new Document('_id', i);
284284
collection.insertOne(clientSession, document)
285285
Document foundDocument = collection
286-
.withReadPreference(ReadPreference.secondary()) // read from secondary
286+
.withReadPreference(ReadPreference.secondaryPreferred()) // read from secondary if available
287287
.withReadConcern(readConcern)
288288
.find(clientSession, document)
289289
.maxTime(5000, TimeUnit.MILLISECONDS) // to avoid the test running forever in case replication is broken

0 commit comments

Comments
 (0)