Skip to content

Commit c769f77

Browse files
p-mongop
authored andcommitted
RUBY-1789 Update Transactions count test for MongoDB >= 4.0.7 (#1359)
1 parent f60210a commit c769f77

File tree

2 files changed

+65
-46
lines changed

2 files changed

+65
-46
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
runOn:
2+
# SERVER-35388 introduced OperationNotSupportedInTransaction in 4.0.2
3+
-
4+
minServerVersion: "4.0.2"
5+
topology: ["replicaset"]
6+
7+
database_name: &database_name "transaction-tests"
8+
collection_name: &collection_name "test"
9+
10+
data: &data
11+
- {_id: 1}
12+
- {_id: 2}
13+
- {_id: 3}
14+
- {_id: 4}
15+
16+
tests:
17+
- description: count
18+
19+
operations:
20+
- name: startTransaction
21+
object: session0
22+
- name: count
23+
object: collection
24+
arguments:
25+
session: session0
26+
filter:
27+
_id: 1
28+
result:
29+
errorCodeName: OperationNotSupportedInTransaction
30+
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
31+
- name: abortTransaction
32+
object: session0
33+
34+
expectations:
35+
- command_started_event:
36+
command:
37+
count: *collection_name
38+
query:
39+
_id: 1
40+
readConcern:
41+
lsid: session0
42+
txnNumber:
43+
$numberLong: "1"
44+
startTransaction: true
45+
autocommit: false
46+
writeConcern:
47+
command_name: count
48+
database_name: *database_name
49+
- command_started_event:
50+
command:
51+
abortTransaction: 1
52+
lsid: session0
53+
txnNumber:
54+
$numberLong: "1"
55+
startTransaction:
56+
autocommit: false
57+
writeConcern:
58+
command_name: abortTransaction
59+
database_name: admin
60+
61+
outcome:
62+
collection:
63+
data:
64+
*data

spec/spec_tests/data/transactions/reads.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -43,57 +43,12 @@ tests:
4343
data:
4444
*data
4545

46-
- description: count
46+
- description: find
4747

4848
operations:
4949
- &startTransaction
5050
name: startTransaction
5151
object: session0
52-
- name: count
53-
object: collection
54-
arguments:
55-
session: session0
56-
filter:
57-
_id: 1
58-
result:
59-
errorContains: "Cannot run 'count' in a multi-document transaction"
60-
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
61-
- name: abortTransaction
62-
object: session0
63-
64-
expectations:
65-
- command_started_event:
66-
command:
67-
count: *collection_name
68-
query:
69-
_id: 1
70-
readConcern:
71-
lsid: session0
72-
txnNumber:
73-
$numberLong: "1"
74-
startTransaction: true
75-
autocommit: false
76-
writeConcern:
77-
command_name: count
78-
database_name: *database_name
79-
- command_started_event:
80-
command:
81-
abortTransaction: 1
82-
lsid: session0
83-
txnNumber:
84-
$numberLong: "1"
85-
startTransaction:
86-
autocommit: false
87-
writeConcern:
88-
command_name: abortTransaction
89-
database_name: admin
90-
91-
outcome: *outcome
92-
93-
- description: find
94-
95-
operations:
96-
- *startTransaction
9752
- &find
9853
name: find
9954
object: collection

0 commit comments

Comments
 (0)