Debian Codegraph @

testdata/transactions/legacy/run-command.yml

raw symbols SCIP
1 runOn:
2 -
3 minServerVersion: "4.0"
4 topology: ["replicaset"]
5 -
6 minServerVersion: "4.1.8"
7 topology: ["sharded"]
8
9 database_name: &database_name "transaction-tests"
10 collection_name: &collection_name "test"
11
12 data: []
13
14 tests:
15 - description: run command with default read preference
16
17 operations:
18 - name: startTransaction
19 object: session0
20 - name: runCommand
21 object: database
22 command_name: insert
23 arguments:
24 session: session0
25 command:
26 insert: *collection_name
27 documents:
28 - _id : 1
29 result:
30 n: 1
31 - name: commitTransaction
32 object: session0
33
34 expectations:
35 - command_started_event:
36 command:
37 insert: *collection_name
38 documents:
39 - _id : 1
40 readConcern:
41 lsid: session0
42 txnNumber:
43 $numberLong: "1"
44 startTransaction: true
45 autocommit: false
46 writeConcern:
47 command_name: insert
48 database_name: *database_name
49 - command_started_event:
50 command:
51 commitTransaction: 1
52 lsid: session0
53 txnNumber:
54 $numberLong: "1"
55 startTransaction:
56 autocommit: false
57 writeConcern:
58 command_name: commitTransaction
59 database_name: admin
60
61 - description: run command with secondary read preference in client option and primary read preference in transaction options
62
63 clientOptions:
64 readPreference: secondary
65
66 operations:
67 - name: startTransaction
68 object: session0
69 arguments:
70 options:
71 readPreference:
72 mode: Primary
73 - name: runCommand
74 object: database
75 command_name: insert
76 arguments:
77 session: session0
78 command:
79 insert: *collection_name
80 documents:
81 - _id : 1
82 result:
83 n: 1
84 - name: commitTransaction
85 object: session0
86
87 expectations:
88 - command_started_event:
89 command:
90 insert: *collection_name
91 documents:
92 - _id : 1
93 readConcern:
94 lsid: session0
95 txnNumber:
96 $numberLong: "1"
97 startTransaction: true
98 autocommit: false
99 writeConcern:
100 command_name: insert
101 database_name: *database_name
102 - command_started_event:
103 command:
104 commitTransaction: 1
105 lsid: session0
106 txnNumber:
107 $numberLong: "1"
108 startTransaction:
109 autocommit: false
110 writeConcern:
111 command_name: commitTransaction
112 database_name: admin
113
114 - description: run command with explicit primary read preference
115
116 operations:
117 - name: startTransaction
118 object: session0
119 - name: runCommand
120 object: database
121 command_name: insert
122 arguments:
123 session: session0
124 command:
125 insert: *collection_name
126 documents:
127 - _id : 1
128 readPreference:
129 mode: Primary
130 result:
131 n: 1
132 - name: commitTransaction
133 object: session0
134
135 expectations:
136 - command_started_event:
137 command:
138 insert: *collection_name
139 documents:
140 - _id : 1
141 readConcern:
142 lsid: session0
143 txnNumber:
144 $numberLong: "1"
145 startTransaction: true
146 autocommit: false
147 writeConcern:
148 command_name: insert
149 database_name: *database_name
150 - command_started_event:
151 command:
152 commitTransaction: 1
153 lsid: session0
154 txnNumber:
155 $numberLong: "1"
156 startTransaction:
157 autocommit: false
158 writeConcern:
159 command_name: commitTransaction
160 database_name: admin
161
162 - description: run command fails with explicit secondary read preference
163
164 operations:
165 - name: startTransaction
166 object: session0
167 - name: runCommand
168 object: database
169 command_name: find
170 arguments:
171 session: session0
172 command:
173 find: *collection_name
174 readPreference:
175 mode: Secondary
176 result:
177 errorContains: read preference in a transaction must be primary
178
179 - description: run command fails with secondary read preference from transaction options
180
181 operations:
182 - name: startTransaction
183 object: session0
184 arguments:
185 options:
186 readPreference:
187 mode: Secondary
188 - name: runCommand
189 object: database
190 command_name: find
191 arguments:
192 session: session0
193 command:
194 find: *collection_name
195 result:
196 errorContains: read preference in a transaction must be primary
197