Skip to content

Commit 0d93f11

Browse files
committed
TBD: Sync spec tests for DRIVERS-2385 prototyping
1 parent b114c16 commit 0d93f11

File tree

5 files changed

+603
-2
lines changed

5 files changed

+603
-2
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"description": "modifyCollection-errorResponse",
3+
"schemaVersion": "1.12",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent"
10+
]
11+
}
12+
},
13+
{
14+
"database": {
15+
"id": "database0",
16+
"client": "client0",
17+
"databaseName": "collMod-tests"
18+
}
19+
},
20+
{
21+
"collection": {
22+
"id": "collection0",
23+
"database": "database0",
24+
"collectionName": "test"
25+
}
26+
}
27+
],
28+
"initialData": [
29+
{
30+
"collectionName": "test",
31+
"databaseName": "collMod-tests",
32+
"documents": [
33+
{
34+
"_id": 1,
35+
"x": 1
36+
},
37+
{
38+
"_id": 2,
39+
"x": 1
40+
}
41+
]
42+
}
43+
],
44+
"tests": [
45+
{
46+
"description": "modifyCollection prepareUnique violations are accessible",
47+
"runOnRequirements": [
48+
{
49+
"minServerVersion": "5.2"
50+
}
51+
],
52+
"operations": [
53+
{
54+
"name": "createIndex",
55+
"object": "collection0",
56+
"arguments": {
57+
"keys": {
58+
"x": 1
59+
}
60+
}
61+
},
62+
{
63+
"name": "modifyCollection",
64+
"object": "database0",
65+
"arguments": {
66+
"collection": "test",
67+
"index": {
68+
"keyPattern": {
69+
"x": 1
70+
},
71+
"prepareUnique": true
72+
}
73+
}
74+
},
75+
{
76+
"name": "insertOne",
77+
"object": "collection0",
78+
"arguments": {
79+
"document": {
80+
"_id": 3,
81+
"x": 1
82+
}
83+
},
84+
"expectError": {
85+
"errorCode": 11000
86+
}
87+
},
88+
{
89+
"name": "modifyCollection",
90+
"object": "database0",
91+
"arguments": {
92+
"collection": "test",
93+
"index": {
94+
"keyPattern": {
95+
"x": 1
96+
},
97+
"unique": true
98+
}
99+
},
100+
"expectError": {
101+
"isClientError": false,
102+
"errorCode": 359,
103+
"errorResponse": {
104+
"violations": [
105+
{
106+
"ids": [
107+
1,
108+
2
109+
]
110+
}
111+
]
112+
}
113+
}
114+
}
115+
]
116+
}
117+
]
118+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"description": "aggregate-merge-errorResponse",
3+
"schemaVersion": "1.12",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0"
8+
}
9+
},
10+
{
11+
"database": {
12+
"id": "database0",
13+
"client": "client0",
14+
"databaseName": "crud-tests"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "test"
22+
}
23+
}
24+
],
25+
"initialData": [
26+
{
27+
"collectionName": "test",
28+
"databaseName": "crud-tests",
29+
"documents": [
30+
{
31+
"_id": 1,
32+
"x": 1
33+
},
34+
{
35+
"_id": 2,
36+
"x": 1
37+
}
38+
]
39+
}
40+
],
41+
"tests": [
42+
{
43+
"description": "aggregate $merge DuplicateKey error is accessible",
44+
"runOnRequirements": [
45+
{
46+
"minServerVersion": "4.2"
47+
}
48+
],
49+
"operations": [
50+
{
51+
"name": "aggregate",
52+
"object": "database0",
53+
"arguments": {
54+
"pipeline": [
55+
{
56+
"$documents": [
57+
{
58+
"_id": 2,
59+
"x": 1
60+
}
61+
]
62+
},
63+
{
64+
"$merge": {
65+
"into": "test",
66+
"whenMatched": "fail"
67+
}
68+
}
69+
]
70+
},
71+
"expectError": {
72+
"errorCode": 11000,
73+
"errorResponse": {
74+
"keyPattern": {
75+
"_id": 1
76+
},
77+
"keyValue": {
78+
"_id": 2
79+
}
80+
}
81+
}
82+
}
83+
]
84+
}
85+
]
86+
}

tests/UnifiedSpecTests/crud/distinct-comment.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@
6464
"key": "value"
6565
}
6666
},
67-
"expectResult": [ 11, 22, 33 ]
67+
"expectResult": [
68+
11,
69+
22,
70+
33
71+
]
6872
}
6973
],
7074
"expectEvents": [
@@ -105,7 +109,11 @@
105109
"filter": {},
106110
"comment": "comment"
107111
},
108-
"expectResult": [ 11, 22, 33 ]
112+
"expectResult": [
113+
11,
114+
22,
115+
33
116+
]
109117
}
110118
],
111119
"expectEvents": [
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"description": "findOneAndUpdate-errorResponse",
3+
"schemaVersion": "1.12",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0"
8+
}
9+
},
10+
{
11+
"database": {
12+
"id": "database0",
13+
"client": "client0",
14+
"databaseName": "crud-tests"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "test"
22+
}
23+
}
24+
],
25+
"initialData": [
26+
{
27+
"collectionName": "test",
28+
"databaseName": "crud-tests",
29+
"documents": [
30+
{
31+
"_id": 1,
32+
"x": "foo"
33+
}
34+
]
35+
}
36+
],
37+
"tests": [
38+
{
39+
"description": "findOneAndUpdate DuplicateKey error is accessible",
40+
"runOnRequirements": [
41+
{
42+
"minServerVersion": "4.2"
43+
}
44+
],
45+
"operations": [
46+
{
47+
"name": "createIndex",
48+
"object": "collection0",
49+
"arguments": {
50+
"keys": {
51+
"x": 1
52+
},
53+
"unique": true
54+
}
55+
},
56+
{
57+
"name": "findOneAndUpdate",
58+
"object": "collection0",
59+
"arguments": {
60+
"filter": {
61+
"_id": 2
62+
},
63+
"update": {
64+
"$set": {
65+
"x": "foo"
66+
}
67+
},
68+
"upsert": true
69+
},
70+
"expectError": {
71+
"errorCode": 11000,
72+
"errorResponse": {
73+
"keyPattern": {
74+
"x": 1
75+
},
76+
"keyValue": {
77+
"x": "foo"
78+
}
79+
}
80+
}
81+
}
82+
]
83+
},
84+
{
85+
"description": "findOneAndUpdate document validation errInfo is accessible",
86+
"runOnRequirements": [
87+
{
88+
"minServerVersion": "5.0"
89+
}
90+
],
91+
"operations": [
92+
{
93+
"name": "modifyCollection",
94+
"object": "database0",
95+
"arguments": {
96+
"collection": "test",
97+
"validator": {
98+
"x": {
99+
"$type": "string"
100+
}
101+
}
102+
}
103+
},
104+
{
105+
"name": "findOneAndUpdate",
106+
"object": "collection0",
107+
"arguments": {
108+
"filter": {
109+
"_id": 1
110+
},
111+
"update": {
112+
"$set": {
113+
"x": 1
114+
}
115+
}
116+
},
117+
"expectError": {
118+
"errorCode": 121,
119+
"errorResponse": {
120+
"errInfo": {
121+
"failingDocumentId": 1,
122+
"details": {
123+
"$$type": "object"
124+
}
125+
}
126+
}
127+
}
128+
}
129+
]
130+
}
131+
]
132+
}

0 commit comments

Comments
 (0)