Skip to content

Commit a930353

Browse files
committed
Merge pull request #750
* sync-spec-tests: PHPLIB-551: Sync retryable write spec tests PHPLIB-555: Sync spec tests for array filters
2 parents ce6edcc + cb9d6f9 commit a930353

File tree

2 files changed

+215
-1
lines changed

2 files changed

+215
-1
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"runOn": [
3+
{
4+
"maxServerVersion": "3.5.5"
5+
}
6+
],
7+
"data": [
8+
{
9+
"_id": 1,
10+
"y": [
11+
{
12+
"b": 3
13+
},
14+
{
15+
"b": 1
16+
}
17+
]
18+
},
19+
{
20+
"_id": 2,
21+
"y": [
22+
{
23+
"b": 0
24+
},
25+
{
26+
"b": 1
27+
}
28+
]
29+
}
30+
],
31+
"tests": [
32+
{
33+
"description": "BulkWrite on server that doesn't support arrayFilters",
34+
"operations": [
35+
{
36+
"name": "bulkWrite",
37+
"arguments": {
38+
"requests": [
39+
{
40+
"name": "updateOne",
41+
"arguments": {
42+
"filter": {},
43+
"update": {
44+
"$set": {
45+
"y.0.b": 2
46+
}
47+
},
48+
"arrayFilters": [
49+
{
50+
"i.b": 1
51+
}
52+
]
53+
}
54+
}
55+
],
56+
"options": {
57+
"ordered": true
58+
}
59+
},
60+
"error": true
61+
}
62+
],
63+
"expectations": []
64+
},
65+
{
66+
"description": "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op",
67+
"operations": [
68+
{
69+
"name": "bulkWrite",
70+
"arguments": {
71+
"requests": [
72+
{
73+
"name": "updateOne",
74+
"arguments": {
75+
"filter": {},
76+
"update": {
77+
"$set": {
78+
"y.0.b": 2
79+
}
80+
}
81+
}
82+
},
83+
{
84+
"name": "updateMany",
85+
"arguments": {
86+
"filter": {},
87+
"update": {
88+
"$set": {
89+
"y.$[i].b": 2
90+
}
91+
},
92+
"arrayFilters": [
93+
{
94+
"i.b": 1
95+
}
96+
]
97+
}
98+
}
99+
],
100+
"options": {
101+
"ordered": true
102+
}
103+
},
104+
"error": true
105+
}
106+
],
107+
"expectations": []
108+
}
109+
]
110+
}

tests/SpecTests/transactions/error-labels.json

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
"TransientTransactionError"
135135
],
136136
"errorLabelsOmit": [
137+
"RetryableWriteError",
137138
"UnknownTransactionCommitResult"
138139
]
139140
}
@@ -223,6 +224,7 @@
223224
"TransientTransactionError"
224225
],
225226
"errorLabelsOmit": [
227+
"RetryableWriteError",
226228
"UnknownTransactionCommitResult"
227229
]
228230
}
@@ -312,6 +314,7 @@
312314
"TransientTransactionError"
313315
],
314316
"errorLabelsOmit": [
317+
"RetryableWriteError",
315318
"UnknownTransactionCommitResult"
316319
]
317320
}
@@ -462,7 +465,7 @@
462465
}
463466
},
464467
{
465-
"description": "add TransientTransactionError label to connection errors",
468+
"description": "add TransientTransactionError label to connection errors, but do not add RetryableWriteError label",
466469
"failPoint": {
467470
"configureFailPoint": "failCommand",
468471
"mode": {
@@ -497,6 +500,7 @@
497500
"TransientTransactionError"
498501
],
499502
"errorLabelsOmit": [
503+
"RetryableWriteError",
500504
"UnknownTransactionCommitResult"
501505
]
502506
}
@@ -512,6 +516,7 @@
512516
"TransientTransactionError"
513517
],
514518
"errorLabelsOmit": [
519+
"RetryableWriteError",
515520
"UnknownTransactionCommitResult"
516521
]
517522
}
@@ -534,6 +539,7 @@
534539
"TransientTransactionError"
535540
],
536541
"errorLabelsOmit": [
542+
"RetryableWriteError",
537543
"UnknownTransactionCommitResult"
538544
]
539545
}
@@ -550,6 +556,7 @@
550556
"TransientTransactionError"
551557
],
552558
"errorLabelsOmit": [
559+
"RetryableWriteError",
553560
"UnknownTransactionCommitResult"
554561
]
555562
}
@@ -1098,6 +1105,103 @@
10981105
}
10991106
}
11001107
},
1108+
{
1109+
"description": "do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction",
1110+
"failPoint": {
1111+
"configureFailPoint": "failCommand",
1112+
"mode": {
1113+
"times": 1
1114+
},
1115+
"data": {
1116+
"failCommands": [
1117+
"insert"
1118+
],
1119+
"writeConcernError": {
1120+
"code": 91,
1121+
"errmsg": "Replication is being shut down"
1122+
}
1123+
}
1124+
},
1125+
"operations": [
1126+
{
1127+
"name": "startTransaction",
1128+
"object": "session0",
1129+
"arguments": {
1130+
"options": {
1131+
"writeConcern": {
1132+
"w": "majority"
1133+
}
1134+
}
1135+
}
1136+
},
1137+
{
1138+
"name": "insertOne",
1139+
"object": "collection",
1140+
"arguments": {
1141+
"session": "session0",
1142+
"document": {
1143+
"_id": 1
1144+
}
1145+
},
1146+
"result": {
1147+
"errorLabelsContain": [],
1148+
"errorLabelsOmit": [
1149+
"RetryableWriteError",
1150+
"TransientTransactionError",
1151+
"UnknownTransactionCommitResult"
1152+
]
1153+
}
1154+
},
1155+
{
1156+
"name": "abortTransaction",
1157+
"object": "session0"
1158+
}
1159+
],
1160+
"expectations": [
1161+
{
1162+
"command_started_event": {
1163+
"command": {
1164+
"insert": "test",
1165+
"documents": [
1166+
{
1167+
"_id": 1
1168+
}
1169+
],
1170+
"ordered": true,
1171+
"readConcern": null,
1172+
"lsid": "session0",
1173+
"txnNumber": {
1174+
"$numberLong": "1"
1175+
},
1176+
"startTransaction": true,
1177+
"autocommit": false
1178+
},
1179+
"command_name": "insert",
1180+
"database_name": "transaction-tests"
1181+
}
1182+
},
1183+
{
1184+
"command_started_event": {
1185+
"command": {
1186+
"abortTransaction": 1,
1187+
"lsid": "session0",
1188+
"txnNumber": {
1189+
"$numberLong": "1"
1190+
},
1191+
"startTransaction": null,
1192+
"autocommit": false
1193+
},
1194+
"command_name": "abortTransaction",
1195+
"database_name": "admin"
1196+
}
1197+
}
1198+
],
1199+
"outcome": {
1200+
"collection": {
1201+
"data": []
1202+
}
1203+
}
1204+
},
11011205
{
11021206
"description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed",
11031207
"failPoint": {

0 commit comments

Comments
 (0)