Re-sync transactions tests
This commit is contained in:
parent
b4f153a811
commit
ab73a7a164
@ -138,15 +138,23 @@ class TestTransactions(IntegrationTest):
|
||||
|
||||
# Convert arguments to snake_case and handle special cases.
|
||||
arguments = operation['arguments']
|
||||
options = arguments.pop("options", {})
|
||||
for option_name in options:
|
||||
arguments[camel_to_snake(option_name)] = options[option_name]
|
||||
|
||||
pref = arguments.pop('readPreference', None)
|
||||
if pref:
|
||||
mode = read_pref_mode_from_name(pref['mode'])
|
||||
collection = collection.with_options(
|
||||
read_preference=make_read_preference(mode, None))
|
||||
write_c = arguments.pop('writeConcern', None)
|
||||
if write_c:
|
||||
collection = collection.with_options(
|
||||
write_concern=WriteConcern(**write_c))
|
||||
read_c = arguments.pop('readConcern', None)
|
||||
if read_c:
|
||||
collection = collection.with_options(
|
||||
read_concern=ReadConcern(**read_c))
|
||||
|
||||
options = arguments.pop("options", {})
|
||||
for option_name in options:
|
||||
arguments[camel_to_snake(option_name)] = options[option_name]
|
||||
|
||||
if name.endswith('_transaction'):
|
||||
cmd = getattr(session, name)
|
||||
@ -181,9 +189,9 @@ class TestTransactions(IntegrationTest):
|
||||
# Requires boolean returnDocument.
|
||||
elif arg_name == "returnDocument":
|
||||
arguments[c2s] = arguments[arg_name] == "After"
|
||||
elif arg_name == "readConcern":
|
||||
elif c2s == "read_concern":
|
||||
arguments[c2s] = ReadConcern(**arguments.pop(arg_name))
|
||||
elif arg_name == "writeConcern":
|
||||
elif c2s == "write_concern":
|
||||
arguments[c2s] = WriteConcern(**arguments.pop(arg_name))
|
||||
else:
|
||||
arguments[c2s] = arguments.pop(arg_name)
|
||||
|
||||
@ -380,6 +380,7 @@
|
||||
"level": "snapshot",
|
||||
"afterClusterTime": 42
|
||||
},
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "2"
|
||||
},
|
||||
@ -456,9 +457,6 @@
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"errorContains": "no transaction started"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -510,6 +510,104 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for bulk",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "insertOne",
|
||||
"arguments": {
|
||||
"document": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 0,
|
||||
"insertedIds": {
|
||||
"0": 1
|
||||
},
|
||||
"matchedCount": 0,
|
||||
"modifiedCount": 0,
|
||||
"upsertedCount": 0,
|
||||
"upsertedIds": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"insert": "test",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "insert",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -182,6 +182,138 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for delete",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lte": 3
|
||||
}
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "test",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 1
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "delete",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "test",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$lte": 3
|
||||
}
|
||||
},
|
||||
"limit": 0
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "delete",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 2,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -127,6 +127,89 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for findOneAndDelete",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 3
|
||||
},
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"_id": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "test",
|
||||
"query": {
|
||||
"_id": 3
|
||||
},
|
||||
"remove": true,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "findAndModify",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"readConcern": null,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -154,6 +154,96 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for findOneAndReplace",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "findOneAndReplace",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 3
|
||||
},
|
||||
"replacement": {
|
||||
"x": 1
|
||||
},
|
||||
"returnDocument": "Before",
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"_id": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "test",
|
||||
"query": {
|
||||
"_id": 3
|
||||
},
|
||||
"update": {
|
||||
"x": 1
|
||||
},
|
||||
"new": false,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "findAndModify",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"readConcern": null,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -320,6 +320,100 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for findOneAndUpdate",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 3
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"returnDocument": "Before",
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"_id": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "test",
|
||||
"query": {
|
||||
"_id": 3
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"new": false,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "findAndModify",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"readConcern": null,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -243,6 +243,139 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for insert",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "insertOne",
|
||||
"arguments": {
|
||||
"document": {
|
||||
"_id": 1
|
||||
},
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"insertedId": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "insertMany",
|
||||
"arguments": {
|
||||
"documents": [
|
||||
{
|
||||
"_id": 2
|
||||
},
|
||||
{
|
||||
"_id": 3
|
||||
}
|
||||
],
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"insertedIds": {
|
||||
"0": 2,
|
||||
"1": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"insert": "test",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "insert",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"insert": "test",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 2
|
||||
},
|
||||
{
|
||||
"_id": 3
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "insert",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 3,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"errorContains": "transaction readPreference changed"
|
||||
"errorContains": "read preference in a transaction must be primary"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -102,6 +102,40 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-primary readPreference",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "count",
|
||||
"arguments": {
|
||||
"readPreference": {
|
||||
"mode": "secondary"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"errorContains": "read preference in a transaction must be primary"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "conflict",
|
||||
"operations": [
|
||||
@ -130,7 +164,7 @@
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"errorContains": "transaction readPreference changed"
|
||||
"errorContains": "read preference in a transaction must be primary"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -13,20 +13,6 @@
|
||||
"_id": 4
|
||||
}
|
||||
],
|
||||
"common": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "count",
|
||||
|
||||
@ -506,11 +506,13 @@
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
"options": {
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -536,11 +538,13 @@
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
"options": {
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -225,6 +225,216 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "operation writeConcern ignored for update",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 4
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"upsert": true,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"matchedCount": 0,
|
||||
"modifiedCount": 0,
|
||||
"upsertedCount": 1,
|
||||
"upsertedId": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "replaceOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"x": 1
|
||||
},
|
||||
"replacement": {
|
||||
"y": 1
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gte": 3
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$set": {
|
||||
"z": 1
|
||||
}
|
||||
},
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
},
|
||||
"session": "session0"
|
||||
},
|
||||
"result": {
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "commitTransaction",
|
||||
"arguments": {
|
||||
"session": "session0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 4
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"multi": false,
|
||||
"upsert": true
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"readConcern": {
|
||||
"level": "snapshot"
|
||||
},
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 0,
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "update",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"x": 1
|
||||
},
|
||||
"u": {
|
||||
"y": 1
|
||||
},
|
||||
"multi": false,
|
||||
"upsert": false
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 1,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "update",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gte": 3
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$set": {
|
||||
"z": 1
|
||||
}
|
||||
},
|
||||
"multi": true,
|
||||
"upsert": false
|
||||
}
|
||||
],
|
||||
"ordered": true,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 2,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "update",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"commitTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"stmtId": 3,
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
},
|
||||
"command_name": "commitTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -8,8 +8,10 @@
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -179,8 +181,10 @@
|
||||
"name": "startTransaction",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
"options": {
|
||||
"writeConcern": {
|
||||
"w": "majority"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user