Skip to content

Commit a66f31f

Browse files
authored
PHPLIB-657: Skip incompatible unified tests and resync CRUD (#826)
* PHPLIB-657: Allow UnifiedSpecTest to mark incompatible tests as incomplete * PHPLIB-645: Sync unified CRUD tests This restores several missing tests and skips incompatible tests for unacknowledged writes using hint. The db-aggregate tests will also be skipped until schemaVersion 1.4 is implemented (serverless testing). Synced with mongodb/specifications@c06e4c0
1 parent 9839a79 commit a66f31f

13 files changed

+1831
-3
lines changed

tests/UnifiedSpecTests/UnifiedSpecTest.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use PHPUnit\Framework\SkippedTest;
99
use PHPUnit\Framework\Warning;
1010
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
11+
use function basename;
12+
use function dirname;
1113
use function glob;
1214

1315
/**
@@ -19,6 +21,31 @@ class UnifiedSpecTest extends FunctionalTestCase
1921
{
2022
use SetUpTearDownTrait;
2123

24+
/** @var array */
25+
private static $incompleteTests = [
26+
'crud/unacknowledged-bulkWrite-delete-hint-clientError: Unacknowledged bulkWrite deleteOne with hints fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
27+
'crud/unacknowledged-bulkWrite-delete-hint-clientError: Unacknowledged bulkWrite deleteMany with hints fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
28+
'crud/unacknowledged-bulkWrite-update-hint-clientError: Unacknowledged bulkWrite updateOne with hints fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
29+
'crud/unacknowledged-bulkWrite-update-hint-clientError: Unacknowledged bulkWrite updateMany with hints fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
30+
'crud/unacknowledged-bulkWrite-update-hint-clientError: Unacknowledged bulkWrite replaceOne with hints fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
31+
'crud/unacknowledged-deleteMany-hint-clientError: Unacknowledged deleteMany with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
32+
'crud/unacknowledged-deleteMany-hint-clientError: Unacknowledged deleteMany with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
33+
'crud/unacknowledged-deleteOne-hint-clientError: Unacknowledged deleteOne with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
34+
'crud/unacknowledged-deleteOne-hint-clientError: Unacknowledged deleteOne with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
35+
'crud/unacknowledged-findOneAndDelete-hint-clientError: Unacknowledged findOneAndDelete with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
36+
'crud/unacknowledged-findOneAndDelete-hint-clientError: Unacknowledged findOneAndDelete with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
37+
'crud/unacknowledged-findOneAndReplace-hint-clientError: Unacknowledged findOneAndReplace with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
38+
'crud/unacknowledged-findOneAndReplace-hint-clientError: Unacknowledged findOneAndReplace with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
39+
'crud/unacknowledged-findOneAndUpdate-hint-clientError: Unacknowledged findOneAndUpdate with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
40+
'crud/unacknowledged-findOneAndUpdate-hint-clientError: Unacknowledged findOneAndUpdate with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
41+
'crud/unacknowledged-replaceOne-hint-clientError: Unacknowledged ReplaceOne with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
42+
'crud/unacknowledged-replaceOne-hint-clientError: Unacknowledged ReplaceOne with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
43+
'crud/unacknowledged-updateMany-hint-clientError: Unacknowledged updateMany with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
44+
'crud/unacknowledged-updateMany-hint-clientError: Unacknowledged updateMany with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
45+
'crud/unacknowledged-updateOne-hint-clientError: Unacknowledged updateOne with hint string fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
46+
'crud/unacknowledged-updateOne-hint-clientError: Unacknowledged updateOne with hint document fails with client-side error' => 'PHPLIB-573 and DRIVERS-1340',
47+
];
48+
2249
/** @var UnifiedTestRunner */
2350
private static $runner;
2451

@@ -31,6 +58,15 @@ private static function doSetUpBeforeClass()
3158
self::$runner = new UnifiedTestRunner(static::getUri(true));
3259
}
3360

61+
private function doSetUp()
62+
{
63+
parent::setUp();
64+
65+
if (isset(self::$incompleteTests[$this->dataDescription()])) {
66+
$this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]);
67+
}
68+
}
69+
3470
/**
3571
* @dataProvider provideChangeStreamsTests
3672
*/
@@ -147,8 +183,10 @@ public function provideFailingTests()
147183
private function provideTests(string $pattern) : Generator
148184
{
149185
foreach (glob($pattern) as $filename) {
186+
$group = basename(dirname($filename));
187+
150188
foreach (UnifiedTestCase::fromFile($filename) as $name => $test) {
151-
yield $name => [$test];
189+
yield $group . '/' . $name => [$test];
152190
}
153191
}
154192
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
{
2+
"description": "aggregate",
3+
"schemaVersion": "1.0",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": true,
9+
"observeEvents": [
10+
"commandStartedEvent"
11+
]
12+
}
13+
},
14+
{
15+
"database": {
16+
"id": "database0",
17+
"client": "client0",
18+
"databaseName": "aggregate-tests"
19+
}
20+
},
21+
{
22+
"collection": {
23+
"id": "collection0",
24+
"database": "database0",
25+
"collectionName": "coll0"
26+
}
27+
}
28+
],
29+
"initialData": [
30+
{
31+
"collectionName": "coll0",
32+
"databaseName": "aggregate-tests",
33+
"documents": [
34+
{
35+
"_id": 1,
36+
"x": 11
37+
},
38+
{
39+
"_id": 2,
40+
"x": 22
41+
},
42+
{
43+
"_id": 3,
44+
"x": 33
45+
},
46+
{
47+
"_id": 4,
48+
"x": 44
49+
},
50+
{
51+
"_id": 5,
52+
"x": 55
53+
},
54+
{
55+
"_id": 6,
56+
"x": 66
57+
}
58+
]
59+
}
60+
],
61+
"tests": [
62+
{
63+
"description": "aggregate with multiple batches works",
64+
"operations": [
65+
{
66+
"name": "aggregate",
67+
"arguments": {
68+
"pipeline": [
69+
{
70+
"$match": {
71+
"_id": {
72+
"$gt": 1
73+
}
74+
}
75+
}
76+
],
77+
"batchSize": 2
78+
},
79+
"object": "collection0",
80+
"expectResult": [
81+
{
82+
"_id": 2,
83+
"x": 22
84+
},
85+
{
86+
"_id": 3,
87+
"x": 33
88+
},
89+
{
90+
"_id": 4,
91+
"x": 44
92+
},
93+
{
94+
"_id": 5,
95+
"x": 55
96+
},
97+
{
98+
"_id": 6,
99+
"x": 66
100+
}
101+
]
102+
}
103+
],
104+
"expectEvents": [
105+
{
106+
"client": "client0",
107+
"events": [
108+
{
109+
"commandStartedEvent": {
110+
"command": {
111+
"aggregate": "coll0",
112+
"pipeline": [
113+
{
114+
"$match": {
115+
"_id": {
116+
"$gt": 1
117+
}
118+
}
119+
}
120+
],
121+
"cursor": {
122+
"batchSize": 2
123+
}
124+
},
125+
"commandName": "aggregate",
126+
"databaseName": "aggregate-tests"
127+
}
128+
},
129+
{
130+
"commandStartedEvent": {
131+
"command": {
132+
"getMore": {
133+
"$$type": [
134+
"int",
135+
"long"
136+
]
137+
},
138+
"collection": "coll0",
139+
"batchSize": 2
140+
},
141+
"commandName": "getMore",
142+
"databaseName": "aggregate-tests"
143+
}
144+
},
145+
{
146+
"commandStartedEvent": {
147+
"command": {
148+
"getMore": {
149+
"$$type": [
150+
"int",
151+
"long"
152+
]
153+
},
154+
"collection": "coll0",
155+
"batchSize": 2
156+
},
157+
"commandName": "getMore",
158+
"databaseName": "aggregate-tests"
159+
}
160+
}
161+
]
162+
}
163+
]
164+
}
165+
]
166+
}

tests/UnifiedSpecTests/crud/db-aggregate.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "db-aggregate",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "3.6.0"
6+
"minServerVersion": "3.6.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

0 commit comments

Comments
 (0)