-
Notifications
You must be signed in to change notification settings - Fork 244
DRIVERS-3227 test text indexes with auto encryption #1823
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
15 commits
Select commit
Hold shift + click to select a range
53deb07
add QE text spec tests
kevinAlbs 7ea175d
generate JSON from YML tests
kevinAlbs 2147d11
copy schema-1.24 to schema-1.25
kevinAlbs 712ea0e
add `minLibmongocryptVersion`
kevinAlbs c827d57
fix wording in `runOnRequirement`
kevinAlbs 82ad3a5
update schema-latest.json and changelog
kevinAlbs df149d9
apply `minLibmongocryptVersion` to tests
kevinAlbs fd82726
use schema 1.25 in makefile
kevinAlbs eaff583
fix nesting
kevinAlbs 325e772
update "Current Schema Version"
kevinAlbs c00f2ff
use `--spec=draft2019` in `ajv` command
kevinAlbs 470b859
fix `description`
kevinAlbs b20bbb1
regenerate JSON
kevinAlbs 7ccd963
fix typo
kevinAlbs a49c5b7
add `invalid` tests
kevinAlbs 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
219 changes: 219 additions & 0 deletions
219
source/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
128 changes: 128 additions & 0 deletions
128
source/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml
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,128 @@ | ||
description: QE-Text-cleanupStructuredEncryptionData | ||
schemaVersion: "1.25" | ||
runOnRequirements: | ||
- minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries. | ||
topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone. | ||
csfle: | ||
minLibmongocryptVersion: 1.15.0 # For SPM-4158. | ||
createEntities: | ||
- client: | ||
id: &client "client" | ||
autoEncryptOpts: | ||
keyVaultNamespace: keyvault.datakeys | ||
kmsProviders: | ||
local: | ||
key: Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk | ||
observeEvents: | ||
- commandStartedEvent | ||
- database: | ||
id: &db "db" | ||
client: *client | ||
databaseName: *db | ||
- collection: | ||
id: &coll "coll" | ||
database: *db | ||
collectionName: *coll | ||
initialData: | ||
# Insert data encryption key: | ||
- databaseName: keyvault | ||
collectionName: datakeys | ||
documents: | ||
[ | ||
{ | ||
"_id": &keyid { "$binary": { "base64": "q83vqxI0mHYSNBI0VniQEg==", "subType": "04" } }, | ||
"keyMaterial": | ||
{ | ||
"$binary": | ||
{ | ||
"base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", | ||
"subType": "00", | ||
}, | ||
}, | ||
"creationDate": { "$date": { "$numberLong": "1648914851981" } }, | ||
"updateDate": { "$date": { "$numberLong": "1648914851981" } }, | ||
"status": { "$numberInt": "0" }, | ||
"masterKey": { "provider": "local" }, | ||
}, | ||
] | ||
# Create encrypted collection: | ||
- databaseName: *db | ||
collectionName: *coll | ||
documents: [] | ||
createOptions: | ||
encryptedFields: | ||
{ | ||
"fields": | ||
[ | ||
{ | ||
"keyId": *keyid, | ||
"path": "encryptedText", | ||
"bsonType": "string", | ||
"queries": [ | ||
{ | ||
"queryType": "suffixPreview", | ||
"contention": { "$numberLong": "0" }, | ||
"strMinQueryLength": { "$numberLong": "3" }, | ||
"strMaxQueryLength": { "$numberLong": "30" }, | ||
"caseSensitive": true, | ||
"diacriticSensitive": true, | ||
}, | ||
], | ||
}, | ||
], | ||
} | ||
tests: | ||
- description: "QE Text cleanupStructuredEncryptionData works" | ||
operations: | ||
- name: runCommand | ||
object: *db | ||
arguments: | ||
command: | ||
cleanupStructuredEncryptionData: *coll | ||
commandName: cleanupStructuredEncryptionData | ||
expectResult: { ok: 1 } | ||
expectEvents: | ||
- client: *client | ||
events: | ||
- commandStartedEvent: | ||
command: | ||
listCollections: 1 | ||
filter: | ||
name: *coll | ||
commandName: listCollections | ||
- commandStartedEvent: | ||
command: | ||
find: datakeys | ||
filter: | ||
{ | ||
"$or": | ||
[ | ||
"_id": { "$in": [ *keyid ] }, | ||
"keyAltNames": { "$in": [] }, | ||
], | ||
} | ||
$db: keyvault | ||
readConcern: { level: "majority" } | ||
commandName: find | ||
- commandStartedEvent: | ||
command: | ||
{ | ||
"cleanupStructuredEncryptionData": *coll, | ||
"cleanupTokens": { | ||
"encryptedText": { | ||
"ecoc": { | ||
"$binary": { | ||
"base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=", | ||
"subType": "00" | ||
} | ||
}, | ||
"anchorPaddingToken": { | ||
"$binary": { | ||
"base64": "YAiF7Iwhqq1UyfxPvm70xfQJtrIRPrjfD2yRLG1+saQ=", | ||
"subType": "00" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
commandName: cleanupStructuredEncryptionData |
Oops, something went wrong.
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.
Noted that this pertains to https://ajv.js.org/packages/ajv-cli.html#json-schema-language-and-version
Did something in this PR require introduction of the
--spec
option forajv-cli
? It looks like the schema URL was changed in db69351 whendeprecated
options were introduced.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.
Adding schema 1.25 led to the discovery of an existing issue using
ajv
to validate with schema 1.24:I expect this was undiscovered since there are no tests currently using the 1.24 format. Quoting #1809:
Adding the
--spec
argument appears to fix.ajv help
notesdraft7
(used in spec 1.23 and older) is the default.