Skip to content

Commit 1593236

Browse files
sync tests, update build script to use my fork of libmongocrypt to test changes
1 parent 8e06e72 commit 1593236

12 files changed

+2882
-2
lines changed

.evergreen/install-mongodb-client-encryption.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ -z ${PROJECT_DIRECTORY+omitted} ]; then echo "PROJECT_DIRECTORY is unset" &
99
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
1010

1111
rm -rf mongodb-client-encryption
12-
git clone https://github.com/mongodb-js/mongodb-client-encryption.git
12+
git clone https://github.com/baileympearson/mongodb-client-encryption.git -b NODE-7059
1313
pushd mongodb-client-encryption
1414

1515
node --version

test/integration/client-side-encryption/client_side_encryption.spec.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('Client Side Encryption (Legacy)', function () {
6262
});
6363
});
6464

65-
describe('Client Side Encryption (Unified)', function () {
65+
describe.only('Client Side Encryption (Unified)', function () {
6666
runUnifiedSuite(
6767
loadSpecTests(path.join('client-side-encryption', 'tests', 'unified')),
6868
({ description }, configuration) => {
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
{
2+
"description": "QE-Text-cleanupStructuredEncryptionData",
3+
"schemaVersion": "1.23",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "8.2.0",
7+
"topologies": [
8+
"replicaset",
9+
"sharded",
10+
"load-balanced"
11+
],
12+
"csfle": true
13+
}
14+
],
15+
"createEntities": [
16+
{
17+
"client": {
18+
"id": "client",
19+
"autoEncryptOpts": {
20+
"keyVaultNamespace": "keyvault.datakeys",
21+
"kmsProviders": {
22+
"local": {
23+
"key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk"
24+
}
25+
}
26+
},
27+
"observeEvents": [
28+
"commandStartedEvent"
29+
]
30+
}
31+
},
32+
{
33+
"database": {
34+
"id": "db",
35+
"client": "client",
36+
"databaseName": "db"
37+
}
38+
},
39+
{
40+
"collection": {
41+
"id": "coll",
42+
"database": "db",
43+
"collectionName": "coll"
44+
}
45+
}
46+
],
47+
"initialData": [
48+
{
49+
"databaseName": "keyvault",
50+
"collectionName": "datakeys",
51+
"documents": [
52+
{
53+
"_id": {
54+
"$binary": {
55+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
56+
"subType": "04"
57+
}
58+
},
59+
"keyMaterial": {
60+
"$binary": {
61+
"base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==",
62+
"subType": "00"
63+
}
64+
},
65+
"creationDate": {
66+
"$date": {
67+
"$numberLong": "1648914851981"
68+
}
69+
},
70+
"updateDate": {
71+
"$date": {
72+
"$numberLong": "1648914851981"
73+
}
74+
},
75+
"status": {
76+
"$numberInt": "0"
77+
},
78+
"masterKey": {
79+
"provider": "local"
80+
}
81+
}
82+
]
83+
},
84+
{
85+
"databaseName": "db",
86+
"collectionName": "coll",
87+
"documents": [],
88+
"createOptions": {
89+
"encryptedFields": {
90+
"fields": [
91+
{
92+
"keyId": {
93+
"$binary": {
94+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
95+
"subType": "04"
96+
}
97+
},
98+
"path": "encryptedText",
99+
"bsonType": "string",
100+
"queries": [
101+
{
102+
"queryType": "suffixPreview",
103+
"contention": {
104+
"$numberLong": "0"
105+
},
106+
"strMinQueryLength": {
107+
"$numberLong": "3"
108+
},
109+
"strMaxQueryLength": {
110+
"$numberLong": "30"
111+
},
112+
"caseSensitive": true,
113+
"diacriticSensitive": true
114+
}
115+
]
116+
}
117+
]
118+
}
119+
}
120+
}
121+
],
122+
"tests": [
123+
{
124+
"description": "QE Text cleanupStructuredEncryptionData works",
125+
"operations": [
126+
{
127+
"name": "runCommand",
128+
"object": "db",
129+
"arguments": {
130+
"command": {
131+
"cleanupStructuredEncryptionData": "coll"
132+
},
133+
"commandName": "cleanupStructuredEncryptionData"
134+
},
135+
"expectResult": {
136+
"ok": 1
137+
}
138+
}
139+
],
140+
"expectEvents": [
141+
{
142+
"client": "client",
143+
"events": [
144+
{
145+
"commandStartedEvent": {
146+
"command": {
147+
"listCollections": 1,
148+
"filter": {
149+
"name": "coll"
150+
}
151+
},
152+
"commandName": "listCollections"
153+
}
154+
},
155+
{
156+
"commandStartedEvent": {
157+
"command": {
158+
"find": "datakeys",
159+
"filter": {
160+
"$or": [
161+
{
162+
"_id": {
163+
"$in": [
164+
{
165+
"$binary": {
166+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
167+
"subType": "04"
168+
}
169+
}
170+
]
171+
}
172+
},
173+
{
174+
"keyAltNames": {
175+
"$in": []
176+
}
177+
}
178+
]
179+
},
180+
"$db": "keyvault",
181+
"readConcern": {
182+
"level": "majority"
183+
}
184+
},
185+
"commandName": "find"
186+
}
187+
},
188+
{
189+
"commandStartedEvent": {
190+
"command": {
191+
"cleanupStructuredEncryptionData": "coll",
192+
"cleanupTokens": {
193+
"encryptedText": {
194+
"ecoc": {
195+
"$binary": {
196+
"base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=",
197+
"subType": "00"
198+
}
199+
},
200+
"anchorPaddingToken": {
201+
"$binary": {
202+
"base64": "YAiF7Iwhqq1UyfxPvm70xfQJtrIRPrjfD2yRLG1+saQ=",
203+
"subType": "00"
204+
}
205+
}
206+
}
207+
}
208+
},
209+
"commandName": "cleanupStructuredEncryptionData"
210+
}
211+
}
212+
]
213+
}
214+
]
215+
}
216+
]
217+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
description: QE-Text-cleanupStructuredEncryptionData
2+
schemaVersion: "1.23"
3+
runOnRequirements:
4+
# Requires libmongocrypt 1.15.0 for SPM-4158.
5+
- minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries.
6+
topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone.
7+
csfle: true
8+
createEntities:
9+
- client:
10+
id: &client "client"
11+
autoEncryptOpts:
12+
keyVaultNamespace: keyvault.datakeys
13+
kmsProviders:
14+
local:
15+
key: Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk
16+
observeEvents:
17+
- commandStartedEvent
18+
- database:
19+
id: &db "db"
20+
client: *client
21+
databaseName: *db
22+
- collection:
23+
id: &coll "coll"
24+
database: *db
25+
collectionName: *coll
26+
initialData:
27+
# Insert data encryption key:
28+
- databaseName: keyvault
29+
collectionName: datakeys
30+
documents:
31+
[
32+
{
33+
"_id": &keyid { "$binary": { "base64": "q83vqxI0mHYSNBI0VniQEg==", "subType": "04" } },
34+
"keyMaterial":
35+
{
36+
"$binary":
37+
{
38+
"base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==",
39+
"subType": "00",
40+
},
41+
},
42+
"creationDate": { "$date": { "$numberLong": "1648914851981" } },
43+
"updateDate": { "$date": { "$numberLong": "1648914851981" } },
44+
"status": { "$numberInt": "0" },
45+
"masterKey": { "provider": "local" },
46+
},
47+
]
48+
# Create encrypted collection:
49+
- databaseName: *db
50+
collectionName: *coll
51+
documents: []
52+
createOptions:
53+
encryptedFields:
54+
{
55+
"fields":
56+
[
57+
{
58+
"keyId": *keyid,
59+
"path": "encryptedText",
60+
"bsonType": "string",
61+
"queries": [
62+
{
63+
"queryType": "suffixPreview",
64+
"contention": { "$numberLong": "0" },
65+
"strMinQueryLength": { "$numberLong": "3" },
66+
"strMaxQueryLength": { "$numberLong": "30" },
67+
"caseSensitive": true,
68+
"diacriticSensitive": true,
69+
},
70+
],
71+
},
72+
],
73+
}
74+
tests:
75+
- description: "QE Text cleanupStructuredEncryptionData works"
76+
operations:
77+
- name: runCommand
78+
object: *db
79+
arguments:
80+
command:
81+
cleanupStructuredEncryptionData: *coll
82+
commandName: cleanupStructuredEncryptionData
83+
expectResult: { ok: 1 }
84+
expectEvents:
85+
- client: *client
86+
events:
87+
- commandStartedEvent:
88+
command:
89+
listCollections: 1
90+
filter:
91+
name: *coll
92+
commandName: listCollections
93+
- commandStartedEvent:
94+
command:
95+
find: datakeys
96+
filter:
97+
{
98+
"$or":
99+
[
100+
"_id": { "$in": [ *keyid ] },
101+
"keyAltNames": { "$in": [] },
102+
],
103+
}
104+
$db: keyvault
105+
readConcern: { level: "majority" }
106+
commandName: find
107+
- commandStartedEvent:
108+
command:
109+
{
110+
"cleanupStructuredEncryptionData": *coll,
111+
"cleanupTokens": {
112+
"encryptedText": {
113+
"ecoc": {
114+
"$binary": {
115+
"base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=",
116+
"subType": "00"
117+
}
118+
},
119+
"anchorPaddingToken": {
120+
"$binary": {
121+
"base64": "YAiF7Iwhqq1UyfxPvm70xfQJtrIRPrjfD2yRLG1+saQ=",
122+
"subType": "00"
123+
}
124+
}
125+
}
126+
}
127+
}
128+
commandName: cleanupStructuredEncryptionData

0 commit comments

Comments
 (0)