Skip to content

PHPLIB-841: Tests for aggregate allowDiskUse option #913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions tests/UnifiedSpecTests/UnifiedSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,90 @@ class UnifiedSpecTest extends FunctionalTestCase
'valid-pass/entity-client-cmap-events: events are captured during an operation' => 'PHPC does not implement CMAP',
'valid-pass/expectedEventsForClient-eventType: eventType can be set to command and cmap' => 'PHPC does not implement CMAP',
'valid-pass/expectedEventsForClient-eventType: eventType defaults to command if unset' => 'PHPC does not implement CMAP',
// CRUD "comment" option is not yet implemented
'crud/bulkWrite-comment: BulkWrite with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/bulkWrite-comment: BulkWrite with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/bulkWrite-comment: BulkWrite with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/deleteMany-comment: deleteMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/deleteMany-comment: deleteMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/deleteMany-comment: deleteMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/deleteOne-comment: deleteOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/deleteOne-comment: deleteOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/deleteOne-comment: deleteOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/find-comment: find with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/find-comment: find with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/find-comment: find with document comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/find-comment: find with comment sets comment on getMore' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndDelete-comment: findOneAndDelete with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndDelete-comment: findOneAndDelete with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndDelete-comment: findOneAndDelete with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndReplace-comment: findOneAndReplace with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndReplace-comment: findOneAndReplace with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndReplace-comment: findOneAndReplace with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndUpdate-comment: findOneAndUpdate with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndUpdate-comment: findOneAndUpdate with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/findOneAndUpdate-comment: findOneAndUpdate with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/insertMany-comment: insertMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/insertMany-comment: insertMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/insertMany-comment: insertMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/insertOne-comment: insertOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/insertOne-comment: insertOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/insertOne-comment: insertOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/replaceOne-comment: ReplaceOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/replaceOne-comment: ReplaceOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/replaceOne-comment: ReplaceOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/updateMany-comment: UpdateMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/updateMany-comment: UpdateMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/updateMany-comment: UpdateMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/updateOne-comment: UpdateOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/updateOne-comment: UpdateOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/updateOne-comment: UpdateOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/aggregate: aggregate with comment sets comment on getMore' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/aggregate: aggregate with a document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
'crud/aggregate: aggregate with a document comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
// CRUD "let" option is not yet implemented
'crud/BulkWrite deleteMany-let: BulkWrite deleteMany-let' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite deleteMany-let: BulkWrite deleteMany with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite deleteMany-let: BulkWrite deleteMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite deleteOne-let: BulkWrite deleteOne-let' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite deleteOne-let: BulkWrite deleteOne with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite deleteOne-let: BulkWrite deleteOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite replaceOne-let: BulkWrite replaceOne-let' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite replaceOne-let: BulkWrite replaceOne with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite replaceOne-let: BulkWrite replaceOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite updateMany-let: BulkWrite updateMany-let' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite updateMany-let: BulkWrite updateMany with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite updateMany-let: BulkWrite updateMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite updateOne-let: BulkWrite updateOne-let' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite updateOne-let: BulkWrite updateOne with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/BulkWrite updateOne-let: BulkWrite updateOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/deleteMany-let: deleteMany-let' => 'Not yet implemented (PHPLIB-748)',
'crud/deleteMany-let: deleteMany with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/deleteMany-let: deleteMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/deleteOne-let: deleteOne-let' => 'Not yet implemented (PHPLIB-748)',
'crud/deleteOne-let: deleteOne with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/deleteOne-let: deleteOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/find-let: find-let' => 'Not yet implemented (PHPLIB-748)',
'crud/find-let: Find with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/find-let: Find with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndDelete-let: findOneAndDelete-let' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndDelete-let: findOneAndDelete with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndDelete-let: findOneAndDelete with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndReplace-let: findOneAndReplace-let' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndReplace-let: findOneAndReplace with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndReplace-let: findOneAndReplace with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndUpdate-let: findOneAndUpdate-let' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndUpdate-let: findOneAndUpdate with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/findOneAndUpdate-let: findOneAndUpdate with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/replaceOne-let: replaceOne-let' => 'Not yet implemented (PHPLIB-748)',
'crud/replaceOne-let: ReplaceOne with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/replaceOne-let: ReplaceOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/updateMany-let: updateMany-let' => 'Not yet implemented (PHPLIB-748)',
'crud/updateMany-let: updateMany with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/updateMany-let: updateMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
'crud/updateOne-let: updateOne-let' => 'Not yet implemented (PHPLIB-748)',
'crud/updateOne-let: UpdateOne with let option' => 'Not yet implemented (PHPLIB-748)',
'crud/updateOne-let: UpdateOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
];

/** @var UnifiedTestRunner */
Expand Down
155 changes: 155 additions & 0 deletions tests/UnifiedSpecTests/crud/aggregate-allowdiskuse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"description": "aggregate-allowdiskuse",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-tests"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "crud-tests",
"documents": []
}
],
"tests": [
{
"description": "Aggregate does not send allowDiskUse when value is not specified",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$match": {}
}
]
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {}
}
],
"allowDiskUse": {
"$$exists": false
}
},
"commandName": "aggregate",
"databaseName": "crud-tests"
}
}
]
}
]
},
{
"description": "Aggregate sends allowDiskUse false when false is specified",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$match": {}
}
],
"allowDiskUse": false
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {}
}
],
"allowDiskUse": false
},
"commandName": "aggregate",
"databaseName": "crud-tests"
}
}
]
}
]
},
{
"description": "Aggregate sends allowDiskUse true when true is specified",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$match": {}
}
],
"allowDiskUse": true
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {}
}
],
"allowDiskUse": true
},
"commandName": "aggregate",
"databaseName": "crud-tests"
}
}
]
}
]
}
]
}
103 changes: 0 additions & 103 deletions tests/UnifiedSpecTests/crud/aggregate-let.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,109 +56,6 @@
"minServerVersion": "5.0"
}
],
"operations": [
{
"name": "aggregate",
"object": "collection0",
"arguments": {
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 0,
"x": "$$x",
"y": "$$y",
"rand": "$$rand"
}
}
],
"let": {
"id": 1,
"x": "foo",
"y": {
"$literal": "bar"
},
"rand": {
"$rand": {}
}
}
},
"expectResult": [
{
"x": "foo",
"y": "bar",
"rand": {
"$$type": "double"
}
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 0,
"x": "$$x",
"y": "$$y",
"rand": "$$rand"
}
}
],
"let": {
"id": 1,
"x": "foo",
"y": {
"$literal": "bar"
},
"rand": {
"$rand": {}
}
}
}
}
}
]
}
]
},
{
"description": "Aggregate with let option and dollar-prefixed $literal value",
"runOnRequirements": [
{
"minServerVersion": "5.0",
"topologies": [
"single",
"replicaset"
]
}
],
"operations": [
{
"name": "aggregate",
Expand Down
Loading