PHPLIB-533: Separate BulkWrite tests by operation

parent 8109cb7e
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"database_name": "crud-tests", "database_name": "crud-tests",
"tests": [ "tests": [
{ {
"description": "BulkWrite with arrayFilters", "description": "BulkWrite updateOne with arrayFilters",
"operations": [ "operations": [
{ {
"name": "bulkWrite", "name": "bulkWrite",
...@@ -53,7 +53,86 @@ ...@@ -53,7 +53,86 @@
} }
] ]
} }
}, }
],
"options": {
"ordered": true
}
},
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test",
"updates": [
{
"q": {},
"u": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
}
],
"ordered": true
},
"command_name": "update",
"database_name": "crud-tests"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
},
{
"description": "BulkWrite updateMany with arrayFilters",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{ {
"name": "updateMany", "name": "updateMany",
"arguments": { "arguments": {
...@@ -79,8 +158,8 @@ ...@@ -79,8 +158,8 @@
"deletedCount": 0, "deletedCount": 0,
"insertedCount": 0, "insertedCount": 0,
"insertedIds": {}, "insertedIds": {},
"matchedCount": 3, "matchedCount": 2,
"modifiedCount": 3, "modifiedCount": 2,
"upsertedCount": 0, "upsertedCount": 0,
"upsertedIds": {} "upsertedIds": {}
} }
...@@ -92,19 +171,6 @@ ...@@ -92,19 +171,6 @@
"command": { "command": {
"update": "test", "update": "test",
"updates": [ "updates": [
{
"q": {},
"u": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
},
{ {
"q": {}, "q": {},
"u": { "u": {
...@@ -134,7 +200,7 @@ ...@@ -134,7 +200,7 @@
"_id": 1, "_id": 1,
"y": [ "y": [
{ {
"b": 2 "b": 3
}, },
{ {
"b": 2 "b": 2
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"collection_name": "test_bulkwrite_update_hint", "collection_name": "test_bulkwrite_update_hint",
"tests": [ "tests": [
{ {
"description": "BulkWrite with update hints", "description": "BulkWrite updateOne with update hints",
"operations": [ "operations": [
{ {
"name": "bulkWrite", "name": "bulkWrite",
...@@ -60,7 +60,89 @@ ...@@ -60,7 +60,89 @@
"_id": 1 "_id": 1
} }
} }
}, }
],
"options": {
"ordered": true
}
},
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 13
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite updateMany with update hints",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{ {
"name": "updateMany", "name": "updateMany",
"arguments": { "arguments": {
...@@ -94,32 +176,6 @@ ...@@ -94,32 +176,6 @@
"_id": 1 "_id": 1
} }
} }
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_"
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 444
},
"hint": {
"_id": 1
}
}
} }
], ],
"options": { "options": {
...@@ -130,8 +186,8 @@ ...@@ -130,8 +186,8 @@
"deletedCount": 0, "deletedCount": 0,
"insertedCount": 0, "insertedCount": 0,
"insertedIds": {}, "insertedIds": {},
"matchedCount": 8, "matchedCount": 4,
"modifiedCount": 8, "modifiedCount": 4,
"upsertedCount": 0, "upsertedCount": 0,
"upsertedIds": {} "upsertedIds": {}
} }
...@@ -143,30 +199,6 @@ ...@@ -143,30 +199,6 @@
"command": { "command": {
"update": "test_bulkwrite_update_hint", "update": "test_bulkwrite_update_hint",
"updates": [ "updates": [
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
},
{ {
"q": { "q": {
"_id": { "_id": {
...@@ -196,7 +228,91 @@ ...@@ -196,7 +228,91 @@
"hint": { "hint": {
"_id": 1 "_id": 1
} }
}, }
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 13
},
{
"_id": 2,
"x": 24
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite replaceOne with update hints",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_"
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 444
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{ {
"q": { "q": {
"_id": 3 "_id": 3
...@@ -228,11 +344,11 @@ ...@@ -228,11 +344,11 @@
"data": [ "data": [
{ {
"_id": 1, "_id": 1,
"x": 15 "x": 11
}, },
{ {
"_id": 2, "_id": 2,
"x": 24 "x": 22
}, },
{ {
"_id": 3, "_id": 3,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment