Skip to content

Commit 1c1500a

Browse files
authored
DRIVERS-3106 revise fle2v2-BypassQueryAnalysis (#1789)
1 parent ca0e382 commit 1c1500a

File tree

5 files changed

+124
-44
lines changed

5 files changed

+124
-44
lines changed

source/client-side-encryption/tests/unified/fle2v2-BypassQueryAnalysis.json

Lines changed: 42 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-encryption/tests/unified/fle2v2-BypassQueryAnalysis.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ createEntities:
2828
id: &encryptedColl encryptedColl
2929
database: *encryptedDB
3030
collectionName: &encryptedCollName default
31+
- client:
32+
id: &client1 client1
33+
- database:
34+
id: &unencryptedDB unencryptedDB
35+
client: *client1
36+
databaseName: *encryptedDBName
37+
- collection:
38+
id: &unencryptedColl unencryptedColl
39+
database: *unencryptedDB
40+
collectionName: *encryptedCollName
3141

3242
initialData:
3343
- databaseName: &keyvaultDBName keyvault
@@ -61,6 +71,12 @@ tests:
6171
arguments:
6272
filter: { "_id": 1 }
6373
expectResult: [{"_id": 1, "encryptedIndexed": "123" }]
74+
- object: *unencryptedColl
75+
name: find
76+
arguments:
77+
filter: {}
78+
expectResult:
79+
- {"_id": 1, "encryptedIndexed": { "$$type": "binData" }, "__safeContent__": [{ "$binary" : { "base64" : "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", "subType" : "00" } }] }
6480
expectEvents:
6581
- client: *client0
6682
events:
@@ -111,9 +127,4 @@ tests:
111127
}
112128
$db: *keyvaultDBName
113129
readConcern: { level: "majority" }
114-
commandName: find
115-
outcome:
116-
- collectionName: *encryptedCollName
117-
databaseName: *encryptedDBName
118-
documents:
119-
- {"_id": 1, "encryptedIndexed": { "$$type": "binData" }, "__safeContent__": [{ "$binary" : { "base64" : "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", "subType" : "00" } }] }
130+
commandName: find

source/unified-test-format/tests/valid-pass/poc-queryable-encryption.json

Lines changed: 34 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/unified-test-format/tests/valid-pass/poc-queryable-encryption.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ createEntities:
2222
id: &encryptedColl encryptedColl
2323
database: *encryptedDB
2424
collectionName: &encryptedCollName encrypted
25+
- client:
26+
id: &client1 client1
27+
- database:
28+
id: &unencryptedDB unencryptedDB
29+
client: *client1
30+
databaseName: *encryptedDBName
31+
- collection:
32+
id: &unencryptedColl unencryptedColl
33+
database: *unencryptedDB
34+
collectionName: *encryptedCollName
2535

2636
initialData:
2737
- databaseName: keyvault
@@ -66,8 +76,9 @@ tests:
6676
expectResult:
6777
- _id: 1
6878
encryptedInt: 22
69-
outcome:
70-
- collectionName: *encryptedCollName
71-
databaseName: *encryptedDBName
72-
documents:
73-
- { _id: 1, encryptedInt: { $$type: binData }, __safeContent__: { $$type: array} }
79+
- object: *unencryptedColl
80+
name: find
81+
arguments:
82+
filter: {}
83+
expectResult:
84+
- { _id: 1, encryptedInt: { $$type: binData }, __safeContent__: [ { "$binary" : { "base64" : "rhS16TJojgDDBtbluxBokvcotP1mQTGeYpNt8xd3MJQ=", "subType" : "00" } } ] }

source/unified-test-format/unified-test-format.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,7 +3137,8 @@ If [test.runOnRequirements](#test_runOnRequirements) is specified, the test runn
31373137

31383138
If [initialData](#initialData) is specified, for each [collectionData](#collectiondata) therein the test runner MUST set
31393139
up the collection. All setup operations MUST use the internal MongoClient and a "majority" write concern. The test
3140-
runner MUST first drop the collection. If a `createOptions` document is present, the test runner MUST execute a `create`
3140+
runner MUST first drop the collection. The test runner must also drop the collections `_enxcol.<collectionName>.esc` and
3141+
`_enxcol.<collectionName>.ecoc`. If a `createOptions` document is present, the test runner MUST execute a `create`
31413142
command to create the collection with the specified options. The test runner MUST then insert the specified documents
31423143
(if any). If no documents are present and `createOptions` is not set, the test runner MUST create the collection. If the
31433144
topology is sharded, the test runner SHOULD use a single mongos for handling [initialData](#initialData) to avoid
@@ -3508,6 +3509,16 @@ ignored in order to test the test runner implementation (e.g. defining entities
35083509
The specification does prefer "MUST" in other contexts, such as discussing parts of the test file format that *are*
35093510
enforceable by the JSON schema or the test runner implementation.
35103511

3512+
<span id="rationale_dropping_metadata"></span>
3513+
3514+
### Why are `_enxcol` collections dropped?
3515+
3516+
The collections `_enxcol.<collectionName>.esc` and `_enxcol.<collectionName>.ecoc` are
3517+
[automatically created](../client-side-encryption/client-side-encryption.md#create-collection-helper) for Queryable
3518+
Encryption collections. If these collections are present and non-empty, the server generated `__safeContent__` field may
3519+
differ. `__safeContent__` includes a count of the number of instances of the given value. To do exact matching on
3520+
`__safeContent__` the test runner is required to drop these collections.
3521+
35113522
<span id="rationale_observeSensitiveCommands"></span>
35123523

35133524
### Why can't `observeSensitiveCommands` be true when authentication is enabled?
@@ -3569,8 +3580,10 @@ other specs *and* collating spec changes developed in parallel or during the sam
35693580

35703581
## Changelog
35713582

3583+
- 2025-04-25: Drop `_enxcol` collections.
3584+
35723585
- 2025-04-07: Add `topologyOpeningEvent` and `topologyClosedEvent` to the unified test format and schema 1.20+ as they
3573-
were omitted in error.
3586+
were omitted in error.
35743587

35753588
- 2025-01-21: **Schema version 1.23.**
35763589

0 commit comments

Comments
 (0)