-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRIVERS-2776 test compact with "range" (#1605)
* expect `ok: 1` in result To ensure the test runner asserts no error. * note bug in test * add test for compact with range * regenerate spec tests
- Loading branch information
Showing
6 changed files
with
484 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
93 changes: 93 additions & 0 deletions
93
source/client-side-encryption/etc/test-templates/fle2v2-Rangev2-Compact.yml.template
This file contains 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,93 @@ | ||
# Requires libmongocrypt 1.10.1. | ||
runOn: | ||
- minServerVersion: "8.0.0" # Require range v2 support on server. | ||
# FLE 2 Encrypted collections are not supported on standalone. | ||
topology: [ "replicaset", "sharded", "load-balanced" ] | ||
database_name: "default" | ||
collection_name: &collection_name "default" | ||
data: [] | ||
encrypted_fields: &encrypted_fields {{ yamlfile("range-encryptedFields-Int.json") }} | ||
key_vault_data: [ {{ yamlfile("keys/key1-document.json") }} ] | ||
tests: | ||
- description: "Compact works with 'range' fields" | ||
clientOptions: | ||
autoEncryptOpts: | ||
kmsProviders: | ||
local: {{ local_provider() }} | ||
operations: | ||
# Insert before running compact to ensure the server errors if `encryptionInformation` is incorrectly omitted. | ||
- name: insertOne | ||
arguments: | ||
document: { _id: 0, encryptedInt: { $numberInt: "0" } } | ||
- name: runCommand | ||
object: database | ||
command_name: compactStructuredEncryptionData | ||
arguments: | ||
command: | ||
compactStructuredEncryptionData: *collection_name | ||
result: | ||
ok: 1 | ||
expectations: | ||
- command_started_event: | ||
command: | ||
listCollections: 1 | ||
filter: | ||
name: *collection_name | ||
command_name: listCollections | ||
- command_started_event: | ||
command: | ||
find: datakeys | ||
filter: { | ||
"$or": [ | ||
{ | ||
"_id": { | ||
"$in": [ | ||
{{ yamlfile("keys/key1-id.json") }} | ||
] | ||
} | ||
}, | ||
{ | ||
"keyAltNames": { | ||
"$in": [] | ||
} | ||
} | ||
] | ||
} | ||
$db: keyvault | ||
readConcern: { level: "majority" } | ||
command_name: find | ||
- command_started_event: | ||
command: | ||
insert: *collection_name | ||
documents: | ||
- { "_id": 0, "encryptedInt": { $$type: "binData" } } | ||
ordered: true | ||
encryptionInformation: &encryptionInformation | ||
type: 1 | ||
schema: | ||
default.default: | ||
# libmongocrypt applies escCollection and ecocCollection to outgoing command. | ||
escCollection: "enxcol_.default.esc" | ||
ecocCollection: "enxcol_.default.ecoc" | ||
<<: *encrypted_fields | ||
command_name: insert | ||
- command_started_event: | ||
command: | ||
compactStructuredEncryptionData: *collection_name | ||
compactionTokens: | ||
"encryptedInt": { | ||
"ecoc": { | ||
"$binary": { | ||
"base64": "noN+05JsuO1oDg59yypIGj45i+eFH6HOTXOPpeZ//Mk=", | ||
"subType": "00" | ||
} | ||
}, | ||
"anchorPaddingToken": { | ||
"$binary": { | ||
"base64": "QxKJD2If48p0l8NAXf2Kr0aleMd/dATSjBK6hTpNMyc=", | ||
"subType": "00" | ||
} | ||
} | ||
} | ||
encryptionInformation: *encryptionInformation | ||
command_name: compactStructuredEncryptionData |
3 changes: 3 additions & 0 deletions
3
source/client-side-encryption/tests/legacy/fle2v2-Compact.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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.