Skip to content

DRIVERS-2232: remove usages of currentOp and collStats from tests #1402

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 2 commits into from
Apr 19, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ tests:
command:
ping: 1
command_name: ping
- description: "current op is not bypassed"
- description: "kill op is not bypassed"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of this test seems to test that bypassed commands are passed (it tests with ping above) and then this test asserts that a command that isn't encrypted or bypassed errors.

Replacing currentOp with killOp (another command that is neither bypassed or encrypted) tests the same scenario.

clientOptions:
autoEncryptOpts:
kmsProviders:
aws: {} # Credentials filled in from environment.
operations:
- name: runCommand
object: database
command_name: currentOp
command_name: killOp
arguments:
command:
currentOp: 1
killOp: 1
op: 1234
result:
errorContains: "command not supported for auto encryption: currentOp"
errorContains: "command not supported for auto encryption: killOp"
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
]
},
{
"description": "current op is not bypassed",
"description": "kill op is not bypassed",
"clientOptions": {
"autoEncryptOpts": {
"kmsProviders": {
Expand All @@ -90,14 +90,15 @@
{
"name": "runCommand",
"object": "database",
"command_name": "currentOp",
"command_name": "killOp",
"arguments": {
"command": {
"currentOp": 1
"killOp": 1,
"op": 1234
}
},
"result": {
"errorContains": "command not supported for auto encryption: currentOp"
"errorContains": "command not supported for auto encryption: killOp"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ tests:
command:
ping: 1
command_name: ping
- description: "current op is not bypassed"
- description: "kill op is not bypassed"
clientOptions:
autoEncryptOpts:
kmsProviders:
aws: {} # Credentials filled in from environment.
operations:
- name: runCommand
object: database
command_name: currentOp
command_name: killOp
arguments:
command:
currentOp: 1
killOp: 1
op: 1234
result:
errorContains: "command not supported for auto encryption: currentOp"
errorContains: "command not supported for auto encryption: killOp"
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,29 @@
"description": "collection is created with the correct options",
"operations": [
{
"name": "runCommand",
"object": "database0",
"object": "collection0",
"name": "aggregate",
"arguments": {
"commandName": "collStats",
"command": {
"collStats": "coll0",
"scale": 1
}
"pipeline": [
{
"$collStats": {
"storageStats": {}
}
},
{
"$project": {
"capped": "$storageStats.capped",
"maxSize": "$storageStats.maxSize"
}
}
]
},
"expectResult": {
"capped": true,
"maxSize": 4096
}
"expectResult": [
{
"capped": true,
"maxSize": 4096
}
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
description: collectionData-createOptions

schemaVersion: "1.9"

runOnRequirements:
- minServerVersion: "3.6"
# Capped collections cannot be created on serverless instances.
serverless: forbid

createEntities:
- client:
id: &client0 client0
Expand All @@ -18,7 +15,6 @@ createEntities:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
Expand All @@ -28,18 +24,14 @@ initialData:
size: &cappedSize 4096
documents:
- { _id: 1, x: 11 }

tests:
- description: collection is created with the correct options
operations:
# Execute a collStats command to ensure the collection was created with the correct options.
- name: runCommand
object: *database0
- object: *collection0
name: aggregate
arguments:
commandName: collStats
command:
collStats: *collection0Name
scale: 1
pipeline:
- $collStats: { storageStats: {} }
- $project: { capped: '$storageStats.capped', maxSize: '$storageStats.maxSize'}
expectResult:
capped: true
maxSize: *cappedSize
- { capped: true, maxSize: *cappedSize }