Skip to content

Commit 1fd90b7

Browse files
committed
test: sync latest spec tests
1 parent b2bad87 commit 1fd90b7

File tree

7 files changed

+116
-38
lines changed

7 files changed

+116
-38
lines changed

test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ const enabled = [
88
'override-database-timeoutMS',
99
'override-operation-timeoutMS',
1010
'retryability-legacy-timeouts',
11-
'retryability-timeoutMS'
11+
'retryability-timeoutMS',
12+
'sessions-override-operation-timeoutMS',
13+
'sessions-override-timeoutMS',
14+
'sessions-inherit-timeoutMS'
1215
];
1316

1417
const cursorOperations = [

test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"client": {
2222
"id": "client",
2323
"uriOptions": {
24-
"timeoutMS": 50
24+
"timeoutMS": 500
2525
},
2626
"useMultipleMongoses": false,
2727
"observeEvents": [
@@ -78,7 +78,7 @@
7878
"commitTransaction"
7979
],
8080
"blockConnection": true,
81-
"blockTimeMS": 60
81+
"blockTimeMS": 600
8282
}
8383
}
8484
}
@@ -165,7 +165,7 @@
165165
"abortTransaction"
166166
],
167167
"blockConnection": true,
168-
"blockTimeMS": 60
168+
"blockTimeMS": 600
169169
}
170170
}
171171
}
@@ -249,7 +249,7 @@
249249
"insert"
250250
],
251251
"blockConnection": true,
252-
"blockTimeMS": 60
252+
"blockTimeMS": 600
253253
}
254254
}
255255
}
@@ -302,6 +302,26 @@
302302
"commandFailedEvent": {
303303
"commandName": "insert"
304304
}
305+
},
306+
{
307+
"commandStartedEvent": {
308+
"commandName": "abortTransaction",
309+
"databaseName": "admin",
310+
"command": {
311+
"abortTransaction": 1,
312+
"maxTimeMS": {
313+
"$$type": [
314+
"int",
315+
"long"
316+
]
317+
}
318+
}
319+
}
320+
},
321+
{
322+
"commandFailedEvent": {
323+
"commandName": "abortTransaction"
324+
}
305325
}
306326
]
307327
}

test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ createEntities:
1313
- client:
1414
id: &client client
1515
uriOptions:
16-
timeoutMS: 50
16+
timeoutMS: 500
1717
useMultipleMongoses: false
1818
observeEvents:
1919
- commandStartedEvent
@@ -52,7 +52,7 @@ tests:
5252
data:
5353
failCommands: ["commitTransaction"]
5454
blockConnection: true
55-
blockTimeMS: 60
55+
blockTimeMS: 600
5656
- name: startTransaction
5757
object: *session
5858
- name: insertOne
@@ -95,7 +95,7 @@ tests:
9595
data:
9696
failCommands: ["abortTransaction"]
9797
blockConnection: true
98-
blockTimeMS: 60
98+
blockTimeMS: 600
9999
- name: startTransaction
100100
object: *session
101101
- name: insertOne
@@ -136,7 +136,7 @@ tests:
136136
data:
137137
failCommands: ["insert"]
138138
blockConnection: true
139-
blockTimeMS: 60
139+
blockTimeMS: 600
140140
- name: withTransaction
141141
object: *session
142142
arguments:
@@ -153,9 +153,6 @@ tests:
153153
expectEvents:
154154
- client: *client
155155
events:
156-
# Because the insert expects an error and gets an error, it technically succeeds, so withTransaction will
157-
# try to run commitTransaction. This will fail client-side, though, because the timeout has already expired,
158-
# so no command is sent.
159156
- commandStartedEvent:
160157
commandName: insert
161158
databaseName: *databaseName
@@ -166,3 +163,11 @@ tests:
166163
maxTimeMS: { $$type: ["int", "long"] }
167164
- commandFailedEvent:
168165
commandName: insert
166+
- commandStartedEvent:
167+
commandName: abortTransaction
168+
databaseName: admin
169+
command:
170+
abortTransaction: 1
171+
maxTimeMS: { $$type: [ "int", "long" ] }
172+
- commandFailedEvent:
173+
commandName: abortTransaction

test/spec/client-side-operations-timeout/sessions-override-operation-timeoutMS.json

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"commitTransaction"
7676
],
7777
"blockConnection": true,
78-
"blockTimeMS": 60
78+
"blockTimeMS": 600
7979
}
8080
}
8181
}
@@ -98,7 +98,7 @@
9898
"name": "commitTransaction",
9999
"object": "session",
100100
"arguments": {
101-
"timeoutMS": 50
101+
"timeoutMS": 500
102102
},
103103
"expectError": {
104104
"isTimeoutError": true
@@ -165,7 +165,7 @@
165165
"abortTransaction"
166166
],
167167
"blockConnection": true,
168-
"blockTimeMS": 60
168+
"blockTimeMS": 600
169169
}
170170
}
171171
}
@@ -188,7 +188,7 @@
188188
"name": "abortTransaction",
189189
"object": "session",
190190
"arguments": {
191-
"timeoutMS": 50
191+
"timeoutMS": 500
192192
}
193193
}
194194
],
@@ -252,7 +252,7 @@
252252
"insert"
253253
],
254254
"blockConnection": true,
255-
"blockTimeMS": 60
255+
"blockTimeMS": 600
256256
}
257257
}
258258
}
@@ -261,7 +261,7 @@
261261
"name": "withTransaction",
262262
"object": "session",
263263
"arguments": {
264-
"timeoutMS": 50,
264+
"timeoutMS": 500,
265265
"callback": [
266266
{
267267
"name": "insertOne",
@@ -306,6 +306,26 @@
306306
"commandFailedEvent": {
307307
"commandName": "insert"
308308
}
309+
},
310+
{
311+
"commandStartedEvent": {
312+
"commandName": "abortTransaction",
313+
"databaseName": "admin",
314+
"command": {
315+
"abortTransaction": 1,
316+
"maxTimeMS": {
317+
"$$type": [
318+
"int",
319+
"long"
320+
]
321+
}
322+
}
323+
}
324+
},
325+
{
326+
"commandFailedEvent": {
327+
"commandName": "abortTransaction"
328+
}
309329
}
310330
]
311331
}

test/spec/client-side-operations-timeout/sessions-override-operation-timeoutMS.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tests:
5050
data:
5151
failCommands: ["commitTransaction"]
5252
blockConnection: true
53-
blockTimeMS: 60
53+
blockTimeMS: 600
5454
- name: startTransaction
5555
object: *session
5656
- name: insertOne
@@ -61,7 +61,7 @@ tests:
6161
- name: commitTransaction
6262
object: *session
6363
arguments:
64-
timeoutMS: 50
64+
timeoutMS: 500
6565
expectError:
6666
isTimeoutError: true
6767
expectEvents:
@@ -95,7 +95,7 @@ tests:
9595
data:
9696
failCommands: ["abortTransaction"]
9797
blockConnection: true
98-
blockTimeMS: 60
98+
blockTimeMS: 600
9999
- name: startTransaction
100100
object: *session
101101
- name: insertOne
@@ -106,7 +106,7 @@ tests:
106106
- name: abortTransaction
107107
object: *session
108108
arguments:
109-
timeoutMS: 50
109+
timeoutMS: 500
110110
expectEvents:
111111
- client: *client
112112
events:
@@ -138,11 +138,11 @@ tests:
138138
data:
139139
failCommands: ["insert"]
140140
blockConnection: true
141-
blockTimeMS: 60
141+
blockTimeMS: 600
142142
- name: withTransaction
143143
object: *session
144144
arguments:
145-
timeoutMS: 50
145+
timeoutMS: 500
146146
callback:
147147
- name: insertOne
148148
object: *collection
@@ -156,9 +156,6 @@ tests:
156156
expectEvents:
157157
- client: *client
158158
events:
159-
# Because the insert expects an error and gets an error, it technically succeeds, so withTransaction will
160-
# try to run commitTransaction. This will fail client-side, though, because the timeout has already expired,
161-
# so no command is sent.
162159
- commandStartedEvent:
163160
commandName: insert
164161
databaseName: *databaseName
@@ -169,3 +166,11 @@ tests:
169166
maxTimeMS: { $$type: ["int", "long"] }
170167
- commandFailedEvent:
171168
commandName: insert
169+
- commandStartedEvent:
170+
commandName: abortTransaction
171+
databaseName: admin
172+
command:
173+
abortTransaction: 1
174+
maxTimeMS: { $$type: ["int", "long"] }
175+
- commandFailedEvent:
176+
commandName: abortTransaction

test/spec/client-side-operations-timeout/sessions-override-timeoutMS.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"id": "session",
4848
"client": "client",
4949
"sessionOptions": {
50-
"defaultTimeoutMS": 50
50+
"defaultTimeoutMS": 500
5151
}
5252
}
5353
}
@@ -78,7 +78,7 @@
7878
"commitTransaction"
7979
],
8080
"blockConnection": true,
81-
"blockTimeMS": 60
81+
"blockTimeMS": 600
8282
}
8383
}
8484
}
@@ -165,7 +165,7 @@
165165
"abortTransaction"
166166
],
167167
"blockConnection": true,
168-
"blockTimeMS": 60
168+
"blockTimeMS": 600
169169
}
170170
}
171171
}
@@ -249,7 +249,7 @@
249249
"insert"
250250
],
251251
"blockConnection": true,
252-
"blockTimeMS": 60
252+
"blockTimeMS": 600
253253
}
254254
}
255255
}
@@ -302,6 +302,26 @@
302302
"commandFailedEvent": {
303303
"commandName": "insert"
304304
}
305+
},
306+
{
307+
"commandStartedEvent": {
308+
"commandName": "abortTransaction",
309+
"databaseName": "admin",
310+
"command": {
311+
"abortTransaction": 1,
312+
"maxTimeMS": {
313+
"$$type": [
314+
"int",
315+
"long"
316+
]
317+
}
318+
}
319+
}
320+
},
321+
{
322+
"commandFailedEvent": {
323+
"commandName": "abortTransaction"
324+
}
305325
}
306326
]
307327
}

0 commit comments

Comments
 (0)