PYTHON-1801 Update transactions count test for MongoDB >= 4.0.7
(cherry picked from commit f09d6fa052)
Changes:
Replace runOn with minServerVersion.
This commit is contained in:
parent
35a408c425
commit
50b905ea2f
@ -537,6 +537,12 @@ def create_test(scenario_def, test):
|
||||
read_concern=ReadConcern('local'))
|
||||
self.assertEqual(list(primary_coll.find()), expected_c['data'])
|
||||
|
||||
if 'minServerVersion' in scenario_def:
|
||||
min_ver = tuple(
|
||||
int(elt) for
|
||||
elt in scenario_def['minServerVersion'].split('.'))
|
||||
return client_context.require_version_min(*min_ver)(run_scenario)
|
||||
|
||||
return run_scenario
|
||||
|
||||
|
||||
|
||||
107
test/transactions/count.json
Normal file
107
test/transactions/count.json
Normal file
@ -0,0 +1,107 @@
|
||||
{
|
||||
"minServerVersion": "4.0.2",
|
||||
"database_name": "transaction-tests",
|
||||
"collection_name": "test",
|
||||
"data": [
|
||||
{
|
||||
"_id": 1
|
||||
},
|
||||
{
|
||||
"_id": 2
|
||||
},
|
||||
{
|
||||
"_id": 3
|
||||
},
|
||||
{
|
||||
"_id": 4
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "count",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"object": "session0"
|
||||
},
|
||||
{
|
||||
"name": "count",
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"filter": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"errorCodeName": "OperationNotSupportedInTransaction",
|
||||
"errorLabelsOmit": [
|
||||
"TransientTransactionError",
|
||||
"UnknownTransactionCommitResult"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "abortTransaction",
|
||||
"object": "session0"
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"count": "test",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"readConcern": null,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "count",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"abortTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "abortTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1
|
||||
},
|
||||
{
|
||||
"_id": 2
|
||||
},
|
||||
{
|
||||
"_id": 3
|
||||
},
|
||||
{
|
||||
"_id": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -83,92 +83,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "count",
|
||||
"operations": [
|
||||
{
|
||||
"name": "startTransaction",
|
||||
"object": "session0"
|
||||
},
|
||||
{
|
||||
"name": "count",
|
||||
"object": "collection",
|
||||
"arguments": {
|
||||
"session": "session0",
|
||||
"filter": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"errorContains": "Cannot run 'count' in a multi-document transaction",
|
||||
"errorLabelsOmit": [
|
||||
"TransientTransactionError",
|
||||
"UnknownTransactionCommitResult"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "abortTransaction",
|
||||
"object": "session0"
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"count": "test",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"readConcern": null,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"startTransaction": true,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "count",
|
||||
"database_name": "transaction-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"abortTransaction": 1,
|
||||
"lsid": "session0",
|
||||
"txnNumber": {
|
||||
"$numberLong": "1"
|
||||
},
|
||||
"startTransaction": null,
|
||||
"autocommit": false,
|
||||
"writeConcern": null
|
||||
},
|
||||
"command_name": "abortTransaction",
|
||||
"database_name": "admin"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1
|
||||
},
|
||||
{
|
||||
"_id": 2
|
||||
},
|
||||
{
|
||||
"_id": 3
|
||||
},
|
||||
{
|
||||
"_id": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "find",
|
||||
"operations": [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user