Skip to content

Commit 9871a01

Browse files
committed
Simplify test assumptions for 4.2 minimum server support
1 parent 0cd2c2e commit 9871a01

File tree

52 files changed

+88
-1228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+88
-1228
lines changed

driver-core/src/test/functional/com/mongodb/client/model/AggregatesFunctionalSpecification.groovy

-22
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
144144
new Document('_id', 3).append('x', 3).append('c', 'c')]
145145
}
146146

147-
@IgnoreIf({ serverVersionLessThan(3, 4) })
148147
def '$project an exclusion'() {
149148
expect:
150149
aggregate([project(exclude('a', 'a1', 'z', 'o'))]) == [new Document('_id', 1).append('x', 1).append('y', 'a'),
@@ -178,7 +177,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
178177
new Document('a', 6)]
179178
}
180179

181-
@IgnoreIf({ serverVersionLessThan(3, 2) })
182180
def '$unwind with UnwindOptions'() {
183181
given:
184182
getCollectionHelper().drop()
@@ -226,7 +224,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
226224
new Document('_id', false).append('acc', [false])])
227225
}
228226

229-
@IgnoreIf({ serverVersionLessThan(3, 6) })
230227
def '$group with $mergeObjects'() {
231228
aggregate([group(null, mergeObjects('acc', '$o'))]).containsAll(
232229
[new Document('_id', null).append('acc', new Document('a', 1).append('b', 2).append('c', 3))])
@@ -322,7 +319,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
322319
getCollectionHelper(new MongoNamespace(outDatabaseName, outCollectionName)).find() == [a, b, c]
323320
}
324321

325-
@IgnoreIf({ serverVersionLessThan(4, 2) })
326322
def '$merge'() {
327323
given:
328324
def outCollectionName = getCollectionName() + '.out'
@@ -408,7 +404,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
408404
getCollectionHelper(new MongoNamespace(getDatabaseName(), outCollectionName)).find() == [a, b, c]
409405
}
410406

411-
@IgnoreIf({ serverVersionLessThan(3, 2) })
412407
def '$stdDev'() {
413408
when:
414409
def results = aggregate([group(null, stdDevPop('stdDevPop', '$x'), stdDevSamp('stdDevSamp', '$x'))]).first()
@@ -420,14 +415,12 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
420415
results.get('stdDevSamp') == 1.0
421416
}
422417

423-
@IgnoreIf({ serverVersionLessThan(3, 2) })
424418
def '$sample'() {
425419
expect:
426420
containsAny([a, b, c], aggregate([sample(1)]).first())
427421
}
428422

429423

430-
@IgnoreIf({ serverVersionLessThan(3, 2) })
431424
def '$lookup'() {
432425
given:
433426
def fromCollectionName = 'lookupCollection'
@@ -455,7 +448,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
455448
fromHelper?.drop()
456449
}
457450

458-
@IgnoreIf({ serverVersionLessThan(3, 6) })
459451
def '$lookup with pipeline'() {
460452
given:
461453
def fromCollectionName = 'warehouses'
@@ -500,7 +492,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
500492
fromHelper?.drop()
501493
}
502494

503-
@IgnoreIf({ serverVersionLessThan(3, 6) })
504495
def '$lookup with pipeline without variables'() {
505496
given:
506497
def fromCollectionName = 'holidays'
@@ -555,7 +546,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
555546
fromCollection?.drop()
556547
}
557548

558-
@IgnoreIf({ serverVersionLessThan(3, 4) })
559549
def '$facet'() {
560550
given:
561551
def helper = getCollectionHelper()
@@ -612,7 +602,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
612602
helper?.drop()
613603
}
614604

615-
@IgnoreIf({ serverVersionLessThan(3, 4) })
616605
def '$graphLookup'() {
617606
given:
618607
def fromCollectionName = 'contacts'
@@ -651,7 +640,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
651640
fromHelper?.drop()
652641
}
653642

654-
@IgnoreIf({ serverVersionLessThan(3, 4) })
655643
def '$graphLookup with depth options'() {
656644
given:
657645
def fromCollectionName = 'contacts'
@@ -692,7 +680,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
692680
fromHelper?.drop()
693681
}
694682

695-
@IgnoreIf({ serverVersionLessThan(3, 4) })
696683
def '$graphLookup with query filter option'() {
697684
given:
698685
def fromCollectionName = 'contacts'
@@ -743,7 +730,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
743730
fromHelper?.drop()
744731
}
745732

746-
@IgnoreIf({ serverVersionLessThan(3, 4) })
747733
def '$bucket'() {
748734
given:
749735
def helper = getCollectionHelper()
@@ -777,7 +763,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
777763
helper?.drop()
778764
}
779765

780-
@IgnoreIf({ serverVersionLessThan(3, 4) })
781766
def '$bucketAuto'() {
782767
given:
783768
def helper = getCollectionHelper()
@@ -811,7 +796,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
811796
helper?.drop()
812797
}
813798

814-
@IgnoreIf({ serverVersionLessThan(3, 4) })
815799
def '$bucketAuto with options'() {
816800
given:
817801
def helper = getCollectionHelper()
@@ -837,7 +821,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
837821
helper?.drop()
838822
}
839823

840-
@IgnoreIf({ serverVersionLessThan(3, 4) })
841824
def '$count'() {
842825
given:
843826
def helper = getCollectionHelper()
@@ -873,7 +856,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
873856
helper?.drop()
874857
}
875858

876-
@IgnoreIf({ serverVersionLessThan(3, 4) })
877859
def '$sortByCount'() {
878860
given:
879861
def helper = getCollectionHelper()
@@ -952,7 +934,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
952934
helper?.drop()
953935
}
954936

955-
@IgnoreIf({ serverVersionLessThan(3, 4) })
956937
def '$addFields'() {
957938
given:
958939
def helper = getCollectionHelper()
@@ -1026,15 +1007,13 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
10261007
helper?.drop()
10271008
}
10281009

1029-
@IgnoreIf({ serverVersionLessThan(4, 2) })
10301010
def '$set'() {
10311011
expect:
10321012
aggregate([set(new Field('c', '$y'))]) == [new Document(a).append('c', 'a'),
10331013
new Document(b).append('c', 'b'),
10341014
new Document(c).append('c', 'c')]
10351015
}
10361016

1037-
@IgnoreIf({ serverVersionLessThan(3, 4) })
10381017
def '$replaceRoot'() {
10391018
given:
10401019
def helper = getCollectionHelper()
@@ -1065,7 +1044,6 @@ class AggregatesFunctionalSpecification extends OperationFunctionalSpecification
10651044
results == [Document.parse('{b: 1, _id: 7}')]
10661045
}
10671046

1068-
@IgnoreIf({ serverVersionLessThan(4, 2) })
10691047
def '$replaceWith'() {
10701048
given:
10711049
def helper = getCollectionHelper()

driver-core/src/test/functional/com/mongodb/client/model/FiltersFunctionalSpecification.groovy

-10
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ import com.mongodb.OperationFunctionalSpecification
2121
import org.bson.BsonType
2222
import org.bson.Document
2323
import org.bson.conversions.Bson
24-
import spock.lang.IgnoreIf
2524

2625
import java.util.regex.Pattern
2726

28-
import static com.mongodb.ClusterFixture.serverVersionLessThan
2927
import static com.mongodb.client.model.Filters.all
3028
import static com.mongodb.client.model.Filters.and
3129
import static com.mongodb.client.model.Filters.bitsAllClear
@@ -228,7 +226,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
228226
find(size('a', 4)) == [b]
229227
}
230228

231-
@IgnoreIf({ serverVersionLessThan(3, 2) })
232229
def 'should render $bitsAllClear'() {
233230
when:
234231
def bitDoc = Document.parse('{_id: 1, bits: 20}')
@@ -239,7 +236,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
239236
find(bitsAllClear('bits', 35)) == [bitDoc]
240237
}
241238

242-
@IgnoreIf({ serverVersionLessThan(3, 2) })
243239
def 'should render $bitsAllSet'() {
244240
when:
245241
def bitDoc = Document.parse('{_id: 1, bits: 54}')
@@ -250,7 +246,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
250246
find(bitsAllSet('bits', 50)) == [bitDoc]
251247
}
252248

253-
@IgnoreIf({ serverVersionLessThan(3, 2) })
254249
def 'should render $bitsAnyClear'() {
255250
when:
256251
def bitDoc = Document.parse('{_id: 1, bits: 50}')
@@ -261,7 +256,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
261256
find(bitsAnyClear('bits', 20)) == [bitDoc]
262257
}
263258

264-
@IgnoreIf({ serverVersionLessThan(3, 2) })
265259
def 'should render $bitsAnySet'() {
266260
when:
267261
def bitDoc = Document.parse('{_id: 1, bits: 20}')
@@ -278,7 +272,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
278272
find(type('x', BsonType.ARRAY)) == []
279273
}
280274

281-
@IgnoreIf({ serverVersionLessThan(3, 2) })
282275
def 'should render $type with a string type representation'() {
283276
expect:
284277
find(type('x', 'number')) == [a, b, c]
@@ -299,7 +292,6 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
299292
find(text('GIANT', new TextSearchOptions().language('english'))) == [textDocument]
300293
}
301294

302-
@IgnoreIf({ serverVersionLessThan(3, 2) })
303295
def 'should render $text with 3.2 options'() {
304296
given:
305297
collectionHelper.drop()
@@ -331,14 +323,12 @@ class FiltersFunctionalSpecification extends OperationFunctionalSpecification {
331323
find(where('Array.isArray(this.a)')) == [a, b]
332324
}
333325

334-
@IgnoreIf({ serverVersionLessThan(3, 6) })
335326
def '$expr'() {
336327
expect:
337328
find(expr(Document.parse('{ $eq: [ "$x" , 3 ] } '))) == [c]
338329
}
339330

340331

341-
@IgnoreIf({ serverVersionLessThan(3, 6) })
342332
def '$jsonSchema'() {
343333
expect:
344334
find(jsonSchema(Document.parse('{ bsonType : "object", properties: { x : {type : "number", minimum : 2} } } '))) == [b, c]

driver-core/src/test/functional/com/mongodb/client/model/mql/TypeMqlValuesFunctionalTest.java

-5
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ public void isMapOrTest() {
173173

174174
@Test
175175
public void asStringTest() {
176-
assumeTrue(serverVersionAtLeast(4, 0));
177176
// https://www.mongodb.com/docs/manual/reference/operator/aggregation/toString/
178177
// asString, since toString conflicts
179178
assertExpression("false", of(false).asString(), "{'$toString': [false]}");
@@ -199,7 +198,6 @@ public void asStringTest() {
199198

200199
@Test
201200
public void dateAsStringTest() {
202-
assumeTrue(serverVersionAtLeast(4, 0));
203201
// https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/
204202
final Instant instant = Instant.parse("2007-12-03T10:15:30.005Z");
205203
MqlDate date = of(instant);
@@ -231,7 +229,6 @@ public void dateAsStringTest() {
231229

232230
@Test
233231
public void parseDateTest() {
234-
assumeTrue(serverVersionAtLeast(4, 0));
235232
// https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/
236233
String dateString = "2007-12-03T10:15:30.005Z";
237234
assertExpression(
@@ -270,7 +267,6 @@ public void parseDateTest() {
270267

271268
@Test
272269
public void parseIntegerTest() {
273-
assumeTrue(serverVersionAtLeast(4, 0));
274270
// https://www.mongodb.com/docs/manual/reference/operator/aggregation/toInt/
275271
// https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLong/
276272
assertExpression(
@@ -310,7 +306,6 @@ public void parseIntegerTest() {
310306

311307
@Test
312308
public void millisecondsToDateTest() {
313-
assumeTrue(serverVersionAtLeast(4, 0));
314309
// https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDate/
315310
assertExpression(
316311
Instant.ofEpochMilli(1234),

0 commit comments

Comments
 (0)