Skip to content

Commit e52d3a8

Browse files
committed
PHPLIB-1132: Sync unified spec tests for revised runOnRequirements
Synced to mongodb/specifications@474ddfc
1 parent a86a1f6 commit e52d3a8

25 files changed

+2637
-37
lines changed

tests/UnifiedSpecTests/UnifiedSpecTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ public function provideLoadBalancers()
168168
return $this->provideTests(__DIR__ . '/load-balancers/*.json');
169169
}
170170

171+
/** @dataProvider provideRetryableWritesTests */
172+
public function testRetryableWrites(UnifiedTestCase $test): void
173+
{
174+
self::$runner->run($test);
175+
}
176+
177+
public function provideRetryableWritesTests()
178+
{
179+
return $this->provideTests(__DIR__ . '/retryable-writes/*.json');
180+
}
181+
171182
/** @dataProvider provideSessionsTests */
172183
public function testSessions(UnifiedTestCase $test): void
173184
{

tests/UnifiedSpecTests/change-streams/change-streams-clusterTime.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"minServerVersion": "4.0.0",
2929
"topologies": [
3030
"replicaset",
31-
"sharded-replicaset",
3231
"load-balanced",
3332
"sharded"
3433
],

tests/UnifiedSpecTests/change-streams/change-streams-disambiguatedPaths.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"minServerVersion": "6.1.0",
2929
"topologies": [
3030
"replicaset",
31-
"sharded-replicaset",
3231
"load-balanced",
3332
"sharded"
3433
],

tests/UnifiedSpecTests/change-streams/change-streams-errors.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"minServerVersion": "4.1.11",
146146
"topologies": [
147147
"replicaset",
148-
"sharded-replicaset",
148+
"sharded",
149149
"load-balanced"
150150
]
151151
}
@@ -190,7 +190,7 @@
190190
"minServerVersion": "4.2",
191191
"topologies": [
192192
"replicaset",
193-
"sharded-replicaset",
193+
"sharded",
194194
"load-balanced"
195195
]
196196
}

tests/UnifiedSpecTests/change-streams/change-streams-pre_and_post_images.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"minServerVersion": "6.0.0",
77
"topologies": [
88
"replicaset",
9-
"sharded-replicaset",
9+
"sharded",
1010
"load-balanced"
1111
],
1212
"serverless": "forbid"

tests/UnifiedSpecTests/change-streams/change-streams-resume-allowlist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"minServerVersion": "3.6",
77
"topologies": [
88
"replicaset",
9-
"sharded-replicaset",
9+
"sharded",
1010
"load-balanced"
1111
],
1212
"serverless": "forbid"

tests/UnifiedSpecTests/change-streams/change-streams-resume-errorLabels.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"minServerVersion": "4.3.1",
77
"topologies": [
88
"replicaset",
9-
"sharded-replicaset",
9+
"sharded",
1010
"load-balanced"
1111
],
1212
"serverless": "forbid"

tests/UnifiedSpecTests/change-streams/change-streams-showExpandedEvents.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"minServerVersion": "6.0.0",
77
"topologies": [
88
"replicaset",
9-
"sharded-replicaset",
109
"sharded"
1110
],
1211
"serverless": "forbid"
@@ -463,7 +462,6 @@
463462
"runOnRequirements": [
464463
{
465464
"topologies": [
466-
"sharded-replicaset",
467465
"sharded"
468466
]
469467
}
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
{
2+
"description": "retryable-writes bulkWrite serverErrors",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "3.6",
7+
"topologies": [
8+
"replicaset"
9+
]
10+
}
11+
],
12+
"createEntities": [
13+
{
14+
"client": {
15+
"id": "client0",
16+
"useMultipleMongoses": false,
17+
"observeEvents": [
18+
"commandStartedEvent"
19+
]
20+
}
21+
},
22+
{
23+
"database": {
24+
"id": "database0",
25+
"client": "client0",
26+
"databaseName": "retryable-writes-tests"
27+
}
28+
},
29+
{
30+
"collection": {
31+
"id": "collection0",
32+
"database": "database0",
33+
"collectionName": "coll"
34+
}
35+
}
36+
],
37+
"initialData": [
38+
{
39+
"collectionName": "coll",
40+
"databaseName": "retryable-writes-tests",
41+
"documents": [
42+
{
43+
"_id": 1,
44+
"x": 11
45+
},
46+
{
47+
"_id": 2,
48+
"x": 22
49+
}
50+
]
51+
}
52+
],
53+
"tests": [
54+
{
55+
"description": "BulkWrite succeeds after retryable writeConcernError in first batch",
56+
"runOnRequirements": [
57+
{
58+
"minServerVersion": "4.0",
59+
"topologies": [
60+
"replicaset"
61+
]
62+
},
63+
{
64+
"minServerVersion": "4.1.7",
65+
"topologies": [
66+
"sharded"
67+
]
68+
}
69+
],
70+
"operations": [
71+
{
72+
"name": "failPoint",
73+
"object": "testRunner",
74+
"arguments": {
75+
"client": "client0",
76+
"failPoint": {
77+
"configureFailPoint": "failCommand",
78+
"mode": {
79+
"times": 1
80+
},
81+
"data": {
82+
"failCommands": [
83+
"insert"
84+
],
85+
"errorLabels": [
86+
"RetryableWriteError"
87+
],
88+
"writeConcernError": {
89+
"code": 91,
90+
"errmsg": "Replication is being shut down"
91+
}
92+
}
93+
}
94+
}
95+
},
96+
{
97+
"name": "bulkWrite",
98+
"object": "collection0",
99+
"arguments": {
100+
"requests": [
101+
{
102+
"insertOne": {
103+
"document": {
104+
"_id": 3,
105+
"x": 33
106+
}
107+
}
108+
},
109+
{
110+
"deleteOne": {
111+
"filter": {
112+
"_id": 2
113+
}
114+
}
115+
}
116+
]
117+
},
118+
"expectResult": {
119+
"deletedCount": 1,
120+
"insertedCount": 1,
121+
"matchedCount": 0,
122+
"modifiedCount": 0,
123+
"upsertedCount": 0,
124+
"insertedIds": {
125+
"$$unsetOrMatches": {
126+
"0": 3
127+
}
128+
},
129+
"upsertedIds": {}
130+
}
131+
}
132+
],
133+
"expectEvents": [
134+
{
135+
"client": "client0",
136+
"events": [
137+
{
138+
"commandStartedEvent": {
139+
"command": {
140+
"insert": "coll",
141+
"documents": [
142+
{
143+
"_id": 3,
144+
"x": 33
145+
}
146+
]
147+
},
148+
"commandName": "insert",
149+
"databaseName": "retryable-writes-tests"
150+
}
151+
},
152+
{
153+
"commandStartedEvent": {
154+
"command": {
155+
"insert": "coll",
156+
"documents": [
157+
{
158+
"_id": 3,
159+
"x": 33
160+
}
161+
]
162+
},
163+
"commandName": "insert",
164+
"databaseName": "retryable-writes-tests"
165+
}
166+
},
167+
{
168+
"commandStartedEvent": {
169+
"command": {
170+
"delete": "coll",
171+
"deletes": [
172+
{
173+
"q": {
174+
"_id": 2
175+
},
176+
"limit": 1
177+
}
178+
]
179+
},
180+
"commandName": "delete",
181+
"databaseName": "retryable-writes-tests"
182+
}
183+
}
184+
]
185+
}
186+
],
187+
"outcome": [
188+
{
189+
"collectionName": "coll",
190+
"databaseName": "retryable-writes-tests",
191+
"documents": [
192+
{
193+
"_id": 1,
194+
"x": 11
195+
},
196+
{
197+
"_id": 3,
198+
"x": 33
199+
}
200+
]
201+
}
202+
]
203+
}
204+
]
205+
}

0 commit comments

Comments
 (0)