Skip to content

Commit a172874

Browse files
committed
Disable maxScan tests when server version >= 4.1
MongoDB 4.2 will remove support for the maxScan option to the find command, so the driver's integration tests of maxScan must be ignored when the server version is 4.1 or higher.
1 parent f77e7b5 commit a172874

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ class FindOperationSpecification extends OperationFunctionalSpecification {
389389
async << [true, false]
390390
}
391391

392+
@IgnoreIf({ serverVersionAtLeast(4, 1) })
392393
def '$maxScan should limit items returned'() {
393394
given:
394395
(1..100).each {

driver-legacy/src/test/functional/com/mongodb/DBCursorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import static org.junit.Assert.assertThat;
4040
import static org.junit.Assert.assertTrue;
4141
import static org.junit.Assert.fail;
42+
import static org.junit.Assume.assumeFalse;
4243
import static org.junit.Assume.assumeThat;
4344
import static org.junit.Assume.assumeTrue;
4445

@@ -311,6 +312,7 @@ public void testConstructor() {
311312
@Test
312313
@SuppressWarnings("deprecation")
313314
public void testMaxScan() {
315+
assumeFalse(serverVersionAtLeast(4, 1));
314316
countResults(new DBCursor(collection, new BasicDBObject(), new BasicDBObject(), ReadPreference.primary())
315317
.addSpecial("$maxScan", 4), 4);
316318
countResults(new DBCursor(collection, new BasicDBObject(), new BasicDBObject(), ReadPreference.primary()).maxScan(4), 4);

0 commit comments

Comments
 (0)