-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathconvenient-transactions.yml
More file actions
112 lines (106 loc) · 3.21 KB
/
convenient-transactions.yml
File metadata and controls
112 lines (106 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
description: "timeoutMS behaves correctly for the withTransaction API"
schemaVersion: "1.26"
runOnRequirements:
- minServerVersion: "4.4"
topologies: ["replicaset", "sharded"]
createEntities:
- client:
id: &failPointClient failPointClient
useMultipleMongoses: false
- client:
id: &client client
uriOptions:
timeoutMS: 500
minPoolSize: 1
awaitMinPoolSizeMS: 10000
useMultipleMongoses: false
observeEvents:
- commandStartedEvent
- database:
id: &database database
client: *client
databaseName: &databaseName test
- collection:
id: &collection collection
database: *database
collectionName: &collectionName coll
- session:
id: &session session
client: *client
initialData:
- collectionName: *collectionName
databaseName: *databaseName
documents: []
tests:
- description: "withTransaction raises a client-side error if timeoutMS is overridden inside the callback"
operations:
- name: withTransaction
object: *session
arguments:
callback:
- name: insertOne
object: *collection
arguments:
document: { _id: 1 }
session: *session
timeoutMS: 100
expectError:
isClientError: true
expectError:
isClientError: true
expectEvents:
# The only operation run fails with a client-side error, so there should be no events for the client.
- client: *client
events: []
- description: "timeoutMS is not refreshed for each operation in the callback"
operations:
- name: failPoint
object: testRunner
arguments:
client: *failPointClient
failPoint:
configureFailPoint: failCommand
mode: { times: 2 }
data:
failCommands: ["insert"]
blockConnection: true
blockTimeMS: 300
- name: withTransaction
object: *session
arguments:
callback:
- name: insertOne
object: *collection
arguments:
document: { _id: 1 }
session: *session
- name: insertOne
object: *collection
arguments:
document: { _id: 2 }
session: *session
expectError:
isTimeoutError: true
expectError:
isTimeoutError: true
expectEvents:
- client: *client
events:
- commandStartedEvent:
commandName: insert
databaseName: *databaseName
command:
insert: *collectionName
maxTimeMS: { $$type: ["int", "long"] }
- commandStartedEvent:
commandName: insert
databaseName: *databaseName
command:
insert: *collectionName
maxTimeMS: { $$type: ["int", "long"] }
- commandStartedEvent:
commandName: abortTransaction
databaseName: admin
command:
abortTransaction: 1
maxTimeMS: { $$type: [ "int", "long" ] }