Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRIVERS-2286 Add specification tests for Range Index (#1352)
* add auto encryption spec tests for Range Index
- Loading branch information
Showing
97 changed files
with
46,056 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
source/client-side-encryption/etc/data/encryptedFields-Range-Date.json
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,36 @@ | ||
{ | ||
"escCollection": "enxcol_.default.esc", | ||
"eccCollection": "enxcol_.default.ecc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedDate", | ||
"bsonType": "date", | ||
"queries": { | ||
"queryType": "rangePreview", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$date": { | ||
"$numberLong": "0" | ||
} | ||
}, | ||
"max": { | ||
"$date": { | ||
"$numberLong": "200" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
source/client-side-encryption/etc/data/encryptedFields-Range-Double.json
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,26 @@ | ||
{ | ||
"escCollection": "enxcol_.default.esc", | ||
"eccCollection": "enxcol_.default.ecc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedDouble", | ||
"bsonType": "double", | ||
"queries": { | ||
"queryType": "rangePreview", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
} | ||
} | ||
} | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
source/client-side-encryption/etc/data/encryptedFields-Range-DoublePrecision.json
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,35 @@ | ||
{ | ||
"escCollection": "enxcol_.default.esc", | ||
"eccCollection": "enxcol_.default.ecc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedDoublePrecision", | ||
"bsonType": "double", | ||
"queries": { | ||
"queryType": "rangePreview", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$numberDouble": "0.0" | ||
}, | ||
"max": { | ||
"$numberDouble": "200.0" | ||
}, | ||
"precision": { | ||
"$numberInt": "2" | ||
} | ||
} | ||
} | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
source/client-side-encryption/etc/data/encryptedFields-Range-Int.json
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,32 @@ | ||
{ | ||
"escCollection": "enxcol_.default.esc", | ||
"eccCollection": "enxcol_.default.ecc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedInt", | ||
"bsonType": "int", | ||
"queries": { | ||
"queryType": "rangePreview", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$numberInt": "0" | ||
}, | ||
"max": { | ||
"$numberInt": "200" | ||
} | ||
} | ||
} | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
source/client-side-encryption/etc/data/encryptedFields-Range-Long.json
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,32 @@ | ||
{ | ||
"escCollection": "enxcol_.default.esc", | ||
"eccCollection": "enxcol_.default.ecc", | ||
"ecocCollection": "enxcol_.default.ecoc", | ||
"fields": [ | ||
{ | ||
"keyId": { | ||
"$binary": { | ||
"base64": "EjRWeBI0mHYSNBI0VniQEg==", | ||
"subType": "04" | ||
} | ||
}, | ||
"path": "encryptedLong", | ||
"bsonType": "long", | ||
"queries": { | ||
"queryType": "rangePreview", | ||
"contention": { | ||
"$numberLong": "0" | ||
}, | ||
"sparsity": { | ||
"$numberLong": "1" | ||
}, | ||
"min": { | ||
"$numberLong": "0" | ||
}, | ||
"max": { | ||
"$numberLong": "200" | ||
} | ||
} | ||
} | ||
] | ||
} |
227 changes: 227 additions & 0 deletions
227
source/client-side-encryption/etc/test-templates/fle2-Range-Date-Aggregate.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,227 @@ | ||
# Requires libmongocrypt 1.7.0. | ||
runOn: | ||
- minServerVersion: "6.2.0" | ||
# FLE 2 Encrypted collections are not supported on standalone. | ||
topology: [ "replicaset", "sharded", "load-balanced" ] | ||
database_name: &database_name "default" | ||
collection_name: &collection_name "default" | ||
data: [] | ||
encrypted_fields: &encrypted_fields {{ yamlfile("encryptedFields-Range-Date.json") }} | ||
key_vault_data: [ {{ yamlfile("keys/key1-document.json") }} ] | ||
tests: | ||
- description: "FLE2 Range Date. Aggregate." | ||
clientOptions: | ||
autoEncryptOpts: | ||
kmsProviders: | ||
local: {{ local_provider() }} | ||
operations: | ||
- name: insertOne | ||
arguments: | ||
document: &doc0 { _id: 0, encryptedDate: {$date: { $numberLong: "0" }} } | ||
- name: insertOne | ||
arguments: | ||
document: &doc1 { _id: 1, encryptedDate: {$date: { $numberLong: "1" }} } | ||
- name: aggregate | ||
arguments: | ||
pipeline: [{ $match: { "encryptedDate": { $gt: {$date: {$numberLong: "0" }}} } }] | ||
result: [*doc1] | ||
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: | ||
- &doc0_encrypted { "_id": 0, "encryptedDate": { $$type: "binData" } } | ||
ordered: true | ||
encryptionInformation: | ||
type: 1 | ||
schema: | ||
default.default: *encrypted_fields | ||
command_name: insert | ||
- command_started_event: | ||
command: | ||
insert: *collection_name | ||
documents: | ||
- &doc1_encrypted { "_id": 1, "encryptedDate": { $$type: "binData" } } | ||
ordered: true | ||
encryptionInformation: | ||
type: 1 | ||
schema: | ||
default.default: *encrypted_fields | ||
command_name: insert | ||
- command_started_event: | ||
command: | ||
aggregate: *collection_name | ||
pipeline: [ | ||
{ | ||
"$match": { | ||
"encryptedDate": { | ||
"$gt": { | ||
"$binary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ZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVjACAAAAAAD51NYesiO4Fo7w7iWBfqAFxEqkaDVctpvzZ28nT4SE8AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWMAIAAAAABJDtFhJ2tPbowp1UUmOCN/rqSqHRL1dtMu0c47vIlK4wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FYwAgAAAAAE6kvmXPqTnYIH4EJmNhy8OLVJZFOmdiBXLMorhELjKWAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVjACAAAAAA85AiE+bNFAYQTXQAFexgeczdVhf8FUnf16WzJlI/kmsAAAVlACAAAAAA65pz95EthqQpfoHS9nWvdCh05AV+OokP7GUaI+7j8+wSY20AAAAAAAAAAAAAEHBheWxvYWRJZAAAAAAAEGZpcnN0T3BlcmF0b3IAAQAAAAA=", | ||
"subType": "06" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
cursor: {} | ||
encryptionInformation: | ||
type: 1 | ||
schema: | ||
default.default: *encrypted_fields | ||
command_name: aggregate | ||
outcome: | ||
collection: | ||
# Outcome is checked using a separate MongoClient without auto encryption. | ||
data: | ||
- | ||
{ | ||
"_id": 0, | ||
"encryptedDate": { $$type: "binData" }, | ||
"__safeContent__": [ | ||
{ | ||
"$binary": { | ||
"base64": "5nRutVIyq7URVOVtbE4vM01APSIajAVnsShMwjBlzkM=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", | ||
"subType": "00" | ||
} | ||
} | ||
] | ||
} | ||
- | ||
{ | ||
"_id": 1, | ||
"encryptedDate": { $$type: "binData" }, | ||
"__safeContent__": [ | ||
{ | ||
"$binary": { | ||
"base64": "bE1vqWj3KNyM7cCYUv/cnYm8BPaUL3eMp5syTHq6NF4=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", | ||
"subType": "00" | ||
} | ||
}, | ||
{ | ||
"$binary": { | ||
"base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", | ||
"subType": "00" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.