Skip to content

Commit 3dec577

Browse files
author
Kyle Kloberdanz
authored
Add FLE 2 test for compactStructuredEncryptionData (#920)
CXX-2503 Drivers need to sync the new fle2-Compact test to this commit: mongodb/specifications@09ee1eb There are no functional changes needed.
1 parent 071d580 commit 3dec577

File tree

2 files changed

+234
-0
lines changed

2 files changed

+234
-0
lines changed
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "6.0.0",
5+
"topology": [
6+
"replicaset",
7+
"sharded",
8+
"load-balanced"
9+
]
10+
}
11+
],
12+
"database_name": "default",
13+
"collection_name": "default",
14+
"data": [],
15+
"encrypted_fields": {
16+
"escCollection": "enxcol_.default.esc",
17+
"eccCollection": "enxcol_.default.ecc",
18+
"ecocCollection": "enxcol_.default.ecoc",
19+
"fields": [
20+
{
21+
"keyId": {
22+
"$binary": {
23+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
24+
"subType": "04"
25+
}
26+
},
27+
"path": "encryptedIndexed",
28+
"bsonType": "string",
29+
"queries": {
30+
"queryType": "equality",
31+
"contention": {
32+
"$numberLong": "0"
33+
}
34+
}
35+
},
36+
{
37+
"keyId": {
38+
"$binary": {
39+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
40+
"subType": "04"
41+
}
42+
},
43+
"path": "encryptedUnindexed",
44+
"bsonType": "string"
45+
}
46+
]
47+
},
48+
"key_vault_data": [
49+
{
50+
"_id": {
51+
"$binary": {
52+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
53+
"subType": "04"
54+
}
55+
},
56+
"keyMaterial": {
57+
"$binary": {
58+
"base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==",
59+
"subType": "00"
60+
}
61+
},
62+
"creationDate": {
63+
"$date": {
64+
"$numberLong": "1648914851981"
65+
}
66+
},
67+
"updateDate": {
68+
"$date": {
69+
"$numberLong": "1648914851981"
70+
}
71+
},
72+
"status": {
73+
"$numberInt": "0"
74+
},
75+
"masterKey": {
76+
"provider": "local"
77+
}
78+
},
79+
{
80+
"_id": {
81+
"$binary": {
82+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
83+
"subType": "04"
84+
}
85+
},
86+
"keyMaterial": {
87+
"$binary": {
88+
"base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==",
89+
"subType": "00"
90+
}
91+
},
92+
"creationDate": {
93+
"$date": {
94+
"$numberLong": "1648914851981"
95+
}
96+
},
97+
"updateDate": {
98+
"$date": {
99+
"$numberLong": "1648914851981"
100+
}
101+
},
102+
"status": {
103+
"$numberInt": "0"
104+
},
105+
"masterKey": {
106+
"provider": "local"
107+
}
108+
}
109+
],
110+
"tests": [
111+
{
112+
"description": "Compact works",
113+
"clientOptions": {
114+
"autoEncryptOpts": {
115+
"kmsProviders": {
116+
"local": {
117+
"key": {
118+
"$binary": {
119+
"base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
120+
"subType": "00"
121+
}
122+
}
123+
}
124+
}
125+
}
126+
},
127+
"operations": [
128+
{
129+
"name": "runCommand",
130+
"object": "database",
131+
"command_name": "compactStructuredEncryptionData",
132+
"arguments": {
133+
"command": {
134+
"compactStructuredEncryptionData": "default"
135+
}
136+
}
137+
}
138+
],
139+
"expectations": [
140+
{
141+
"command_started_event": {
142+
"command": {
143+
"listCollections": 1,
144+
"filter": {
145+
"name": "default"
146+
}
147+
},
148+
"command_name": "listCollections"
149+
}
150+
},
151+
{
152+
"command_started_event": {
153+
"command": {
154+
"find": "datakeys",
155+
"filter": {
156+
"$or": [
157+
{
158+
"_id": {
159+
"$in": [
160+
{
161+
"$binary": {
162+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
163+
"subType": "04"
164+
}
165+
},
166+
{
167+
"$binary": {
168+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
169+
"subType": "04"
170+
}
171+
}
172+
]
173+
}
174+
},
175+
{
176+
"keyAltNames": {
177+
"$in": []
178+
}
179+
}
180+
]
181+
},
182+
"$db": "keyvault",
183+
"readConcern": {
184+
"level": "majority"
185+
}
186+
},
187+
"command_name": "find"
188+
}
189+
},
190+
{
191+
"command_started_event": {
192+
"command": {
193+
"compactStructuredEncryptionData": "default",
194+
"compactionTokens": {
195+
"encryptedIndexed": {
196+
"$binary": {
197+
"base64": "noN+05JsuO1oDg59yypIGj45i+eFH6HOTXOPpeZ//Mk=",
198+
"subType": "00"
199+
}
200+
},
201+
"encryptedUnindexed": {
202+
"$binary": {
203+
"base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=",
204+
"subType": "00"
205+
}
206+
}
207+
}
208+
},
209+
"command_name": "compactStructuredEncryptionData"
210+
}
211+
}
212+
]
213+
},
214+
{
215+
"description": "Compact errors on an unencrypted client",
216+
"operations": [
217+
{
218+
"name": "runCommand",
219+
"object": "database",
220+
"command_name": "compactStructuredEncryptionData",
221+
"arguments": {
222+
"command": {
223+
"compactStructuredEncryptionData": "default"
224+
}
225+
},
226+
"result": {
227+
"errorContains": "'compactStructuredEncryptionData.compactionTokens' is missing"
228+
}
229+
}
230+
]
231+
}
232+
]
233+
}

data/client_side_encryption/test_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ findOneAndDelete.json
1717
findOneAndReplace.json
1818
findOneAndUpdate.json
1919
fle2-BypassQueryAnalysis.json
20+
fle2-Compact.json
2021
fle2-CreateCollection.json
2122
fle2-DecryptExistingData.json
2223
fle2-Delete.json

0 commit comments

Comments
 (0)