Skip to content

Commit 50abb26

Browse files
authored
CDRIVER-4717 sync legacy transaction tests for LB runOnRequirements (#1507)
Synced with mongodb/specifications@38e65fc This includes error-labels-blockConnection.json for client-side operations timeout, which is not yet implemented in libmongoc. Per run-tests.sh, these tests will not actually be executed on load balancers. This is intentional to avoid making further changes to the legacy spec test runner to support LBs. * Add trailing newline to skipped test output
1 parent 6f4d492 commit 50abb26

34 files changed

+911
-697
lines changed

src/libmongoc/tests/json-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ run_json_general_test (const json_test_config_t *config)
18561856

18571857
if (should_skip) {
18581858
fprintf (stderr,
1859-
" - %s SKIPPED, due to reason: %s",
1859+
" - %s SKIPPED, due to reason: %s\n",
18601860
description,
18611861
iter->reason);
18621862
continue;

src/libmongoc/tests/json/transactions/legacy/abort.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
{
1010
"minServerVersion": "4.1.8",
1111
"topology": [
12-
"sharded"
12+
"sharded",
13+
"load-balanced"
1314
]
1415
}
1516
],

src/libmongoc/tests/json/transactions/legacy/bulk.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
{
1010
"minServerVersion": "4.1.8",
1111
"topology": [
12-
"sharded"
12+
"sharded",
13+
"load-balanced"
1314
]
1415
}
1516
],

src/libmongoc/tests/json/transactions/legacy/causal-consistency.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
{
1010
"minServerVersion": "4.1.8",
1111
"topology": [
12-
"sharded"
12+
"sharded",
13+
"load-balanced"
1314
]
1415
}
1516
],

src/libmongoc/tests/json/transactions/legacy/commit.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
{
1010
"minServerVersion": "4.1.8",
1111
"topology": [
12-
"sharded"
12+
"sharded",
13+
"load-balanced"
1314
]
1415
}
1516
],

src/libmongoc/tests/json/transactions/legacy/count.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
{
1010
"minServerVersion": "4.1.8",
1111
"topology": [
12-
"sharded"
12+
"sharded",
13+
"load-balanced"
1314
]
1415
}
1516
],

src/libmongoc/tests/json/transactions/legacy/create-collection.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "4.3.4",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

src/libmongoc/tests/json/transactions/legacy/create-index.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "4.3.4",
55
"topology": [
66
"replicaset",
7-
"sharded"
7+
"sharded",
8+
"load-balanced"
89
]
910
}
1011
],

src/libmongoc/tests/json/transactions/legacy/delete.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
{
1010
"minServerVersion": "4.1.8",
1111
"topology": [
12-
"sharded"
12+
"sharded",
13+
"load-balanced"
1314
]
1415
}
1516
],
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.2",
5+
"topology": [
6+
"replicaset",
7+
"sharded",
8+
"load-balanced"
9+
]
10+
}
11+
],
12+
"database_name": "transaction-tests",
13+
"collection_name": "test",
14+
"data": [],
15+
"tests": [
16+
{
17+
"description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors",
18+
"clientOptions": {
19+
"socketTimeoutMS": 100
20+
},
21+
"failPoint": {
22+
"configureFailPoint": "failCommand",
23+
"mode": {
24+
"times": 2
25+
},
26+
"data": {
27+
"failCommands": [
28+
"commitTransaction"
29+
],
30+
"blockConnection": true,
31+
"blockTimeMS": 150
32+
}
33+
},
34+
"operations": [
35+
{
36+
"name": "startTransaction",
37+
"object": "session0"
38+
},
39+
{
40+
"name": "insertOne",
41+
"object": "collection",
42+
"arguments": {
43+
"session": "session0",
44+
"document": {
45+
"_id": 1
46+
}
47+
},
48+
"result": {
49+
"insertedId": 1
50+
}
51+
},
52+
{
53+
"name": "commitTransaction",
54+
"object": "session0",
55+
"result": {
56+
"errorLabelsContain": [
57+
"RetryableWriteError",
58+
"UnknownTransactionCommitResult"
59+
],
60+
"errorLabelsOmit": [
61+
"TransientTransactionError"
62+
]
63+
}
64+
},
65+
{
66+
"name": "commitTransaction",
67+
"object": "session0"
68+
}
69+
],
70+
"expectations": [
71+
{
72+
"command_started_event": {
73+
"command": {
74+
"insert": "test",
75+
"documents": [
76+
{
77+
"_id": 1
78+
}
79+
],
80+
"ordered": true,
81+
"readConcern": null,
82+
"lsid": "session0",
83+
"txnNumber": {
84+
"$numberLong": "1"
85+
},
86+
"startTransaction": true,
87+
"autocommit": false,
88+
"writeConcern": null
89+
},
90+
"command_name": "insert",
91+
"database_name": "transaction-tests"
92+
}
93+
},
94+
{
95+
"command_started_event": {
96+
"command": {
97+
"commitTransaction": 1,
98+
"lsid": "session0",
99+
"txnNumber": {
100+
"$numberLong": "1"
101+
},
102+
"startTransaction": null,
103+
"autocommit": false,
104+
"writeConcern": null
105+
},
106+
"command_name": "commitTransaction",
107+
"database_name": "admin"
108+
}
109+
},
110+
{
111+
"command_started_event": {
112+
"command": {
113+
"commitTransaction": 1,
114+
"lsid": "session0",
115+
"txnNumber": {
116+
"$numberLong": "1"
117+
},
118+
"startTransaction": null,
119+
"autocommit": false,
120+
"writeConcern": {
121+
"w": "majority",
122+
"wtimeout": 10000
123+
}
124+
},
125+
"command_name": "commitTransaction",
126+
"database_name": "admin"
127+
}
128+
},
129+
{
130+
"command_started_event": {
131+
"command": {
132+
"commitTransaction": 1,
133+
"lsid": "session0",
134+
"txnNumber": {
135+
"$numberLong": "1"
136+
},
137+
"startTransaction": null,
138+
"autocommit": false,
139+
"writeConcern": {
140+
"w": "majority",
141+
"wtimeout": 10000
142+
}
143+
},
144+
"command_name": "commitTransaction",
145+
"database_name": "admin"
146+
}
147+
}
148+
],
149+
"outcome": {
150+
"collection": {
151+
"data": [
152+
{
153+
"_id": 1
154+
}
155+
]
156+
}
157+
}
158+
}
159+
]
160+
}

0 commit comments

Comments
 (0)