Skip to content

Commit ebac90d

Browse files
authored
CSOT tests: Expect withTransaction to propagate errors (#1553)
DRIVERS-2871
1 parent 093f4ab commit ebac90d

8 files changed

+110
-12
lines changed

source/client-side-operations-timeout/tests/convenient-transactions.json

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-operations-timeout/tests/convenient-transactions.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ tests:
4949
timeoutMS: 100
5050
expectError:
5151
isClientError: true
52+
expectError:
53+
isClientError: true
5254
expectEvents:
5355
# The only operation run fails with a client-side error, so there should be no events for the client.
5456
- client: *client
@@ -88,9 +90,6 @@ tests:
8890
expectEvents:
8991
- client: *client
9092
events:
91-
# Because the second insert expects an error and gets an error, it technically succeeds, so withTransaction
92-
# will try to run commitTransaction. This will fail client-side, though, because the timeout has already
93-
# expired, so no command is sent.
9493
- commandStartedEvent:
9594
commandName: insert
9695
databaseName: *databaseName
@@ -103,3 +102,9 @@ tests:
103102
command:
104103
insert: *collectionName
105104
maxTimeMS: { $$type: ["int", "long"] }
105+
- commandStartedEvent:
106+
commandName: abortTransaction
107+
databaseName: admin
108+
command:
109+
abortTransaction: 1
110+
maxTimeMS: { $$type: [ "int", "long" ] }

source/client-side-operations-timeout/tests/sessions-inherit-timeoutMS.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-operations-timeout/tests/sessions-inherit-timeoutMS.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ tests:
153153
expectEvents:
154154
- client: *client
155155
events:
156-
# Because the insert expects an error and gets an error, it technically succeeds, so withTransaction will
157-
# try to run commitTransaction. This will fail client-side, though, because the timeout has already expired,
158-
# so no command is sent.
159156
- commandStartedEvent:
160157
commandName: insert
161158
databaseName: *databaseName
@@ -166,3 +163,11 @@ tests:
166163
maxTimeMS: { $$type: ["int", "long"] }
167164
- commandFailedEvent:
168165
commandName: insert
166+
- commandStartedEvent:
167+
commandName: abortTransaction
168+
databaseName: admin
169+
command:
170+
abortTransaction: 1
171+
maxTimeMS: { $$type: [ "int", "long" ] }
172+
- commandFailedEvent:
173+
commandName: abortTransaction

source/client-side-operations-timeout/tests/sessions-override-operation-timeoutMS.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-operations-timeout/tests/sessions-override-operation-timeoutMS.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ tests:
156156
expectEvents:
157157
- client: *client
158158
events:
159-
# Because the insert expects an error and gets an error, it technically succeeds, so withTransaction will
160-
# try to run commitTransaction. This will fail client-side, though, because the timeout has already expired,
161-
# so no command is sent.
162159
- commandStartedEvent:
163160
commandName: insert
164161
databaseName: *databaseName
@@ -169,3 +166,11 @@ tests:
169166
maxTimeMS: { $$type: ["int", "long"] }
170167
- commandFailedEvent:
171168
commandName: insert
169+
- commandStartedEvent:
170+
commandName: abortTransaction
171+
databaseName: admin
172+
command:
173+
abortTransaction: 1
174+
maxTimeMS: { $$type: ["int", "long"] }
175+
- commandFailedEvent:
176+
commandName: abortTransaction

source/client-side-operations-timeout/tests/sessions-override-timeoutMS.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-operations-timeout/tests/sessions-override-timeoutMS.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ tests:
153153
expectEvents:
154154
- client: *client
155155
events:
156-
# Because the insert expects an error and gets an error, it technically succeeds, so withTransaction will
157-
# try to run commitTransaction. This will fail client-side, though, because the timeout has already expired,
158-
# so no command is sent.
159156
- commandStartedEvent:
160157
commandName: insert
161158
databaseName: *databaseName
@@ -166,3 +163,11 @@ tests:
166163
maxTimeMS: { $$type: ["int", "long"] }
167164
- commandFailedEvent:
168165
commandName: insert
166+
- commandStartedEvent:
167+
commandName: abortTransaction
168+
databaseName: admin
169+
command:
170+
abortTransaction: 1
171+
maxTimeMS: { $$type: [ "int", "long" ] }
172+
- commandFailedEvent:
173+
commandName: abortTransaction

0 commit comments

Comments
 (0)