Skip to content

Commit 69aa294

Browse files
committed
JAVA-2815: Update to latest transaction spec tests
1 parent 1b3dedb commit 69aa294

File tree

4 files changed

+78
-63
lines changed

4 files changed

+78
-63
lines changed

driver-core/src/test/resources/transactions/read-pref.json

Lines changed: 65 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
}
4141
},
4242
{
43-
"name": "count",
43+
"name": "aggregate",
4444
"object": "collection",
4545
"collectionOptions": {
4646
"readPreference": {
@@ -49,11 +49,22 @@
4949
},
5050
"arguments": {
5151
"session": "session0",
52-
"filter": {
53-
"_id": 1
54-
}
52+
"pipeline": [
53+
{
54+
"$match": {
55+
"_id": 1
56+
}
57+
},
58+
{
59+
"$count": "count"
60+
}
61+
]
5562
},
56-
"result": 1
63+
"result": [
64+
{
65+
"count": 1
66+
}
67+
]
5768
},
5869
{
5970
"name": "find",
@@ -184,7 +195,7 @@
184195
}
185196
},
186197
{
187-
"name": "count",
198+
"name": "aggregate",
188199
"object": "collection",
189200
"collectionOptions": {
190201
"readPreference": {
@@ -193,11 +204,22 @@
193204
},
194205
"arguments": {
195206
"session": "session0",
196-
"filter": {
197-
"_id": 1
198-
}
207+
"pipeline": [
208+
{
209+
"$match": {
210+
"_id": 1
211+
}
212+
},
213+
{
214+
"$count": "count"
215+
}
216+
]
199217
},
200-
"result": 1
218+
"result": [
219+
{
220+
"count": 1
221+
}
222+
]
201223
},
202224
{
203225
"name": "find",
@@ -328,7 +350,7 @@
328350
}
329351
},
330352
{
331-
"name": "count",
353+
"name": "aggregate",
332354
"object": "collection",
333355
"collectionOptions": {
334356
"readPreference": {
@@ -337,9 +359,16 @@
337359
},
338360
"arguments": {
339361
"session": "session0",
340-
"filter": {
341-
"_id": 1
342-
}
362+
"pipeline": [
363+
{
364+
"$match": {
365+
"_id": 1
366+
}
367+
},
368+
{
369+
"$count": "count"
370+
}
371+
]
343372
},
344373
"result": {
345374
"errorContains": "read preference in a transaction must be primary"
@@ -439,7 +468,7 @@
439468
}
440469
},
441470
{
442-
"name": "count",
471+
"name": "aggregate",
443472
"object": "collection",
444473
"collectionOptions": {
445474
"readPreference": {
@@ -448,9 +477,16 @@
448477
},
449478
"arguments": {
450479
"session": "session0",
451-
"filter": {
452-
"_id": 1
453-
}
480+
"pipeline": [
481+
{
482+
"$match": {
483+
"_id": 1
484+
}
485+
},
486+
{
487+
"$count": "count"
488+
}
489+
]
454490
},
455491
"result": {
456492
"errorContains": "read preference in a transaction must be primary"
@@ -550,7 +586,7 @@
550586
}
551587
},
552588
{
553-
"name": "count",
589+
"name": "aggregate",
554590
"object": "collection",
555591
"collectionOptions": {
556592
"readPreference": {
@@ -559,9 +595,16 @@
559595
},
560596
"arguments": {
561597
"session": "session0",
562-
"filter": {
563-
"_id": 1
564-
}
598+
"pipeline": [
599+
{
600+
"$match": {
601+
"_id": 1
602+
}
603+
},
604+
{
605+
"$count": "count"
606+
}
607+
]
565608
},
566609
"result": {
567610
"errorContains": "read preference in a transaction must be primary"

driver-core/src/test/resources/transactions/reads.json

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,12 @@
9999
"_id": 1
100100
}
101101
},
102-
"result": 1
103-
},
104-
{
105-
"name": "count",
106-
"object": "collection",
107-
"arguments": {
108-
"session": "session0",
109-
"filter": {
110-
"_id": 1
111-
}
112-
},
113-
"result": 1
102+
"result": {
103+
"errorContains": "Cannot run 'count' in a multi-document transaction"
104+
}
114105
},
115106
{
116-
"name": "commitTransaction",
107+
"name": "abortTransaction",
117108
"object": "session0"
118109
}
119110
],
@@ -141,10 +132,7 @@
141132
{
142133
"command_started_event": {
143134
"command": {
144-
"count": "test",
145-
"query": {
146-
"_id": 1
147-
},
135+
"abortTransaction": 1,
148136
"lsid": "session0",
149137
"txnNumber": {
150138
"$numberLong": "1"
@@ -153,23 +141,7 @@
153141
"autocommit": false,
154142
"writeConcern": null
155143
},
156-
"command_name": "count",
157-
"database_name": "transaction-tests"
158-
}
159-
},
160-
{
161-
"command_started_event": {
162-
"command": {
163-
"commitTransaction": 1,
164-
"lsid": "session0",
165-
"txnNumber": {
166-
"$numberLong": "1"
167-
},
168-
"startTransaction": null,
169-
"autocommit": false,
170-
"writeConcern": null
171-
},
172-
"command_name": "commitTransaction",
144+
"command_name": "abortTransaction",
173145
"database_name": "admin"
174146
}
175147
}

driver-core/src/test/resources/transactions/run-command.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@
242242
{
243243
"name": "runCommand",
244244
"object": "database",
245-
"command_name": "count",
245+
"command_name": "find",
246246
"arguments": {
247247
"session": "session0",
248248
"command": {
249-
"count": "test"
249+
"find": "test"
250250
},
251251
"readPreference": {
252252
"mode": "Secondary"
@@ -275,11 +275,11 @@
275275
{
276276
"name": "runCommand",
277277
"object": "database",
278-
"command_name": "count",
278+
"command_name": "find",
279279
"arguments": {
280280
"session": "session0",
281281
"command": {
282-
"count": "test"
282+
"find": "test"
283283
}
284284
},
285285
"result": {

driver-core/src/test/resources/transactions/transaction-options.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@
12501250
}
12511251
},
12521252
{
1253-
"name": "count",
1253+
"name": "find",
12541254
"object": "collection",
12551255
"arguments": {
12561256
"session": "session0",
@@ -1352,7 +1352,7 @@
13521352
}
13531353
},
13541354
{
1355-
"name": "count",
1355+
"name": "find",
13561356
"object": "collection",
13571357
"arguments": {
13581358
"session": "session0",
@@ -1461,7 +1461,7 @@
14611461
}
14621462
},
14631463
{
1464-
"name": "count",
1464+
"name": "find",
14651465
"object": "collection",
14661466
"arguments": {
14671467
"session": "session0",

0 commit comments

Comments
 (0)