Skip to content

Commit 97cda7b

Browse files
committed
Removed Slow test Category from some tests that aren't really all that slow, and sped up some slow tests by using bulk inserts.
1 parent 34182eb commit 97cda7b

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

bson/src/test/unit/org/bson/GenericBsonTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818

1919
package org.bson;
2020

21-
import category.Slow;
2221
import org.bson.codecs.BsonDocumentCodec;
2322
import org.bson.codecs.DecoderContext;
2423
import org.bson.codecs.EncoderContext;
2524
import org.bson.io.BasicOutputBuffer;
2625
import org.junit.Test;
27-
import org.junit.experimental.categories.Category;
2826
import org.junit.runner.RunWith;
2927
import org.junit.runners.Parameterized;
3028
import util.JsonPoweredTestHelper;
@@ -52,7 +50,6 @@ public GenericBsonTest(final String description, final BsonDocument definition)
5250
}
5351

5452
@Test
55-
@Category(Slow.class)
5653
public void shouldPassAllOutcomes() {
5754
for (BsonValue curValue : definition.getArray("documents")) {
5855
BsonDocument curDocument = curValue.asDocument();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class CommandOperationSpecification extends OperationFunctionalSpecification {
6464

6565
}
6666

67-
@Category(Slow)
6867
def 'should execute write command'() {
6968
when:
7069
def result = new CommandWriteOperation<BsonDocument>(getNamespace().databaseName,

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,7 @@ class FindOperationSpecification extends OperationFunctionalSpecification {
520520
@IgnoreIf({ isSharded() })
521521
def 'should iterate asynchronously'() {
522522
given:
523-
(1..500).each {
524-
collectionHelper.insertDocuments(new DocumentCodec(), new Document('_id', it))
525-
}
523+
collectionHelper.insertDocuments(new DocumentCodec(), (1..500).collect { new Document('_id', it) })
526524
def findOperation = new FindOperation<Document>(getNamespace(), new DocumentCodec())
527525

528526
when:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ class ParallelCollectionScanOperationSpecification extends OperationFunctionalSp
6060
def 'setup'() {
6161
(1..2000).each {
6262
ids.put(it, true)
63-
getCollectionHelper().insertDocuments(new DocumentCodec(), new Document('_id', it))
6463
}
64+
65+
getCollectionHelper().insertDocuments(new DocumentCodec(), (1..2000).collect( { new Document('_id', it) } ))
6566
}
6667

6768

driver/src/test/functional/com/mongodb/DBCollectionTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ public void testCount() {
333333
}
334334

335335
@Test
336-
@Category(Slow.class)
337336
public void testUpdateWithDBEncoder() {
338337
DBObject document = new BasicDBObject("_id", 1).append("x", 1);
339338
collection.insert(document);
@@ -963,12 +962,15 @@ public void testParallelScan() throws UnknownHostException {
963962
assumeThat(serverVersionAtLeast(asList(2, 6, 0)), is(true));
964963

965964
Set<Integer> ids = new HashSet<Integer>();
965+
List<BasicDBObject> documents = new ArrayList<BasicDBObject>(2000);
966966

967967
for (int i = 0; i < 2000; i++) {
968968
ids.add(i);
969-
collection.insert(new BasicDBObject("_id", i));
969+
documents.add(new BasicDBObject("_id", i));
970970
}
971971

972+
collection.insert(documents);
973+
972974
List<Cursor> cursors = collection.parallelScan(ParallelScanOptions.builder().numCursors(3).batchSize(1000).build());
973975
assertTrue(cursors.size() <= 3);
974976
for (Cursor cursor : cursors) {

0 commit comments

Comments
 (0)