Skip to content

Commit 6494093

Browse files
committed
minor: sync versioned api spec tests
1 parent 0068b92 commit 6494093

14 files changed

+1816
-116
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
===================
2+
Versioned API Tests
3+
===================
4+
5+
.. contents::
6+
7+
----
8+
9+
Notes
10+
=====
11+
12+
This directory contains tests for the Versioned API specification. They are
13+
implemented in the `Unified Test Format <../../unified-test-format/unified-test-format.rst>`__,
14+
and require schema version 1.1. Note that to run these tests, the server must be
15+
started with both ``enableTestCommands`` and ``acceptAPIVersion2`` parameters
16+
set to true.
17+
18+
Testing with required API version
19+
=================================
20+
21+
Drivers MUST run their test suite against a cluster with the
22+
``requireApiVersion`` parameter enabled and also requires authentication.
23+
24+
To run this test, proceed as follows:
25+
- Start a standalone mongod instance
26+
27+
- Connect to the standalone instance and run the following command on the
28+
``admin`` database: ``{ setParameter: 1, requireApiVersion: true }``
29+
30+
- Declare an API version for the test run through the ``MONGODB_API_VERSION``
31+
environment variable.
32+
33+
- If the environment variable is set, all clients created in tests MUST declare
34+
the ``ServerApiVersion`` specified.
35+
36+
No other topologies must be tested until ``mongo-orchestration`` can handle
37+
servers with ``requireApiVersion`` enabled.

src/test/spec/json/versioned-api/crud-api-version-1-strict.json

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"schemaVersion": "1.1",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "4.7"
6+
"minServerVersion": "4.9"
77
}
88
],
99
"createEntities": [
@@ -154,6 +154,9 @@
154154
"$limit": 1
155155
}
156156
]
157+
},
158+
"expectError": {
159+
"errorCodeName": "APIStrictError"
157160
}
158161
}
159162
],
@@ -298,6 +301,12 @@
298301
"$inc": {
299302
"x": 1
300303
}
304+
},
305+
"multi": {
306+
"$$unsetOrMatches": false
307+
},
308+
"upsert": {
309+
"$$unsetOrMatches": false
301310
}
302311
}
303312
],
@@ -350,7 +359,10 @@
350359
"x": 1
351360
}
352361
},
353-
"multi": true
362+
"multi": true,
363+
"upsert": {
364+
"$$unsetOrMatches": false
365+
}
354366
}
355367
],
356368
"apiVersion": "1",
@@ -394,6 +406,9 @@
394406
"_id": 4,
395407
"x": 44
396408
},
409+
"multi": {
410+
"$$unsetOrMatches": false
411+
},
397412
"upsert": true
398413
}
399414
],
@@ -607,7 +622,22 @@
607622
{
608623
"commandStartedEvent": {
609624
"command": {
610-
"count": "test",
625+
"aggregate": "test",
626+
"pipeline": [
627+
{
628+
"$collStats": {
629+
"count": {}
630+
}
631+
},
632+
{
633+
"$group": {
634+
"_id": 1,
635+
"n": {
636+
"$sum": "$count"
637+
}
638+
}
639+
}
640+
],
611641
"apiVersion": "1",
612642
"apiStrict": true,
613643
"apiDeprecationErrors": {
@@ -948,6 +978,9 @@
948978
"_id": 4,
949979
"x": 44
950980
},
981+
"multi": {
982+
"$$unsetOrMatches": false
983+
},
951984
"upsert": true
952985
}
953986
],
@@ -1003,7 +1036,10 @@
10031036
"x": 1
10041037
}
10051038
},
1006-
"multi": true
1039+
"multi": true,
1040+
"upsert": {
1041+
"$$unsetOrMatches": false
1042+
}
10071043
}
10081044
],
10091045
"apiVersion": "1",
@@ -1053,6 +1089,12 @@
10531089
"$inc": {
10541090
"x": 1
10551091
}
1092+
},
1093+
"multi": {
1094+
"$$unsetOrMatches": false
1095+
},
1096+
"upsert": {
1097+
"$$unsetOrMatches": false
10561098
}
10571099
}
10581100
],

0 commit comments

Comments
 (0)