Skip to content

Commit f09d6fa

Browse files
committed
PYTHON-1801 Update transactions count test for MongoDB >= 4.0.7
1 parent eb4a047 commit f09d6fa

File tree

2 files changed

+120
-86
lines changed

2 files changed

+120
-86
lines changed

test/transactions/count.json

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.0.2",
5+
"topology": [
6+
"replicaset"
7+
]
8+
},
9+
{
10+
"minServerVersion": "4.1.8",
11+
"topology": [
12+
"sharded"
13+
]
14+
}
15+
],
16+
"database_name": "transaction-tests",
17+
"collection_name": "test",
18+
"data": [
19+
{
20+
"_id": 1
21+
},
22+
{
23+
"_id": 2
24+
},
25+
{
26+
"_id": 3
27+
},
28+
{
29+
"_id": 4
30+
}
31+
],
32+
"tests": [
33+
{
34+
"description": "count",
35+
"operations": [
36+
{
37+
"name": "startTransaction",
38+
"object": "session0"
39+
},
40+
{
41+
"name": "count",
42+
"object": "collection",
43+
"arguments": {
44+
"session": "session0",
45+
"filter": {
46+
"_id": 1
47+
}
48+
},
49+
"result": {
50+
"errorCodeName": "OperationNotSupportedInTransaction",
51+
"errorLabelsOmit": [
52+
"TransientTransactionError",
53+
"UnknownTransactionCommitResult"
54+
]
55+
}
56+
},
57+
{
58+
"name": "abortTransaction",
59+
"object": "session0"
60+
}
61+
],
62+
"expectations": [
63+
{
64+
"command_started_event": {
65+
"command": {
66+
"count": "test",
67+
"query": {
68+
"_id": 1
69+
},
70+
"readConcern": null,
71+
"lsid": "session0",
72+
"txnNumber": {
73+
"$numberLong": "1"
74+
},
75+
"startTransaction": true,
76+
"autocommit": false,
77+
"writeConcern": null
78+
},
79+
"command_name": "count",
80+
"database_name": "transaction-tests"
81+
}
82+
},
83+
{
84+
"command_started_event": {
85+
"command": {
86+
"abortTransaction": 1,
87+
"lsid": "session0",
88+
"txnNumber": {
89+
"$numberLong": "1"
90+
},
91+
"startTransaction": null,
92+
"autocommit": false,
93+
"writeConcern": null
94+
},
95+
"command_name": "abortTransaction",
96+
"database_name": "admin"
97+
}
98+
}
99+
],
100+
"outcome": {
101+
"collection": {
102+
"data": [
103+
{
104+
"_id": 1
105+
},
106+
{
107+
"_id": 2
108+
},
109+
{
110+
"_id": 3
111+
},
112+
{
113+
"_id": 4
114+
}
115+
]
116+
}
117+
}
118+
}
119+
]
120+
}

test/transactions/reads.json

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -97,92 +97,6 @@
9797
}
9898
}
9999
},
100-
{
101-
"description": "count",
102-
"operations": [
103-
{
104-
"name": "startTransaction",
105-
"object": "session0"
106-
},
107-
{
108-
"name": "count",
109-
"object": "collection",
110-
"arguments": {
111-
"session": "session0",
112-
"filter": {
113-
"_id": 1
114-
}
115-
},
116-
"result": {
117-
"errorContains": "Cannot run 'count' in a multi-document transaction",
118-
"errorLabelsOmit": [
119-
"TransientTransactionError",
120-
"UnknownTransactionCommitResult"
121-
]
122-
}
123-
},
124-
{
125-
"name": "abortTransaction",
126-
"object": "session0"
127-
}
128-
],
129-
"expectations": [
130-
{
131-
"command_started_event": {
132-
"command": {
133-
"count": "test",
134-
"query": {
135-
"_id": 1
136-
},
137-
"readConcern": null,
138-
"lsid": "session0",
139-
"txnNumber": {
140-
"$numberLong": "1"
141-
},
142-
"startTransaction": true,
143-
"autocommit": false,
144-
"writeConcern": null
145-
},
146-
"command_name": "count",
147-
"database_name": "transaction-tests"
148-
}
149-
},
150-
{
151-
"command_started_event": {
152-
"command": {
153-
"abortTransaction": 1,
154-
"lsid": "session0",
155-
"txnNumber": {
156-
"$numberLong": "1"
157-
},
158-
"startTransaction": null,
159-
"autocommit": false,
160-
"writeConcern": null
161-
},
162-
"command_name": "abortTransaction",
163-
"database_name": "admin"
164-
}
165-
}
166-
],
167-
"outcome": {
168-
"collection": {
169-
"data": [
170-
{
171-
"_id": 1
172-
},
173-
{
174-
"_id": 2
175-
},
176-
{
177-
"_id": 3
178-
},
179-
{
180-
"_id": 4
181-
}
182-
]
183-
}
184-
}
185-
},
186100
{
187101
"description": "find",
188102
"operations": [

0 commit comments

Comments
 (0)