-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-1440: Sync range v2 spec tests to latest version #1373
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,9 @@ | |
"command": { | ||
"compactStructuredEncryptionData": "default" | ||
} | ||
}, | ||
"result": { | ||
"ok": 1 | ||
} | ||
} | ||
], | ||
|
290 changes: 290 additions & 0 deletions
290
tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Compact.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,290 @@ | ||
{ | ||
"runOn": [ | ||
{ | ||
"minServerVersion": "8.0.0", | ||
"topology": [ | ||
"replicaset", | ||
"sharded", | ||
"load-balanced" | ||
], | ||
"serverless": "forbid" | ||
} | ||
], | ||
"database_name": "default", | ||
"collection_name": "default", | ||
"data": [], | ||
"encrypted_fields": { | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedInt", | ||
"bsonType": "int", | ||
"queries": { | ||
"queryType": "range", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"trimFactor": { | ||
"$numberInt": "1" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$numberInt": "0" | ||
}, | ||
"max": { | ||
"$numberInt": "200" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"key_vault_data": [ | ||
{ | ||
"_id": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"keyMaterial": { | ||
"$binary": { | ||
"base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", | ||
"subType": "00" | ||
} | ||
}, | ||
"creationDate": { | ||
"$date": { | ||
"$numberLong": "1648914851981" | ||
} | ||
}, | ||
"updateDate": { | ||
"$date": { | ||
"$numberLong": "1648914851981" | ||
} | ||
}, | ||
"status": { | ||
"$numberInt": "0" | ||
}, | ||
"masterKey": { | ||
"provider": "local" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "Compact works with 'range' fields", | ||
"clientOptions": { | ||
"autoEncryptOpts": { | ||
"kmsProviders": { | ||
"local": { | ||
"key": { | ||
"$binary": { | ||
"base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", | ||
"subType": "00" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"operations": [ | ||
{ | ||
"name": "insertOne", | ||
"arguments": { | ||
"document": { | ||
"_id": 0, | ||
"encryptedInt": { | ||
"$numberInt": "0" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "runCommand", | ||
"object": "database", | ||
"command_name": "compactStructuredEncryptionData", | ||
"arguments": { | ||
"command": { | ||
"compactStructuredEncryptionData": "default" | ||
} | ||
}, | ||
"result": { | ||
"ok": 1 | ||
} | ||
} | ||
], | ||
"expectations": [ | ||
{ | ||
"command_started_event": { | ||
"command": { | ||
"listCollections": 1, | ||
"filter": { | ||
"name": "default" | ||
} | ||
}, | ||
"command_name": "listCollections" | ||
} | ||
}, | ||
{ | ||
"command_started_event": { | ||
"command": { | ||
"find": "datakeys", | ||
"filter": { | ||
"$or": [ | ||
{ | ||
"_id": { | ||
"$in": [ | ||
{ | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"keyAltNames": { | ||
"$in": [] | ||
} | ||
} | ||
] | ||
}, | ||
"$db": "keyvault", | ||
"readConcern": { | ||
"level": "majority" | ||
} | ||
}, | ||
"command_name": "find" | ||
} | ||
}, | ||
{ | ||
"command_started_event": { | ||
"command": { | ||
"insert": "default", | ||
"documents": [ | ||
{ | ||
"_id": 0, | ||
"encryptedInt": { | ||
"$$type": "binData" | ||
} | ||
} | ||
], | ||
"ordered": true, | ||
"encryptionInformation": { | ||
"type": 1, | ||
"schema": { | ||
"default.default": { | ||
"escCollection": "enxcol_.default.esc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedInt", | ||
"bsonType": "int", | ||
"queries": { | ||
"queryType": "range", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"trimFactor": { | ||
"$numberInt": "1" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$numberInt": "0" | ||
}, | ||
"max": { | ||
"$numberInt": "200" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"command_name": "insert" | ||
} | ||
}, | ||
{ | ||
"command_started_event": { | ||
"command": { | ||
"compactStructuredEncryptionData": "default", | ||
"compactionTokens": { | ||
"encryptedInt": { | ||
"ecoc": { | ||
"$binary": { | ||
"base64": "noN+05JsuO1oDg59yypIGj45i+eFH6HOTXOPpeZ//Mk=", | ||
"subType": "00" | ||
} | ||
}, | ||
"anchorPaddingToken": { | ||
"$binary": { | ||
"base64": "QxKJD2If48p0l8NAXf2Kr0aleMd/dATSjBK6hTpNMyc=", | ||
"subType": "00" | ||
} | ||
} | ||
} | ||
}, | ||
"encryptionInformation": { | ||
"type": 1, | ||
"schema": { | ||
"default.default": { | ||
"escCollection": "enxcol_.default.esc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedInt", | ||
"bsonType": "int", | ||
"queries": { | ||
"queryType": "range", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"trimFactor": { | ||
"$numberInt": "1" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$numberInt": "0" | ||
}, | ||
"max": { | ||
"$numberInt": "200" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"command_name": "compactStructuredEncryptionData" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed a similar assertion in fle2v2-Rangev2-Compact as that test failed due to a type mismatch:
Doesn't the absence of a
result
field imply that the command should at least succeed, but no assertions on the result should be made? If so, then this result expectation isn't really necessary, as the command failing should trip up test runners regardless. Note that this is the legacy CSFLE test runner, so its behaviour may be a little more undefined than the unified test runner.If this expectation is not necessary, I'd update the spec tests; if it is we'd have to update our matcher to ignore the type difference. What do you think @jmikola?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure where the ambiguity is coming from here (I know mongod and mongos used to differ in what they used for
ok
), but I assume PHPLIB's legacy test runner isn't handling flexible numeric comparisons as we mandate in the unified runner.The runCommand spec doesn't talk about throwing in the event of an unsuccessful response (i.e.
ok
is not 1 or 1.0), but I'd hope we can trust the legacy test runner to throw in the event of an unsuccessful command. Would be good to run this by @kevinAlbs if you wanted to remove the result expectation entirely.Otherwise, we can consider adding flexible numeric comparisons to PHPLIB's legacy runner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mongodb/specifications#1605 noted:
As a result, a bug in libmongocrypt (MONGOCRYPT-699) had gone unnoticed (at least in libmongoc's legacy test runner).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying! I'll update our legacy test runner accordingly.