Skip to content

Commit e92160b

Browse files
author
Divjot Arora
committed
add extra error-labels-blockConnection.yml test
1 parent 700edf4 commit e92160b

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# This file contains a single test that should be in error-labels.yml. The test
2+
# was moved from error-labels.yml during the spec work for client-side
3+
# operations timeout because it uses the blockConnection parameter in
4+
# failCommand, which is only available in server versions 4.2+. It should be
5+
# merged back into error-labels.yml when that test file is ported to the
6+
# unified test format as the format allows for per-test runOn requirements.
7+
8+
runOn:
9+
-
10+
minServerVersion: "4.2"
11+
topology: ["replicaset", "sharded"]
12+
13+
database_name: &database_name "transaction-tests"
14+
collection_name: &collection_name "test"
15+
16+
data: []
17+
18+
tests:
19+
20+
# This test previously used failCommand with closeConnection=true to force a
21+
# network error, but this does not work after CSOT is implemented because
22+
# network errors are retried indefinitely. It has been changed to use
23+
# socketTimeoutMS with blockConnection to force a network error because
24+
# drivers only retry socketTimeoutMS-related errors once rather than
25+
# indefinitely.
26+
- description: add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors
27+
28+
clientOptions:
29+
socketTimeoutMS: 100
30+
31+
failPoint:
32+
# Drivers stop retrying after two socket timeouts that occur due to the use of socketTimeoutMS.
33+
configureFailPoint: failCommand
34+
mode: { times: 2 }
35+
data:
36+
failCommands: ["commitTransaction"]
37+
blockConnection: true
38+
blockTimeMS: 150
39+
40+
operations:
41+
- name: startTransaction
42+
object: session0
43+
- name: insertOne
44+
object: collection
45+
arguments:
46+
session: session0
47+
document:
48+
_id: 1
49+
result:
50+
insertedId: 1
51+
- name: commitTransaction
52+
object: session0
53+
result:
54+
errorLabelsContain: ["RetryableWriteError", "UnknownTransactionCommitResult"]
55+
errorLabelsOmit: ["TransientTransactionError"]
56+
- name: commitTransaction
57+
object: session0
58+
59+
expectations:
60+
- command_started_event:
61+
command:
62+
insert: *collection_name
63+
documents:
64+
- _id: 1
65+
ordered: true
66+
readConcern:
67+
lsid: session0
68+
txnNumber:
69+
$numberLong: "1"
70+
startTransaction: true
71+
autocommit: false
72+
writeConcern:
73+
command_name: insert
74+
database_name: *database_name
75+
- command_started_event:
76+
command:
77+
commitTransaction: 1
78+
lsid: session0
79+
txnNumber:
80+
$numberLong: "1"
81+
startTransaction:
82+
autocommit: false
83+
writeConcern:
84+
command_name: commitTransaction
85+
database_name: admin
86+
- command_started_event:
87+
command:
88+
commitTransaction: 1
89+
lsid: session0
90+
txnNumber:
91+
$numberLong: "1"
92+
startTransaction:
93+
autocommit: false
94+
# commitTransaction applies w:majority on retries
95+
writeConcern: { w: majority, wtimeout: 10000 }
96+
command_name: commitTransaction
97+
database_name: admin
98+
- command_started_event:
99+
command:
100+
commitTransaction: 1
101+
lsid: session0
102+
txnNumber:
103+
$numberLong: "1"
104+
startTransaction:
105+
autocommit: false
106+
writeConcern: { w: majority, wtimeout: 10000 }
107+
command_name: commitTransaction
108+
database_name: admin
109+
110+
outcome:
111+
collection:
112+
data:
113+
- _id: 1

0 commit comments

Comments
 (0)