diff --git a/.evergreen/.evg.yml b/.evergreen/.evg.yml index 886282b77c4..58369f23a59 100644 --- a/.evergreen/.evg.yml +++ b/.evergreen/.evg.yml @@ -1802,10 +1802,6 @@ axes: display_name: "4.0" variables: VERSION: "4.0" - - id: "3.6" - display_name: "3.6" - variables: - VERSION: "3.6" - id: os display_name: OS values: @@ -2223,7 +2219,7 @@ buildvariants: - name: "test" - matrix_name: "tests-jdk8-unsecure" - matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", version: ["3.6", "4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "latest"], + matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "latest"], topology: "*", os: "linux" } display_name: "${version} ${topology} ${auth} ${ssl} ${jdk} ${os} " tags: ["tests-variant"] @@ -2232,7 +2228,7 @@ buildvariants: - matrix_name: "tests-jdk-secure" matrix_spec: { auth: "auth", ssl: "ssl", jdk: [ "jdk8", "jdk17", "jdk21"], - version: [ "3.6", "4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "latest" ], + version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "latest" ], topology: "*", os: "linux" } display_name: "${version} ${topology} ${auth} ${ssl} ${jdk} ${os} " tags: ["tests-variant"] diff --git a/driver-core/src/main/com/mongodb/connection/ServerDescription.java b/driver-core/src/main/com/mongodb/connection/ServerDescription.java index fbc59cc944f..1bf0a037924 100644 --- a/driver-core/src/main/com/mongodb/connection/ServerDescription.java +++ b/driver-core/src/main/com/mongodb/connection/ServerDescription.java @@ -58,7 +58,7 @@ public class ServerDescription { * The minimum supported driver wire version * @since 3.8 */ - public static final int MIN_DRIVER_WIRE_VERSION = 6; + public static final int MIN_DRIVER_WIRE_VERSION = 7; /** * The maximum supported driver wire version * @since 3.8 diff --git a/driver-core/src/main/com/mongodb/internal/connection/CommandMessage.java b/driver-core/src/main/com/mongodb/internal/connection/CommandMessage.java index f9ca361778f..24b30d60acb 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/CommandMessage.java +++ b/driver-core/src/main/com/mongodb/internal/connection/CommandMessage.java @@ -49,7 +49,6 @@ import static com.mongodb.internal.connection.ReadConcernHelper.getReadConcernDocument; import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_TWO_WIRE_VERSION; import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_ZERO_WIRE_VERSION; -import static com.mongodb.internal.operation.ServerVersionHelper.THREE_DOT_SIX_WIRE_VERSION; /** * A command message that uses OP_MSG or OP_QUERY to send the command. @@ -270,9 +269,7 @@ private void addServerApiElements(final List extraElements) { } private void checkServerVersionForTransactionSupport() { - int wireVersion = getSettings().getMaxWireVersion(); - if (wireVersion < FOUR_DOT_ZERO_WIRE_VERSION - || (wireVersion < FOUR_DOT_TWO_WIRE_VERSION && getSettings().getServerType() == SHARD_ROUTER)) { + if (getSettings().getMaxWireVersion() < FOUR_DOT_TWO_WIRE_VERSION && getSettings().getServerType() == SHARD_ROUTER) { throw new MongoClientException("Transactions are not supported by the MongoDB cluster to which this client is connected."); } } @@ -287,12 +284,12 @@ private void addReadConcernDocument(final List extraElements, final private static OpCode getOpCode(final MessageSettings settings, final ClusterConnectionMode clusterConnectionMode, @Nullable final ServerApi serverApi) { - return isServerVersionAtLeastThreeDotSix(settings) || clusterConnectionMode == LOAD_BALANCED || serverApi != null + return isServerVersionKnown(settings) || clusterConnectionMode == LOAD_BALANCED || serverApi != null ? OpCode.OP_MSG : OpCode.OP_QUERY; } - private static boolean isServerVersionAtLeastThreeDotSix(final MessageSettings settings) { - return settings.getMaxWireVersion() >= THREE_DOT_SIX_WIRE_VERSION; + private static boolean isServerVersionKnown(final MessageSettings settings) { + return settings.getMaxWireVersion() >= FOUR_DOT_ZERO_WIRE_VERSION; } } diff --git a/driver-core/src/main/com/mongodb/internal/connection/DefaultAuthenticator.java b/driver-core/src/main/com/mongodb/internal/connection/DefaultAuthenticator.java index 86b081b621d..13e7ec09a16 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/DefaultAuthenticator.java +++ b/driver-core/src/main/com/mongodb/internal/connection/DefaultAuthenticator.java @@ -32,7 +32,6 @@ import static com.mongodb.AuthenticationMechanism.SCRAM_SHA_256; import static com.mongodb.assertions.Assertions.assertNotNull; import static com.mongodb.assertions.Assertions.isTrueArgument; -import static com.mongodb.internal.operation.ServerVersionHelper.serverIsLessThanVersionFourDotZero; import static java.lang.String.format; class DefaultAuthenticator extends Authenticator implements SpeculativeAuthenticator { @@ -48,29 +47,19 @@ class DefaultAuthenticator extends Authenticator implements SpeculativeAuthentic @Override void authenticate(final InternalConnection connection, final ConnectionDescription connectionDescription) { - if (serverIsLessThanVersionFourDotZero(connectionDescription)) { - new ScramShaAuthenticator(getMongoCredentialWithCache().withMechanism(SCRAM_SHA_1), getClusterConnectionMode(), getServerApi()) - .authenticate(connection, connectionDescription); - } else { - try { - setDelegate(connectionDescription); - delegate.authenticate(connection, connectionDescription); - } catch (Exception e) { - throw wrapException(e); - } + try { + setDelegate(connectionDescription); + delegate.authenticate(connection, connectionDescription); + } catch (Exception e) { + throw wrapException(e); } } @Override void authenticateAsync(final InternalConnection connection, final ConnectionDescription connectionDescription, final SingleResultCallback callback) { - if (serverIsLessThanVersionFourDotZero(connectionDescription)) { - new ScramShaAuthenticator(getMongoCredentialWithCache().withMechanism(SCRAM_SHA_1), getClusterConnectionMode(), getServerApi()) - .authenticateAsync(connection, connectionDescription, callback); - } else { - setDelegate(connectionDescription); - delegate.authenticateAsync(connection, connectionDescription, callback); - } + setDelegate(connectionDescription); + delegate.authenticateAsync(connection, connectionDescription, callback); } @Override diff --git a/driver-core/src/main/com/mongodb/internal/operation/ServerVersionHelper.java b/driver-core/src/main/com/mongodb/internal/operation/ServerVersionHelper.java index 1c95774a68f..68a03410832 100644 --- a/driver-core/src/main/com/mongodb/internal/operation/ServerVersionHelper.java +++ b/driver-core/src/main/com/mongodb/internal/operation/ServerVersionHelper.java @@ -25,34 +25,18 @@ public final class ServerVersionHelper { public static final int MIN_WIRE_VERSION = 0; - public static final int THREE_DOT_SIX_WIRE_VERSION = 6; public static final int FOUR_DOT_ZERO_WIRE_VERSION = 7; public static final int FOUR_DOT_TWO_WIRE_VERSION = 8; public static final int FOUR_DOT_FOUR_WIRE_VERSION = 9; public static final int FIVE_DOT_ZERO_WIRE_VERSION = 12; public static final int SIX_DOT_ZERO_WIRE_VERSION = 17; - private static final int SEVEN_DOT_ZERO_WIRE_VERSION = 21; - - public static boolean serverIsAtLeastVersionFourDotZero(final ConnectionDescription description) { - return description.getMaxWireVersion() >= FOUR_DOT_ZERO_WIRE_VERSION; - } - - public static boolean serverIsAtLeastVersionFourDotTwo(final ConnectionDescription description) { - return description.getMaxWireVersion() >= FOUR_DOT_TWO_WIRE_VERSION; - } + public static final int SEVEN_DOT_ZERO_WIRE_VERSION = 21; + public static final int LATEST_WIRE_VERSION = SEVEN_DOT_ZERO_WIRE_VERSION; public static boolean serverIsAtLeastVersionFourDotFour(final ConnectionDescription description) { return description.getMaxWireVersion() >= FOUR_DOT_FOUR_WIRE_VERSION; } - public static boolean serverIsAtLeastVersionFiveDotZero(final ConnectionDescription description) { - return description.getMaxWireVersion() >= FIVE_DOT_ZERO_WIRE_VERSION; - } - - public static boolean serverIsLessThanVersionFourDotZero(final ConnectionDescription description) { - return description.getMaxWireVersion() < FOUR_DOT_ZERO_WIRE_VERSION; - } - public static boolean serverIsLessThanVersionFourDotTwo(final ConnectionDescription description) { return description.getMaxWireVersion() < FOUR_DOT_TWO_WIRE_VERSION; } diff --git a/driver-core/src/test/functional/com/mongodb/ClusterFixture.java b/driver-core/src/test/functional/com/mongodb/ClusterFixture.java index 934c83f113b..920a2c2ac09 100644 --- a/driver-core/src/test/functional/com/mongodb/ClusterFixture.java +++ b/driver-core/src/test/functional/com/mongodb/ClusterFixture.java @@ -330,11 +330,8 @@ public static ReadWriteBinding getBinding(final ReadPreference readPreference) { private static ReadWriteBinding getBinding(final Cluster cluster, final ReadPreference readPreference) { if (!BINDING_MAP.containsKey(readPreference)) { - ReadWriteBinding binding = new ClusterBinding(cluster, readPreference, ReadConcern.DEFAULT, getServerApi(), - IgnorableRequestContext.INSTANCE); - if (serverVersionAtLeast(3, 6)) { - binding = new SessionBinding(binding); - } + ReadWriteBinding binding = new SessionBinding(new ClusterBinding(cluster, readPreference, ReadConcern.DEFAULT, getServerApi(), + IgnorableRequestContext.INSTANCE)); BINDING_MAP.put(readPreference, binding); } return BINDING_MAP.get(readPreference); @@ -367,11 +364,8 @@ public static AsyncReadWriteBinding getAsyncBinding(final ReadPreference readPre public static AsyncReadWriteBinding getAsyncBinding(final Cluster cluster, final ReadPreference readPreference) { if (!ASYNC_BINDING_MAP.containsKey(readPreference)) { - AsyncReadWriteBinding binding = new AsyncClusterBinding(cluster, readPreference, ReadConcern.DEFAULT, getServerApi(), - IgnorableRequestContext.INSTANCE); - if (serverVersionAtLeast(3, 6)) { - binding = new AsyncSessionBinding(binding); - } + AsyncReadWriteBinding binding = new AsyncSessionBinding(new AsyncClusterBinding(cluster, readPreference, ReadConcern.DEFAULT, + getServerApi(), IgnorableRequestContext.INSTANCE)); ASYNC_BINDING_MAP.put(readPreference, binding); } return ASYNC_BINDING_MAP.get(readPreference); diff --git a/driver-core/src/test/functional/com/mongodb/client/CommandMonitoringTestHelper.java b/driver-core/src/test/functional/com/mongodb/client/CommandMonitoringTestHelper.java index 8ba3a5b3851..4c045001b10 100644 --- a/driver-core/src/test/functional/com/mongodb/client/CommandMonitoringTestHelper.java +++ b/driver-core/src/test/functional/com/mongodb/client/CommandMonitoringTestHelper.java @@ -43,7 +43,6 @@ import java.util.Map; import java.util.concurrent.TimeUnit; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.client.CrudTestHelper.replaceTypeAssertionWithActual; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; @@ -90,11 +89,9 @@ public static List getExpectedEvents(final BsonArray expectedEvent } // Not clear whether these global fields should be included, but also not clear how to efficiently exclude them - if (serverVersionAtLeast(3, 6)) { - commandDocument.put("$db", new BsonString(actualDatabaseName)); - if (operation != null && operation.containsKey("read_preference")) { - commandDocument.put("$readPreference", operation.getDocument("read_preference")); - } + commandDocument.put("$db", new BsonString(actualDatabaseName)); + if (operation != null && operation.containsKey("read_preference")) { + commandDocument.put("$readPreference", operation.getDocument("read_preference")); } commandEvent = new CommandStartedEvent(null, 1, 1, null, actualDatabaseName, commandName, commandDocument); diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible.json b/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible.json index 444b13e9d57..dfd5d57dfab 100644 --- a/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible.json +++ b/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible.json @@ -16,7 +16,7 @@ "b:27017" ], "minWireVersion": 0, - "maxWireVersion": 6 + "maxWireVersion": 21 } ], [ diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible_unknown.json b/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible_unknown.json index cf92dd1ed35..95e03ea958e 100644 --- a/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible_unknown.json +++ b/driver-core/src/test/resources/server-discovery-and-monitoring/rs/compatible_unknown.json @@ -16,7 +16,7 @@ "b:27017" ], "minWireVersion": 0, - "maxWireVersion": 6 + "maxWireVersion": 21 } ] ], diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring/sharded/compatible.json b/driver-core/src/test/resources/server-discovery-and-monitoring/sharded/compatible.json index e531db97f9f..ceb0ec24c4c 100644 --- a/driver-core/src/test/resources/server-discovery-and-monitoring/sharded/compatible.json +++ b/driver-core/src/test/resources/server-discovery-and-monitoring/sharded/compatible.json @@ -23,7 +23,7 @@ "isWritablePrimary": true, "msg": "isdbgrid", "minWireVersion": 0, - "maxWireVersion": 6 + "maxWireVersion": 21 } ] ], diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring/single/compatible.json b/driver-core/src/test/resources/server-discovery-and-monitoring/single/compatible.json index 302927598ca..493d9b748e6 100644 --- a/driver-core/src/test/resources/server-discovery-and-monitoring/single/compatible.json +++ b/driver-core/src/test/resources/server-discovery-and-monitoring/single/compatible.json @@ -11,7 +11,7 @@ "helloOk": true, "isWritablePrimary": true, "minWireVersion": 0, - "maxWireVersion": 6 + "maxWireVersion": 21 } ] ], diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring/single/too_old_then_upgraded.json b/driver-core/src/test/resources/server-discovery-and-monitoring/single/too_old_then_upgraded.json index 58ae7d9de40..c3dd98cf62e 100644 --- a/driver-core/src/test/resources/server-discovery-and-monitoring/single/too_old_then_upgraded.json +++ b/driver-core/src/test/resources/server-discovery-and-monitoring/single/too_old_then_upgraded.json @@ -1,5 +1,5 @@ { - "description": "Standalone with default maxWireVersion of 0 is upgraded to one with maxWireVersion 6", + "description": "Standalone with default maxWireVersion of 0 is upgraded to one with maxWireVersion 21", "uri": "mongodb://a", "phases": [ { @@ -35,7 +35,7 @@ "helloOk": true, "isWritablePrimary": true, "minWireVersion": 0, - "maxWireVersion": 6 + "maxWireVersion": 21 } ] ], diff --git a/driver-core/src/test/unit/com/mongodb/internal/connection/CommandMessageSpecification.groovy b/driver-core/src/test/unit/com/mongodb/internal/connection/CommandMessageSpecification.groovy index 12d22e31fd1..edc6e92c30e 100644 --- a/driver-core/src/test/unit/com/mongodb/internal/connection/CommandMessageSpecification.groovy +++ b/driver-core/src/test/unit/com/mongodb/internal/connection/CommandMessageSpecification.groovy @@ -43,7 +43,7 @@ import java.nio.ByteBuffer import static com.mongodb.internal.connection.SplittablePayload.Type.INSERT import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_ZERO_WIRE_VERSION -import static com.mongodb.internal.operation.ServerVersionHelper.THREE_DOT_SIX_WIRE_VERSION +import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION class CommandMessageSpecification extends Specification { @@ -55,7 +55,7 @@ class CommandMessageSpecification extends Specification { given: def message = new CommandMessage(namespace, command, fieldNameValidator, readPreference, MessageSettings.builder() - .maxWireVersion(THREE_DOT_SIX_WIRE_VERSION) + .maxWireVersion(LATEST_WIRE_VERSION) .serverType(serverType as ServerType) .sessionSupported(true) .build(), @@ -148,9 +148,7 @@ class CommandMessageSpecification extends Specification { def expectedCommandDocument = new BsonDocument('insert', new BsonString('coll')).append('documents', new BsonArray([new BsonDocument('_id', new BsonInt32(1)), new BsonDocument('_id', new BsonInt32(2))])) - if (maxWireVersion == THREE_DOT_SIX_WIRE_VERSION) { - expectedCommandDocument.append('$db', new BsonString(namespace.getDatabaseName())) - } + expectedCommandDocument.append('$db', new BsonString(namespace.getDatabaseName())) then: commandDocument == expectedCommandDocument @@ -158,14 +156,14 @@ class CommandMessageSpecification extends Specification { where: [maxWireVersion, originalCommandDocument, payload] << [ [ - THREE_DOT_SIX_WIRE_VERSION, + LATEST_WIRE_VERSION, new BsonDocument('insert', new BsonString('coll')), new SplittablePayload(INSERT, [new BsonDocument('_id', new BsonInt32(1)), new BsonDocument('_id', new BsonInt32(2))] .withIndex().collect { doc, i -> new WriteRequestWithIndex(new InsertRequest(doc), i) } ), ], [ - THREE_DOT_SIX_WIRE_VERSION, + LATEST_WIRE_VERSION, new BsonDocument('insert', new BsonString('coll')).append('documents', new BsonArray([new BsonDocument('_id', new BsonInt32(1)), new BsonDocument('_id', new BsonInt32(2))])), null @@ -176,7 +174,7 @@ class CommandMessageSpecification extends Specification { def 'should respect the max message size'() { given: def maxMessageSize = 1024 - def messageSettings = MessageSettings.builder().maxMessageSize(maxMessageSize).maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxMessageSize(maxMessageSize).maxWireVersion(LATEST_WIRE_VERSION).build() def insertCommand = new BsonDocument('insert', new BsonString(namespace.collectionName)) def payload = new SplittablePayload(INSERT, [new BsonDocument('_id', new BsonInt32(1)).append('a', new BsonBinary(new byte[913])), new BsonDocument('_id', new BsonInt32(2)).append('b', new BsonBinary(new byte[441])), @@ -262,7 +260,7 @@ class CommandMessageSpecification extends Specification { def 'should respect the max batch count'() { given: - def messageSettings = MessageSettings.builder().maxBatchCount(2).maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxBatchCount(2).maxWireVersion(LATEST_WIRE_VERSION).build() def payload = new SplittablePayload(INSERT, [new BsonDocument('a', new BsonBinary(new byte[900])), new BsonDocument('b', new BsonBinary(new byte[450])), new BsonDocument('c', new BsonBinary(new byte[450]))] @@ -309,7 +307,7 @@ class CommandMessageSpecification extends Specification { def 'should throw if payload document bigger than max document size'() { given: def messageSettings = MessageSettings.builder().maxDocumentSize(900) - .maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + .maxWireVersion(LATEST_WIRE_VERSION).build() def payload = new SplittablePayload(INSERT, [new BsonDocument('a', new BsonBinary(new byte[900]))] .withIndex().collect { doc, i -> new WriteRequestWithIndex(new InsertRequest(doc), i) }) def message = new CommandMessage(namespace, command, fieldNameValidator, ReadPreference.primary(), messageSettings, @@ -326,25 +324,6 @@ class CommandMessageSpecification extends Specification { thrown(BsonMaximumSizeExceededException) } - def 'should throw if wire version does not support transactions'() { - given: - def messageSettings = MessageSettings.builder().maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() - def payload = new SplittablePayload(INSERT, [new BsonDocument('a', new BsonInt32(1))]) - def message = new CommandMessage(namespace, command, fieldNameValidator, ReadPreference.primary(), messageSettings, - false, payload, fieldNameValidator, ClusterConnectionMode.MULTIPLE, null) - def output = new BasicOutputBuffer() - def sessionContext = Stub(SessionContext) { - getReadConcern() >> ReadConcern.DEFAULT - hasActiveTransaction() >> true - } - - when: - message.encode(output, sessionContext) - - then: - thrown(MongoClientException) - } - def 'should throw if wire version and sharded cluster does not support transactions'() { given: def messageSettings = MessageSettings.builder().serverType(ServerType.SHARD_ROUTER) diff --git a/driver-core/src/test/unit/com/mongodb/internal/connection/InternalStreamConnectionSpecification.groovy b/driver-core/src/test/unit/com/mongodb/internal/connection/InternalStreamConnectionSpecification.groovy index ba5625999d1..c0cd580e02e 100644 --- a/driver-core/src/test/unit/com/mongodb/internal/connection/InternalStreamConnectionSpecification.groovy +++ b/driver-core/src/test/unit/com/mongodb/internal/connection/InternalStreamConnectionSpecification.groovy @@ -67,7 +67,7 @@ import static com.mongodb.connection.ConnectionDescription.getDefaultMaxWriteBat import static com.mongodb.connection.ServerDescription.getDefaultMaxDocumentSize import static com.mongodb.internal.connection.MessageHelper.LEGACY_HELLO import static com.mongodb.internal.connection.MessageHelper.LEGACY_HELLO_LOWER -import static com.mongodb.internal.operation.ServerVersionHelper.THREE_DOT_SIX_WIRE_VERSION +import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION import static java.util.concurrent.TimeUnit.NANOSECONDS import static java.util.concurrent.TimeUnit.SECONDS @@ -81,7 +81,7 @@ class InternalStreamConnectionSpecification extends Specification { def serverAddress = new ServerAddress() def connectionId = new ConnectionId(SERVER_ID, 1, 1) def commandListener = new TestCommandListener() - def messageSettings = MessageSettings.builder().maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxWireVersion(LATEST_WIRE_VERSION).build() def connectionDescription = new ConnectionDescription(connectionId, 3, ServerType.STANDALONE, getDefaultMaxWriteBatchSize(), getDefaultMaxDocumentSize(), getDefaultMaxMessageSize(), []) diff --git a/driver-core/src/test/unit/com/mongodb/internal/connection/LoggingCommandEventSenderSpecification.groovy b/driver-core/src/test/unit/com/mongodb/internal/connection/LoggingCommandEventSenderSpecification.groovy index 8ff260995dd..9c3fb0d91db 100644 --- a/driver-core/src/test/unit/com/mongodb/internal/connection/LoggingCommandEventSenderSpecification.groovy +++ b/driver-core/src/test/unit/com/mongodb/internal/connection/LoggingCommandEventSenderSpecification.groovy @@ -41,7 +41,7 @@ import spock.lang.Specification import static com.mongodb.connection.ClusterConnectionMode.MULTIPLE import static com.mongodb.connection.ClusterConnectionMode.SINGLE -import static com.mongodb.internal.operation.ServerVersionHelper.THREE_DOT_SIX_WIRE_VERSION +import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION class LoggingCommandEventSenderSpecification extends Specification { @@ -49,7 +49,7 @@ class LoggingCommandEventSenderSpecification extends Specification { given: def connectionDescription = new ConnectionDescription(new ServerId(new ClusterId(), new ServerAddress())) def namespace = new MongoNamespace('test.driver') - def messageSettings = MessageSettings.builder().maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxWireVersion(LATEST_WIRE_VERSION).build() def commandListener = new TestCommandListener() def commandDocument = new BsonDocument('ping', new BsonInt32(1)) def replyDocument = new BsonDocument('ok', new BsonInt32(1)) @@ -95,7 +95,7 @@ class LoggingCommandEventSenderSpecification extends Specification { def connectionDescription = new ConnectionDescription(serverId) .withConnectionId(new ConnectionId(serverId, 42, 1000)) def namespace = new MongoNamespace('test.driver') - def messageSettings = MessageSettings.builder().maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxWireVersion(LATEST_WIRE_VERSION).build() def commandDocument = new BsonDocument('ping', new BsonInt32(1)) def replyDocument = new BsonDocument('ok', new BsonInt32(42)) def failureException = new MongoInternalException('failure!') @@ -153,7 +153,7 @@ class LoggingCommandEventSenderSpecification extends Specification { def connectionDescription = new ConnectionDescription(serverId) .withConnectionId(new ConnectionId(serverId, 42, 1000)) def namespace = new MongoNamespace('test.driver') - def messageSettings = MessageSettings.builder().maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxWireVersion(LATEST_WIRE_VERSION).build() def commandDocument = new BsonDocument('fake', new BsonBinary(new byte[2048])) def message = new CommandMessage(namespace, commandDocument, new NoOpFieldNameValidator(), ReadPreference.primary(), messageSettings, SINGLE, null) @@ -186,7 +186,7 @@ class LoggingCommandEventSenderSpecification extends Specification { def connectionDescription = new ConnectionDescription(serverId) .withConnectionId(new ConnectionId(serverId, 42, 1000)) def namespace = new MongoNamespace('test.driver') - def messageSettings = MessageSettings.builder().maxWireVersion(THREE_DOT_SIX_WIRE_VERSION).build() + def messageSettings = MessageSettings.builder().maxWireVersion(LATEST_WIRE_VERSION).build() def commandDocument = new BsonDocument('createUser', new BsonString('private')) def message = new CommandMessage(namespace, commandDocument, new NoOpFieldNameValidator(), ReadPreference.primary(), messageSettings, SINGLE, null) diff --git a/driver-core/src/test/unit/com/mongodb/internal/connection/TestInternalConnection.java b/driver-core/src/test/unit/com/mongodb/internal/connection/TestInternalConnection.java index e8003f692a9..8e99c89c20d 100644 --- a/driver-core/src/test/unit/com/mongodb/internal/connection/TestInternalConnection.java +++ b/driver-core/src/test/unit/com/mongodb/internal/connection/TestInternalConnection.java @@ -44,7 +44,7 @@ import static com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException; import static com.mongodb.internal.connection.ProtocolHelper.isCommandOk; -import static com.mongodb.internal.operation.ServerVersionHelper.THREE_DOT_SIX_WIRE_VERSION; +import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION; class TestInternalConnection implements InternalConnection { @@ -66,7 +66,7 @@ private static class Interaction { } TestInternalConnection(final ServerId serverId, final ServerType serverType) { - this.description = new ConnectionDescription(new ConnectionId(serverId), THREE_DOT_SIX_WIRE_VERSION, serverType, 0, 0, 0, + this.description = new ConnectionDescription(new ConnectionId(serverId), LATEST_WIRE_VERSION, serverType, 0, 0, 0, Collections.emptyList()); this.bufferProvider = new SimpleBufferProvider(); diff --git a/driver-core/src/test/unit/com/mongodb/internal/connection/X509AuthenticatorNoUserNameTest.java b/driver-core/src/test/unit/com/mongodb/internal/connection/X509AuthenticatorNoUserNameTest.java index cf829f919c5..e2ea7939880 100644 --- a/driver-core/src/test/unit/com/mongodb/internal/connection/X509AuthenticatorNoUserNameTest.java +++ b/driver-core/src/test/unit/com/mongodb/internal/connection/X509AuthenticatorNoUserNameTest.java @@ -37,7 +37,7 @@ import static com.mongodb.internal.connection.MessageHelper.buildSuccessfulReply; import static com.mongodb.internal.connection.MessageHelper.getApiVersionField; import static com.mongodb.internal.connection.MessageHelper.getDbField; -import static com.mongodb.internal.operation.ServerVersionHelper.THREE_DOT_SIX_WIRE_VERSION; +import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION; import static org.junit.Assert.assertEquals; public class X509AuthenticatorNoUserNameTest { @@ -48,7 +48,7 @@ public class X509AuthenticatorNoUserNameTest { public void before() { connection = new TestInternalConnection(new ServerId(new ClusterId(), new ServerAddress("localhost", 27017))); connectionDescriptionThreeSix = new ConnectionDescription(new ConnectionId(new ServerId(new ClusterId(), new ServerAddress())), - THREE_DOT_SIX_WIRE_VERSION, ServerType.STANDALONE, 1000, 16000, + LATEST_WIRE_VERSION, ServerType.STANDALONE, 1000, 16000, 48000, Collections.emptyList()); } diff --git a/driver-legacy/src/main/com/mongodb/MapReduceCommand.java b/driver-legacy/src/main/com/mongodb/MapReduceCommand.java index 0fc4278cacc..d812d6a12af 100644 --- a/driver-legacy/src/main/com/mongodb/MapReduceCommand.java +++ b/driver-legacy/src/main/com/mongodb/MapReduceCommand.java @@ -222,7 +222,7 @@ public long getMaxTime(final TimeUnit timeUnit) { /** * Sets the max execution time for this command, in the given time unit. * - * @param maxTime the maximum execution time. A non-zero value requires a server version >= 2.6 + * @param maxTime the maximum execution time. * @param timeUnit the time unit that maxTime is specified in * @since 2.12.0 */ diff --git a/driver-legacy/src/test/functional/com/mongodb/DBCollectionAggregationTest.java b/driver-legacy/src/test/functional/com/mongodb/DBCollectionAggregationTest.java index c9ffdf14a0e..5ca589c54df 100644 --- a/driver-legacy/src/test/functional/com/mongodb/DBCollectionAggregationTest.java +++ b/driver-legacy/src/test/functional/com/mongodb/DBCollectionAggregationTest.java @@ -28,7 +28,6 @@ import static com.mongodb.ClusterFixture.enableMaxTimeFailPoint; import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet; import static com.mongodb.ClusterFixture.isSharded; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.connection.ClusterType.REPLICA_SET; import static java.util.Arrays.asList; import static java.util.concurrent.TimeUnit.SECONDS; @@ -104,7 +103,6 @@ public List prepareData() { @Test public void testExplain() { - assumeTrue(serverVersionAtLeast(3, 6)); List pipeline = new ArrayList<>(prepareData()); CommandResult out = collection.explainAggregate(pipeline, AggregationOptions.builder().build()); assertTrue(out.keySet().iterator().hasNext()); @@ -133,7 +131,6 @@ public void testMaxTime() { @Test public void testWriteConcern() { assumeThat(isDiscoverableReplicaSet(), is(true)); - assumeTrue(serverVersionAtLeast(3, 4)); DBCollection collection = database.getCollection("testWriteConcern"); collection.setWriteConcern(new WriteConcern(5)); try { diff --git a/driver-legacy/src/test/functional/com/mongodb/DBCursorTest.java b/driver-legacy/src/test/functional/com/mongodb/DBCursorTest.java index f04f10efd04..6c4f622507b 100644 --- a/driver-legacy/src/test/functional/com/mongodb/DBCursorTest.java +++ b/driver-legacy/src/test/functional/com/mongodb/DBCursorTest.java @@ -28,7 +28,6 @@ import static com.mongodb.ClusterFixture.disableMaxTimeFailPoint; import static com.mongodb.ClusterFixture.enableMaxTimeFailPoint; import static com.mongodb.ClusterFixture.isSharded; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -394,13 +393,7 @@ public void testSettingACommentInsertsCommentIntoProfileCollectionWhenProfilingI assertEquals(1, profileCollection.count()); DBObject profileDocument = profileCollection.findOne(); - if (serverVersionAtLeast(3, 6)) { - assertEquals(expectedComment, ((DBObject) profileDocument.get("command")).get("comment")); - } else if (serverVersionAtLeast(3, 2)) { - assertEquals(expectedComment, ((DBObject) profileDocument.get("query")).get("comment")); - } else { - assertEquals(expectedComment, ((DBObject) profileDocument.get("query")).get("$comment")); - } + assertEquals(expectedComment, ((DBObject) profileDocument.get("command")).get("comment")); } finally { database.command(new BasicDBObject("profile", 0)); profileCollection.drop(); diff --git a/driver-legacy/src/test/functional/com/mongodb/DBTest.java b/driver-legacy/src/test/functional/com/mongodb/DBTest.java index 8b2f8f59d90..4ce9b3f760b 100644 --- a/driver-legacy/src/test/functional/com/mongodb/DBTest.java +++ b/driver-legacy/src/test/functional/com/mongodb/DBTest.java @@ -36,7 +36,6 @@ import static com.mongodb.ClusterFixture.getBinding; import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet; import static com.mongodb.ClusterFixture.isSharded; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.DBObjectMatchers.hasFields; import static com.mongodb.DBObjectMatchers.hasSubdocument; import static com.mongodb.Fixture.getDefaultDatabaseName; @@ -162,7 +161,6 @@ public void shouldThrowErrorIfCreatingACappedCollectionWithANegativeSize() { @Test public void shouldCreateCollectionWithTheSetCollation() { - assumeThat(serverVersionAtLeast(3, 4), is(true)); // Given collection.drop(); Collation collation = Collation.builder() diff --git a/driver-legacy/src/test/functional/com/mongodb/MapReduceTest.java b/driver-legacy/src/test/functional/com/mongodb/MapReduceTest.java index 74c8d5d15fc..f10a2fd6e93 100644 --- a/driver-legacy/src/test/functional/com/mongodb/MapReduceTest.java +++ b/driver-legacy/src/test/functional/com/mongodb/MapReduceTest.java @@ -29,7 +29,6 @@ import static com.mongodb.ClusterFixture.enableMaxTimeFailPoint; import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet; import static com.mongodb.ClusterFixture.isSharded; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.ClusterFixture.serverVersionLessThan; import static com.mongodb.DBObjectMatchers.hasFields; import static com.mongodb.DBObjectMatchers.hasSubdocument; @@ -48,7 +47,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.junit.Assume.assumeThat; -import static org.junit.Assume.assumeTrue; @SuppressWarnings("deprecation") public class MapReduceTest extends DatabaseTestCase { @@ -108,7 +106,6 @@ public void testMapReduceExecutionTimeout() { @Test public void testWriteConcern() { assumeThat(isDiscoverableReplicaSet(), is(true)); - assumeTrue(serverVersionAtLeast(3, 4)); DBCollection collection = database.getCollection("testWriteConcernForMapReduce"); collection.insert(new BasicDBObject("x", new String[]{"a", "b"}).append("s", 1)); collection.setWriteConcern(new WriteConcern(5)); diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/BatchCursorPublisherErrorTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/BatchCursorPublisherErrorTest.java index 7bd08753665..ce15fe3d1e4 100644 --- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/BatchCursorPublisherErrorTest.java +++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/BatchCursorPublisherErrorTest.java @@ -34,13 +34,11 @@ import static com.mongodb.reactivestreams.client.Fixture.drop; import static com.mongodb.reactivestreams.client.Fixture.getDefaultDatabase; import static com.mongodb.reactivestreams.client.Fixture.getMongoClient; -import static com.mongodb.reactivestreams.client.Fixture.serverVersionAtLeast; import static java.lang.String.format; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static java.util.stream.IntStream.rangeClosed; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.jupiter.api.DynamicTest.dynamicTest; public class BatchCursorPublisherErrorTest { @@ -49,7 +47,6 @@ public class BatchCursorPublisherErrorTest { @BeforeEach public void setup() { - assumeTrue(serverVersionAtLeast(3, 6)); collection = getDefaultDatabase().getCollection("changeStreamsCancellationTest"); Mono.from(collection.insertMany(rangeClosed(1, 11) .boxed() diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ChangeStreamsCancellationTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ChangeStreamsCancellationTest.java index e7e266a3d92..a41c818ceea 100644 --- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ChangeStreamsCancellationTest.java +++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ChangeStreamsCancellationTest.java @@ -27,7 +27,6 @@ import static com.mongodb.reactivestreams.client.Fixture.drop; import static com.mongodb.reactivestreams.client.Fixture.getDefaultDatabase; import static com.mongodb.reactivestreams.client.Fixture.isReplicaSet; -import static com.mongodb.reactivestreams.client.Fixture.serverVersionAtLeast; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -37,7 +36,7 @@ public class ChangeStreamsCancellationTest { @BeforeEach public void setup() { - assumeTrue(isReplicaSet() && serverVersionAtLeast(3, 6)); + assumeTrue(isReplicaSet()); collection = getDefaultDatabase().getCollection("changeStreamsCancellationTest"); } diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ReadConcernTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ReadConcernTest.java index 15b1bc7f5cf..e3ff5921ad2 100644 --- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ReadConcernTest.java +++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ReadConcernTest.java @@ -30,12 +30,10 @@ import java.util.List; import static com.mongodb.ClusterFixture.TIMEOUT_DURATION; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.client.CommandMonitoringTestHelper.assertEventsEquality; import static com.mongodb.reactivestreams.client.Fixture.getDefaultDatabaseName; import static com.mongodb.reactivestreams.client.Fixture.getMongoClientBuilderFromConnectionString; import static java.util.Collections.singletonList; -import static org.junit.Assume.assumeTrue; public class ReadConcernTest { private TestCommandListener commandListener; @@ -43,7 +41,6 @@ public class ReadConcernTest { @Before public void setUp() { - assumeTrue(canRunTests()); commandListener = new TestCommandListener(); mongoClient = MongoClients.create(getMongoClientBuilderFromConnectionString() .addCommandListener(commandListener) @@ -74,8 +71,4 @@ public void shouldIncludeReadConcernInCommand() throws InterruptedException { assertEventsEquality(singletonList(new CommandStartedEvent(null, 1, 1, null, getDefaultDatabaseName(), "find", commandDocument)), events); } - - private boolean canRunTests() { - return serverVersionAtLeast(3, 2); - } } diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/RetryableWritesProseTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/RetryableWritesProseTest.java index eb2b73e0c7e..fcfd3160515 100644 --- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/RetryableWritesProseTest.java +++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/RetryableWritesProseTest.java @@ -33,7 +33,6 @@ import static com.mongodb.ClusterFixture.getServerStatus; import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet; import static com.mongodb.ClusterFixture.isSharded; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.ClusterFixture.serverVersionLessThan; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -113,6 +112,6 @@ private boolean canRunTests() { return ((isSharded() || isDiscoverableReplicaSet()) && storageEngine != null && storageEngine.get("name").equals("mmapv1") - && serverVersionAtLeast(3, 6) && serverVersionLessThan(4, 2)); + && serverVersionLessThan(4, 2)); } } diff --git a/driver-sync/src/examples/documentation/DocumentationSamples.java b/driver-sync/src/examples/documentation/DocumentationSamples.java index 22f9793806e..659507807ee 100644 --- a/driver-sync/src/examples/documentation/DocumentationSamples.java +++ b/driver-sync/src/examples/documentation/DocumentationSamples.java @@ -42,7 +42,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.client.Fixture.getDefaultDatabaseName; import static com.mongodb.client.Fixture.getMongoClient; import static com.mongodb.client.model.Accumulators.sum; @@ -507,8 +506,6 @@ public void testProjectingFields() { @Test public void testAggregate() { - assumeTrue(serverVersionAtLeast(3, 6)); - MongoCollection salesCollection = database.getCollection("sales"); // Start Aggregation Example 1 @@ -663,7 +660,7 @@ public void testDeletions() { @Test public void testWatch() throws InterruptedException { - assumeTrue(isDiscoverableReplicaSet() && serverVersionAtLeast(3, 6)); + assumeTrue(isDiscoverableReplicaSet()); MongoCollection inventory = collection; AtomicBoolean stop = new AtomicBoolean(false); @@ -725,9 +722,6 @@ public void testRunCommand() { @Test public void testCreateIndexes() { - - assumeTrue(serverVersionAtLeast(3, 2)); - // Start Index Example 1 collection.createIndex(Indexes.ascending("score")); // End Index Example 1 diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractExplainTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractExplainTest.java index 18b8d4dc520..7db4a079a5e 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractExplainTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractExplainTest.java @@ -54,8 +54,6 @@ public void tearDown() { @Test public void testExplainOfFind() { - assumeTrue(serverVersionAtLeast(3, 0)); - MongoCollection collection = client.getDatabase(getDefaultDatabaseName()) .getCollection("explainTest", BsonDocument.class); collection.drop(); @@ -147,7 +145,6 @@ private static BsonDocument getAggregateExplainDocument(final BsonDocument rootA public void testExplainOfAggregateWithOldResponseStructure() { // Aggregate explain is supported on earlier versions, but the structure of the response on which we're asserting in this test // changed radically in 4.2. So here we just assert that we got a non-error respinse - assumeTrue(serverVersionAtLeast(3, 6)); assumeTrue(serverVersionLessThan(4, 2)); MongoCollection collection = client.getDatabase(getDefaultDatabaseName()) diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractSessionsProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractSessionsProseTest.java index 8883c1b643d..db3cb497543 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractSessionsProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractSessionsProseTest.java @@ -79,8 +79,6 @@ public static void afterAll() { // Test 13 from #13-existing-sessions-are-not-checked-into-a-cleared-pool-after-forking @Test public void shouldCreateServerSessionOnlyAfterConnectionCheckout() throws InterruptedException { - assumeTrue(serverVersionAtLeast(3, 6)); - Set lsidSet = ConcurrentHashMap.newKeySet(); MongoCollection collection; try (MongoClient client = getMongoClient( diff --git a/driver-sync/src/test/functional/com/mongodb/client/ChangeStreamProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/ChangeStreamProseTest.java index 2be283855eb..adbc442c4f9 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/ChangeStreamProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/ChangeStreamProseTest.java @@ -455,7 +455,7 @@ private void disableFailPoint() { } private boolean canRunTests() { - return isDiscoverableReplicaSet() && serverVersionAtLeast(3, 6); + return isDiscoverableReplicaSet(); } private AggregateResponseBatchCursor getBatchCursor(final MongoChangeStreamCursor> cursor) diff --git a/driver-sync/src/test/functional/com/mongodb/client/CrudProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/CrudProseTest.java index 5694759a845..b8d94cfe067 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/CrudProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/CrudProseTest.java @@ -82,8 +82,6 @@ public void testWriteConcernErrInfoIsPropagated() { */ @Test public void testWriteErrorDetailsIsPropagated() { - assumeTrue(serverVersionAtLeast(3, 2)); - getCollectionHelper().create(getCollectionName(), new CreateCollectionOptions() .validationOptions(new ValidationOptions() diff --git a/driver-sync/src/test/functional/com/mongodb/client/ReadConcernTest.java b/driver-sync/src/test/functional/com/mongodb/client/ReadConcernTest.java index 6521fa67010..4ab1d179611 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/ReadConcernTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/ReadConcernTest.java @@ -31,11 +31,9 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import static com.mongodb.ClusterFixture.serverVersionAtLeast; import static com.mongodb.client.CommandMonitoringTestHelper.assertEventsEquality; import static com.mongodb.client.Fixture.getDefaultDatabaseName; import static com.mongodb.client.Fixture.getMongoClientSettingsBuilder; -import static org.junit.Assume.assumeTrue; public class ReadConcernTest { private MongoClient mongoClient; @@ -43,8 +41,6 @@ public class ReadConcernTest { @Before public void setUp() { - assumeTrue(canRunTests()); - commandListener = new TestCommandListener(); mongoClient = MongoClients.create(getMongoClientSettingsBuilder() .addCommandListener(commandListener) @@ -73,8 +69,4 @@ public void shouldIncludeReadConcernInCommand() { assertEventsEquality(Arrays.asList(new CommandStartedEvent(null, 1, 1, null, getDefaultDatabaseName(), "find", commandDocument)), events); } - - private boolean canRunTests() { - return serverVersionAtLeast(3, 2); - } } diff --git a/driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java index e449fc628af..c4da13c1e81 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java @@ -261,6 +261,6 @@ private boolean canRunTests() { return ((isSharded() || isDiscoverableReplicaSet()) && storageEngine != null && storageEngine.get("name").equals("mmapv1") - && serverVersionAtLeast(3, 6) && serverVersionLessThan(4, 2)); + && serverVersionLessThan(4, 2)); } }