Skip to content

Commit ffa9890

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

10 files changed

+756
-2
lines changed

tests/UnifiedSpecTests/UnifiedSpecTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ class UnifiedSpecTest extends FunctionalTestCase
6565
'valid-pass/createEntities-operation: createEntities operation' => 'CSOT is not yet implemented (PHPC-1760)',
6666
'valid-pass/entity-cursor-iterateOnce: iterateOnce' => 'CSOT is not yet implemented (PHPC-1760)',
6767
'valid-pass/matches-lte-operator: special lte matching operator' => 'CSOT is not yet implemented (PHPC-1760)',
68+
// BulkWriteException prevents access to server responses
69+
'crud/bulkWrite-errorResponse: bulkWrite operations support errorResponse assertions' => 'TBD',
70+
'crud/deleteOne-errorResponse: delete operations support errorResponse assertions' => 'TBD',
71+
'crud/insertOne-errorResponse: insert operations support errorResponse assertions' => 'TBD',
72+
'crud/updateOne-errorResponse: update operations support errorResponse assertions' => 'TBD',
6873
];
6974

7075
/** @var UnifiedTestRunner */
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": "5.1"
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+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"description": "bulkWrite-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+
"tests": [
26+
{
27+
"description": "bulkWrite operations support errorResponse assertions",
28+
"runOnRequirements": [
29+
{
30+
"minServerVersion": "4.0.0",
31+
"topologies": [
32+
"single",
33+
"replicaset"
34+
]
35+
},
36+
{
37+
"minServerVersion": "4.2.0",
38+
"topologies": [
39+
"sharded"
40+
]
41+
}
42+
],
43+
"operations": [
44+
{
45+
"name": "failPoint",
46+
"object": "testRunner",
47+
"arguments": {
48+
"client": "client0",
49+
"failPoint": {
50+
"configureFailPoint": "failCommand",
51+
"mode": {
52+
"times": 1
53+
},
54+
"data": {
55+
"failCommands": [
56+
"insert"
57+
],
58+
"errorCode": 8
59+
}
60+
}
61+
}
62+
},
63+
{
64+
"name": "bulkWrite",
65+
"object": "collection0",
66+
"arguments": {
67+
"requests": [
68+
{
69+
"insertOne": {
70+
"document": {
71+
"_id": 1
72+
}
73+
}
74+
}
75+
]
76+
},
77+
"expectError": {
78+
"errorCode": 8,
79+
"errorResponse": {
80+
"code": 8
81+
}
82+
}
83+
}
84+
]
85+
}
86+
]
87+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"description": "deleteOne-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+
"tests": [
26+
{
27+
"description": "delete operations support errorResponse assertions",
28+
"runOnRequirements": [
29+
{
30+
"minServerVersion": "4.0.0",
31+
"topologies": [
32+
"single",
33+
"replicaset"
34+
]
35+
},
36+
{
37+
"minServerVersion": "4.2.0",
38+
"topologies": [
39+
"sharded"
40+
]
41+
}
42+
],
43+
"operations": [
44+
{
45+
"name": "failPoint",
46+
"object": "testRunner",
47+
"arguments": {
48+
"client": "client0",
49+
"failPoint": {
50+
"configureFailPoint": "failCommand",
51+
"mode": {
52+
"times": 1
53+
},
54+
"data": {
55+
"failCommands": [
56+
"delete"
57+
],
58+
"errorCode": 8
59+
}
60+
}
61+
}
62+
},
63+
{
64+
"name": "deleteOne",
65+
"object": "collection0",
66+
"arguments": {
67+
"filter": {
68+
"_id": 1
69+
}
70+
},
71+
"expectError": {
72+
"errorCode": 8,
73+
"errorResponse": {
74+
"code": 8
75+
}
76+
}
77+
}
78+
]
79+
}
80+
]
81+
}

0 commit comments

Comments
 (0)