PYTHON-4267 Convert read/write concern spec tests to unified test format (#1763)
This commit is contained in:
parent
8143f056b5
commit
5699f8029d
@ -137,6 +137,9 @@ do
|
|||||||
srv|SRV|initial-dns-seedlist-discovery|srv_seedlist)
|
srv|SRV|initial-dns-seedlist-discovery|srv_seedlist)
|
||||||
cpjson initial-dns-seedlist-discovery/tests/ srv_seedlist
|
cpjson initial-dns-seedlist-discovery/tests/ srv_seedlist
|
||||||
;;
|
;;
|
||||||
|
read-write-concern|read_write_concern)
|
||||||
|
cpjson read-write-concern/tests/operation read_write_concern/operation
|
||||||
|
;;
|
||||||
retryable-reads|retryable_reads)
|
retryable-reads|retryable_reads)
|
||||||
cpjson retryable-reads/tests/ retryable_reads
|
cpjson retryable-reads/tests/ retryable_reads
|
||||||
;;
|
;;
|
||||||
|
|||||||
@ -1,53 +1,93 @@
|
|||||||
{
|
{
|
||||||
"data": [
|
"description": "default-write-concern-2.6",
|
||||||
{
|
"schemaVersion": "1.0",
|
||||||
"_id": 1,
|
"runOnRequirements": [
|
||||||
"x": 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": 2,
|
|
||||||
"x": 22
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"collection_name": "default_write_concern_coll",
|
|
||||||
"database_name": "default_write_concern_db",
|
|
||||||
"runOn": [
|
|
||||||
{
|
{
|
||||||
"minServerVersion": "2.6"
|
"minServerVersion": "2.6"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"createEntities": [
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"id": "client0",
|
||||||
|
"observeEvents": [
|
||||||
|
"commandStartedEvent"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"database": {
|
||||||
|
"id": "database0",
|
||||||
|
"client": "client0",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"databaseOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collection": {
|
||||||
|
"id": "collection0",
|
||||||
|
"database": "database0",
|
||||||
|
"collectionName": "coll",
|
||||||
|
"collectionOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"initialData": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 1,
|
||||||
|
"x": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": 2,
|
||||||
|
"x": 22
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"description": "DeleteOne omits default write concern",
|
"description": "DeleteOne omits default write concern",
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "deleteOne",
|
"name": "deleteOne",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {}
|
"filter": {}
|
||||||
},
|
},
|
||||||
"result": {
|
"expectResult": {
|
||||||
"deletedCount": 1
|
"deletedCount": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expectations": [
|
"expectEvents": [
|
||||||
{
|
{
|
||||||
"command_started_event": {
|
"client": "client0",
|
||||||
"command": {
|
"events": [
|
||||||
"delete": "default_write_concern_coll",
|
{
|
||||||
"deletes": [
|
"commandStartedEvent": {
|
||||||
{
|
"command": {
|
||||||
"q": {},
|
"delete": "coll",
|
||||||
"limit": 1
|
"deletes": [
|
||||||
|
{
|
||||||
|
"q": {},
|
||||||
|
"limit": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
"writeConcern": null
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -56,32 +96,36 @@
|
|||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "deleteMany",
|
"name": "deleteMany",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {}
|
"filter": {}
|
||||||
},
|
},
|
||||||
"result": {
|
"expectResult": {
|
||||||
"deletedCount": 2
|
"deletedCount": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expectations": [
|
"expectEvents": [
|
||||||
{
|
{
|
||||||
"command_started_event": {
|
"client": "client0",
|
||||||
"command": {
|
"events": [
|
||||||
"delete": "default_write_concern_coll",
|
{
|
||||||
"deletes": [
|
"commandStartedEvent": {
|
||||||
{
|
"command": {
|
||||||
"q": {},
|
"delete": "coll",
|
||||||
"limit": 0
|
"deletes": [
|
||||||
|
{
|
||||||
|
"q": {},
|
||||||
|
"limit": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
"writeConcern": null
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -90,30 +134,24 @@
|
|||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "bulkWrite",
|
"name": "bulkWrite",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"ordered": true,
|
"ordered": true,
|
||||||
"requests": [
|
"requests": [
|
||||||
{
|
{
|
||||||
"name": "deleteMany",
|
"deleteMany": {
|
||||||
"arguments": {
|
|
||||||
"filter": {}
|
"filter": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "insertOne",
|
"insertOne": {
|
||||||
"arguments": {
|
|
||||||
"document": {
|
"document": {
|
||||||
"_id": 1
|
"_id": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "updateOne",
|
"updateOne": {
|
||||||
"arguments": {
|
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 1
|
"_id": 1
|
||||||
},
|
},
|
||||||
@ -125,16 +163,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "insertOne",
|
"insertOne": {
|
||||||
"arguments": {
|
|
||||||
"document": {
|
"document": {
|
||||||
"_id": 2
|
"_id": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "replaceOne",
|
"replaceOne": {
|
||||||
"arguments": {
|
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 1
|
"_id": 1
|
||||||
},
|
},
|
||||||
@ -144,16 +180,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "insertOne",
|
"insertOne": {
|
||||||
"arguments": {
|
|
||||||
"document": {
|
"document": {
|
||||||
"_id": 3
|
"_id": 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "updateMany",
|
"updateMany": {
|
||||||
"arguments": {
|
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 1
|
"_id": 1
|
||||||
},
|
},
|
||||||
@ -165,8 +199,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "deleteOne",
|
"deleteOne": {
|
||||||
"arguments": {
|
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 3
|
"_id": 3
|
||||||
}
|
}
|
||||||
@ -176,10 +209,177 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outcome": {
|
"expectEvents": [
|
||||||
"collection": {
|
{
|
||||||
"name": "default_write_concern_coll",
|
"client": "client0",
|
||||||
"data": [
|
"events": [
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"delete": "coll",
|
||||||
|
"deletes": [
|
||||||
|
{
|
||||||
|
"q": {},
|
||||||
|
"limit": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"insert": "coll",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"update": "coll",
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 1
|
||||||
|
},
|
||||||
|
"u": {
|
||||||
|
"$set": {
|
||||||
|
"x": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"upsert": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
},
|
||||||
|
"multi": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"insert": "coll",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"update": "coll",
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 1
|
||||||
|
},
|
||||||
|
"u": {
|
||||||
|
"x": 2
|
||||||
|
},
|
||||||
|
"upsert": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
},
|
||||||
|
"multi": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"insert": "coll",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"update": "coll",
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 1
|
||||||
|
},
|
||||||
|
"u": {
|
||||||
|
"$set": {
|
||||||
|
"x": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"multi": true,
|
||||||
|
"upsert": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"delete": "coll",
|
||||||
|
"deletes": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 3
|
||||||
|
},
|
||||||
|
"limit": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outcome": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
{
|
{
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"x": 3
|
"x": 3
|
||||||
@ -189,136 +389,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"expectations": [
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"delete": "default_write_concern_coll",
|
|
||||||
"deletes": [
|
|
||||||
{
|
|
||||||
"q": {},
|
|
||||||
"limit": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"insert": "default_write_concern_coll",
|
|
||||||
"documents": [
|
|
||||||
{
|
|
||||||
"_id": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"update": "default_write_concern_coll",
|
|
||||||
"updates": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 1
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"$set": {
|
|
||||||
"x": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"insert": "default_write_concern_coll",
|
|
||||||
"documents": [
|
|
||||||
{
|
|
||||||
"_id": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"update": "default_write_concern_coll",
|
|
||||||
"updates": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 1
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"x": 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"insert": "default_write_concern_coll",
|
|
||||||
"documents": [
|
|
||||||
{
|
|
||||||
"_id": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"update": "default_write_concern_coll",
|
|
||||||
"updates": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 1
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"$set": {
|
|
||||||
"x": 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"multi": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"delete": "default_write_concern_coll",
|
|
||||||
"deletes": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 3
|
|
||||||
},
|
|
||||||
"limit": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -326,10 +396,7 @@
|
|||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "insertOne",
|
"name": "insertOne",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"document": {
|
"document": {
|
||||||
"_id": 3
|
"_id": 3
|
||||||
@ -338,10 +405,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "insertMany",
|
"name": "insertMany",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"documents": [
|
"documents": [
|
||||||
{
|
{
|
||||||
@ -354,10 +418,51 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outcome": {
|
"expectEvents": [
|
||||||
"collection": {
|
{
|
||||||
"name": "default_write_concern_coll",
|
"client": "client0",
|
||||||
"data": [
|
"events": [
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"insert": "coll",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"insert": "coll",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": 5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outcome": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
{
|
{
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"x": 11
|
"x": 11
|
||||||
@ -377,37 +482,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"expectations": [
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"insert": "default_write_concern_coll",
|
|
||||||
"documents": [
|
|
||||||
{
|
|
||||||
"_id": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"insert": "default_write_concern_coll",
|
|
||||||
"documents": [
|
|
||||||
{
|
|
||||||
"_id": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": 5
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -415,10 +489,7 @@
|
|||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "updateOne",
|
"name": "updateOne",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 1
|
"_id": 1
|
||||||
@ -432,10 +503,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "updateMany",
|
"name": "updateMany",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 2
|
"_id": 2
|
||||||
@ -449,10 +517,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "replaceOne",
|
"name": "replaceOne",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 2
|
"_id": 2
|
||||||
@ -463,10 +528,98 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outcome": {
|
"expectEvents": [
|
||||||
"collection": {
|
{
|
||||||
"name": "default_write_concern_coll",
|
"client": "client0",
|
||||||
"data": [
|
"events": [
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"update": "coll",
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 1
|
||||||
|
},
|
||||||
|
"u": {
|
||||||
|
"$set": {
|
||||||
|
"x": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"upsert": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
},
|
||||||
|
"multi": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"update": "coll",
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 2
|
||||||
|
},
|
||||||
|
"u": {
|
||||||
|
"$set": {
|
||||||
|
"x": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"multi": true,
|
||||||
|
"upsert": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"update": "coll",
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"q": {
|
||||||
|
"_id": 2
|
||||||
|
},
|
||||||
|
"u": {
|
||||||
|
"x": 3
|
||||||
|
},
|
||||||
|
"upsert": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
},
|
||||||
|
"multi": {
|
||||||
|
"$$unsetOrMatches": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outcome": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
{
|
{
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"x": 1
|
"x": 1
|
||||||
@ -477,67 +630,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"expectations": [
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"update": "default_write_concern_coll",
|
|
||||||
"updates": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 1
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"$set": {
|
|
||||||
"x": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"update": "default_write_concern_coll",
|
|
||||||
"updates": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 2
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"$set": {
|
|
||||||
"x": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"multi": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"update": "default_write_concern_coll",
|
|
||||||
"updates": [
|
|
||||||
{
|
|
||||||
"q": {
|
|
||||||
"_id": 2
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"x": 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,31 +1,64 @@
|
|||||||
{
|
{
|
||||||
"data": [
|
"description": "default-write-concern-3.2",
|
||||||
{
|
"schemaVersion": "1.0",
|
||||||
"_id": 1,
|
"runOnRequirements": [
|
||||||
"x": 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": 2,
|
|
||||||
"x": 22
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"collection_name": "default_write_concern_coll",
|
|
||||||
"database_name": "default_write_concern_db",
|
|
||||||
"runOn": [
|
|
||||||
{
|
{
|
||||||
"minServerVersion": "3.2"
|
"minServerVersion": "3.2"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"createEntities": [
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"id": "client0",
|
||||||
|
"observeEvents": [
|
||||||
|
"commandStartedEvent"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"database": {
|
||||||
|
"id": "database0",
|
||||||
|
"client": "client0",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"databaseOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collection": {
|
||||||
|
"id": "collection0",
|
||||||
|
"database": "database0",
|
||||||
|
"collectionName": "coll",
|
||||||
|
"collectionOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"initialData": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 1,
|
||||||
|
"x": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": 2,
|
||||||
|
"x": 22
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"description": "findAndModify operations omit default write concern",
|
"description": "findAndModify operations omit default write concern",
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "findOneAndUpdate",
|
"name": "findOneAndUpdate",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 1
|
"_id": 1
|
||||||
@ -39,10 +72,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "findOneAndReplace",
|
"name": "findOneAndReplace",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 2
|
"_id": 2
|
||||||
@ -54,10 +84,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "findOneAndDelete",
|
"name": "findOneAndDelete",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"filter": {
|
"filter": {
|
||||||
"_id": 2
|
"_id": 2
|
||||||
@ -65,60 +92,72 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outcome": {
|
"expectEvents": [
|
||||||
"collection": {
|
{
|
||||||
"name": "default_write_concern_coll",
|
"client": "client0",
|
||||||
"data": [
|
"events": [
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"findAndModify": "coll",
|
||||||
|
"query": {
|
||||||
|
"_id": 1
|
||||||
|
},
|
||||||
|
"update": {
|
||||||
|
"$set": {
|
||||||
|
"x": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"findAndModify": "coll",
|
||||||
|
"query": {
|
||||||
|
"_id": 2
|
||||||
|
},
|
||||||
|
"update": {
|
||||||
|
"x": 2
|
||||||
|
},
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"findAndModify": "coll",
|
||||||
|
"query": {
|
||||||
|
"_id": 2
|
||||||
|
},
|
||||||
|
"remove": true,
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outcome": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
{
|
{
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"x": 1
|
"x": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"expectations": [
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"findAndModify": "default_write_concern_coll",
|
|
||||||
"query": {
|
|
||||||
"_id": 1
|
|
||||||
},
|
|
||||||
"update": {
|
|
||||||
"$set": {
|
|
||||||
"x": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"findAndModify": "default_write_concern_coll",
|
|
||||||
"query": {
|
|
||||||
"_id": 2
|
|
||||||
},
|
|
||||||
"update": {
|
|
||||||
"x": 2
|
|
||||||
},
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"findAndModify": "default_write_concern_coll",
|
|
||||||
"query": {
|
|
||||||
"_id": 2
|
|
||||||
},
|
|
||||||
"remove": true,
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,30 +1,68 @@
|
|||||||
{
|
{
|
||||||
"data": [
|
"description": "default-write-concern-3.4",
|
||||||
{
|
"schemaVersion": "1.4",
|
||||||
"_id": 1,
|
"runOnRequirements": [
|
||||||
"x": 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": 2,
|
|
||||||
"x": 22
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"collection_name": "default_write_concern_coll",
|
|
||||||
"database_name": "default_write_concern_db",
|
|
||||||
"runOn": [
|
|
||||||
{
|
{
|
||||||
"minServerVersion": "3.4"
|
"minServerVersion": "3.4"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"createEntities": [
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"id": "client0",
|
||||||
|
"observeEvents": [
|
||||||
|
"commandStartedEvent"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"database": {
|
||||||
|
"id": "database0",
|
||||||
|
"client": "client0",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"databaseOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collection": {
|
||||||
|
"id": "collection0",
|
||||||
|
"database": "database0",
|
||||||
|
"collectionName": "coll",
|
||||||
|
"collectionOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"initialData": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 1,
|
||||||
|
"x": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": 2,
|
||||||
|
"x": 22
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"description": "Aggregate with $out omits default write concern",
|
"description": "Aggregate with $out omits default write concern",
|
||||||
|
"runOnRequirements": [
|
||||||
|
{
|
||||||
|
"serverless": "forbid"
|
||||||
|
}
|
||||||
|
],
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"name": "aggregate",
|
"name": "aggregate",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"pipeline": [
|
"pipeline": [
|
||||||
@ -42,77 +80,89 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outcome": {
|
"expectEvents": [
|
||||||
"collection": {
|
{
|
||||||
"name": "other_collection_name",
|
"client": "client0",
|
||||||
"data": [
|
"events": [
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"aggregate": "coll",
|
||||||
|
"pipeline": [
|
||||||
|
{
|
||||||
|
"$match": {
|
||||||
|
"_id": {
|
||||||
|
"$gt": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$out": "other_collection_name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outcome": [
|
||||||
|
{
|
||||||
|
"collectionName": "other_collection_name",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
{
|
{
|
||||||
"_id": 2,
|
"_id": 2,
|
||||||
"x": 22
|
"x": 22
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"expectations": [
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"aggregate": "default_write_concern_coll",
|
|
||||||
"pipeline": [
|
|
||||||
{
|
|
||||||
"$match": {
|
|
||||||
"_id": {
|
|
||||||
"$gt": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$out": "other_collection_name"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "RunCommand with a write command omits default write concern (runCommand should never inherit write concern)",
|
"description": "RunCommand with a write command omits default write concern (runCommand should never inherit write concern)",
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"object": "database",
|
"object": "database0",
|
||||||
"databaseOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"name": "runCommand",
|
"name": "runCommand",
|
||||||
"command_name": "delete",
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"command": {
|
"command": {
|
||||||
"delete": "default_write_concern_coll",
|
"delete": "coll",
|
||||||
"deletes": [
|
"deletes": [
|
||||||
{
|
{
|
||||||
"q": {},
|
"q": {},
|
||||||
"limit": 1
|
"limit": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"commandName": "delete"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expectations": [
|
"expectEvents": [
|
||||||
{
|
{
|
||||||
"command_started_event": {
|
"client": "client0",
|
||||||
"command": {
|
"events": [
|
||||||
"delete": "default_write_concern_coll",
|
{
|
||||||
"deletes": [
|
"commandStartedEvent": {
|
||||||
{
|
"command": {
|
||||||
"q": {},
|
"delete": "coll",
|
||||||
"limit": 1
|
"deletes": [
|
||||||
|
{
|
||||||
|
"q": {},
|
||||||
|
"limit": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
"writeConcern": null
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -120,10 +170,7 @@
|
|||||||
"description": "CreateIndex and dropIndex omits default write concern",
|
"description": "CreateIndex and dropIndex omits default write concern",
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"name": "createIndex",
|
"name": "createIndex",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"keys": {
|
"keys": {
|
||||||
@ -132,53 +179,61 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"name": "dropIndex",
|
"name": "dropIndex",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"name": "x_1"
|
"name": "x_1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expectations": [
|
"expectEvents": [
|
||||||
{
|
{
|
||||||
"command_started_event": {
|
"client": "client0",
|
||||||
"command": {
|
"events": [
|
||||||
"createIndexes": "default_write_concern_coll",
|
{
|
||||||
"indexes": [
|
"commandStartedEvent": {
|
||||||
{
|
"command": {
|
||||||
"name": "x_1",
|
"createIndexes": "coll",
|
||||||
"key": {
|
"indexes": [
|
||||||
"x": 1
|
{
|
||||||
|
"name": "x_1",
|
||||||
|
"key": {
|
||||||
|
"x": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
"writeConcern": null
|
},
|
||||||
|
{
|
||||||
|
"commandStartedEvent": {
|
||||||
|
"command": {
|
||||||
|
"dropIndexes": "coll",
|
||||||
|
"index": "x_1",
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"command_started_event": {
|
|
||||||
"command": {
|
|
||||||
"dropIndexes": "default_write_concern_coll",
|
|
||||||
"index": "x_1",
|
|
||||||
"writeConcern": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "MapReduce omits default write concern",
|
"description": "MapReduce omits default write concern",
|
||||||
|
"runOnRequirements": [
|
||||||
|
{
|
||||||
|
"serverless": "forbid"
|
||||||
|
}
|
||||||
|
],
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"name": "mapReduce",
|
"name": "mapReduce",
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"map": {
|
"map": {
|
||||||
"$code": "function inc() { return emit(0, this.x + 1) }"
|
"$code": "function inc() { return emit(0, this.x + 1) }"
|
||||||
@ -192,23 +247,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expectations": [
|
"expectEvents": [
|
||||||
{
|
{
|
||||||
"command_started_event": {
|
"client": "client0",
|
||||||
"command": {
|
"events": [
|
||||||
"mapReduce": "default_write_concern_coll",
|
{
|
||||||
"map": {
|
"commandStartedEvent": {
|
||||||
"$code": "function inc() { return emit(0, this.x + 1) }"
|
"command": {
|
||||||
},
|
"mapReduce": "coll",
|
||||||
"reduce": {
|
"map": {
|
||||||
"$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
|
"$code": "function inc() { return emit(0, this.x + 1) }"
|
||||||
},
|
},
|
||||||
"out": {
|
"reduce": {
|
||||||
"inline": 1
|
"$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
|
||||||
},
|
},
|
||||||
"writeConcern": null
|
"out": {
|
||||||
|
"inline": 1
|
||||||
|
},
|
||||||
|
"writeConcern": {
|
||||||
|
"$$exists": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +1,63 @@
|
|||||||
{
|
{
|
||||||
"data": [
|
"description": "default-write-concern-4.2",
|
||||||
{
|
"schemaVersion": "1.0",
|
||||||
"_id": 1,
|
"runOnRequirements": [
|
||||||
"x": 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_id": 2,
|
|
||||||
"x": 22
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"collection_name": "default_write_concern_coll",
|
|
||||||
"database_name": "default_write_concern_db",
|
|
||||||
"runOn": [
|
|
||||||
{
|
{
|
||||||
"minServerVersion": "4.2"
|
"minServerVersion": "4.2"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"createEntities": [
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"id": "client0",
|
||||||
|
"observeEvents": [
|
||||||
|
"commandStartedEvent"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"database": {
|
||||||
|
"id": "database0",
|
||||||
|
"client": "client0",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"databaseOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collection": {
|
||||||
|
"id": "collection0",
|
||||||
|
"database": "database0",
|
||||||
|
"collectionName": "coll",
|
||||||
|
"collectionOptions": {
|
||||||
|
"writeConcern": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"initialData": [
|
||||||
|
{
|
||||||
|
"collectionName": "coll",
|
||||||
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"_id": 1,
|
||||||
|
"x": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": 2,
|
||||||
|
"x": 22
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"description": "Aggregate with $merge omits default write concern",
|
"description": "Aggregate with $merge omits default write concern",
|
||||||
"operations": [
|
"operations": [
|
||||||
{
|
{
|
||||||
"object": "collection",
|
"object": "collection0",
|
||||||
"databaseOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"collectionOptions": {
|
|
||||||
"writeConcern": {}
|
|
||||||
},
|
|
||||||
"name": "aggregate",
|
"name": "aggregate",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"pipeline": [
|
"pipeline": [
|
||||||
@ -47,41 +77,49 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expectations": [
|
"expectEvents": [
|
||||||
{
|
{
|
||||||
"command_started_event": {
|
"client": "client0",
|
||||||
"command": {
|
"events": [
|
||||||
"aggregate": "default_write_concern_coll",
|
{
|
||||||
"pipeline": [
|
"commandStartedEvent": {
|
||||||
{
|
"command": {
|
||||||
"$match": {
|
"aggregate": "coll",
|
||||||
"_id": {
|
"pipeline": [
|
||||||
"$gt": 1
|
{
|
||||||
|
"$match": {
|
||||||
|
"_id": {
|
||||||
|
"$gt": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$merge": {
|
||||||
|
"into": "other_collection_name"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
},
|
"writeConcern": {
|
||||||
{
|
"$$exists": false
|
||||||
"$merge": {
|
|
||||||
"into": "other_collection_name"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
"writeConcern": null
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outcome": {
|
"outcome": [
|
||||||
"collection": {
|
{
|
||||||
"name": "other_collection_name",
|
"collectionName": "other_collection_name",
|
||||||
"data": [
|
"databaseName": "default-write-concern-tests",
|
||||||
|
"documents": [
|
||||||
{
|
{
|
||||||
"_id": 2,
|
"_id": 2,
|
||||||
"x": 22
|
"x": 22
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,14 +23,13 @@ import warnings
|
|||||||
sys.path[0:0] = [""]
|
sys.path[0:0] = [""]
|
||||||
|
|
||||||
from test import IntegrationTest, client_context, unittest
|
from test import IntegrationTest, client_context, unittest
|
||||||
|
from test.unified_format import generate_test_classes
|
||||||
from test.utils import (
|
from test.utils import (
|
||||||
EventListener,
|
EventListener,
|
||||||
SpecTestCreator,
|
|
||||||
disable_replication,
|
disable_replication,
|
||||||
enable_replication,
|
enable_replication,
|
||||||
rs_or_single_client,
|
rs_or_single_client,
|
||||||
)
|
)
|
||||||
from test.utils_spec_runner import SpecRunner
|
|
||||||
|
|
||||||
from pymongo import DESCENDING
|
from pymongo import DESCENDING
|
||||||
from pymongo.errors import (
|
from pymongo.errors import (
|
||||||
@ -321,25 +320,15 @@ def create_tests():
|
|||||||
create_tests()
|
create_tests()
|
||||||
|
|
||||||
|
|
||||||
class TestOperation(SpecRunner):
|
# Generate unified tests.
|
||||||
# Location of JSON test specifications.
|
# PyMongo does not support MapReduce.
|
||||||
TEST_PATH = os.path.join(_TEST_PATH, "operation")
|
globals().update(
|
||||||
|
generate_test_classes(
|
||||||
def get_outcome_coll_name(self, outcome, collection):
|
os.path.join(_TEST_PATH, "operation"),
|
||||||
"""Spec says outcome has an optional 'collection.name'."""
|
module=__name__,
|
||||||
return outcome["collection"].get("name", collection.name)
|
expected_failures=["MapReduce .*"],
|
||||||
|
)
|
||||||
|
)
|
||||||
def create_operation_test(scenario_def, test, name):
|
|
||||||
@client_context.require_test_commands
|
|
||||||
def run_scenario(self):
|
|
||||||
self.run_scenario(scenario_def, test)
|
|
||||||
|
|
||||||
return run_scenario
|
|
||||||
|
|
||||||
|
|
||||||
test_creator = SpecTestCreator(create_operation_test, TestOperation, TestOperation.TEST_PATH)
|
|
||||||
test_creator.create_tests()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from test.unified_format import generate_test_classes
|
|||||||
TEST_PATH = Path(__file__).parent / "retryable_reads/unified"
|
TEST_PATH = Path(__file__).parent / "retryable_reads/unified"
|
||||||
|
|
||||||
# Generate unified tests.
|
# Generate unified tests.
|
||||||
# PyMongo does not supportMapReduce, ListDatabaseObjects or ListCollectionObjects.
|
# PyMongo does not support MapReduce, ListDatabaseObjects or ListCollectionObjects.
|
||||||
globals().update(
|
globals().update(
|
||||||
generate_test_classes(
|
generate_test_classes(
|
||||||
TEST_PATH,
|
TEST_PATH,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user