DATAMONGO-1987 - Upgrade test infrastructure to MongoDB 4.0-rc0

Also make sure to use WriteConcern.MAJORITY when (re)creating collections in test setup.
This commit is contained in:
Christoph Strobl
2018-05-25 08:33:21 +02:00
parent bec79e6d7b
commit e90c5bad2c
2 changed files with 3 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ env:
matrix:
- PROFILE=ci
global:
- MONGO_VERSION=3.7.9
- MONGO_VERSION=4.0.0-rc0
addons:
apt:

View File

@@ -44,7 +44,8 @@ public class MongoTestUtils {
public static MongoCollection<Document> createOrReplaceCollection(String dbName, String collectionName,
com.mongodb.MongoClient client) {
MongoDatabase database = client.getDatabase(dbName);
MongoDatabase database = client.getDatabase(dbName).withWriteConcern(WriteConcern.MAJORITY)
.withReadPreference(ReadPreference.primary());
boolean collectionExists = database.listCollections().filter(new Document("name", collectionName)).first() != null;