Skip to content

Commit 904db53

Browse files
authored
CDRIVER-4317 Add support for clientEncryption entity in unified test runner (#975)
* Bump JSON schema version from 1.5 to 1.8 * Print actual value in BSON match error messages * Add support for clientEncryption entity in unified tests * Add unified test format tests for clientEncryption entity * Add support for "runOnRequirement.csfle"
1 parent ba73833 commit 904db53

9 files changed

+807
-9
lines changed

src/libmongoc/tests/bsonutil/bson-match.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@ is_special_match (const bson_t *bson)
6060
return true;
6161
}
6262

63+
/* implements $$placeholder */
64+
static bool
65+
special_placeholder (bson_matcher_t *matcher,
66+
const bson_t *assertion,
67+
const bson_val_t *actual,
68+
void *ctx,
69+
const char *path,
70+
bson_error_t *error)
71+
{
72+
/* Nothing to do (not an operator, just a reserved key value). The meaning
73+
* and corresponding behavior of $$placeholder depends on context. */
74+
return true;
75+
}
76+
6377
/* implements $$exists */
6478
static bool
6579
special_exists (bson_matcher_t *matcher,
@@ -300,6 +314,8 @@ bson_matcher_new ()
300314
{
301315
bson_matcher_t *matcher = bson_malloc0 (sizeof (bson_matcher_t));
302316
/* Add default special functions. */
317+
bson_matcher_add_special (
318+
matcher, "$$placeholder", special_placeholder, NULL);
303319
bson_matcher_add_special (matcher, "$$exists", special_exists, NULL);
304320
bson_matcher_add_special (matcher, "$$type", special_type, NULL);
305321
bson_matcher_add_special (
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"description": "kmsProviders-explicit_kms_credentials",
3+
"schemaVersion": "1.8",
4+
"runOnRequirements": [
5+
{
6+
"csfle": true
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0"
13+
}
14+
},
15+
{
16+
"clientEncryption": {
17+
"id": "clientEncryption0",
18+
"clientEncryptionOpts": {
19+
"keyVaultClient": "client0",
20+
"keyVaultNamespace": "keyvault.datakeys",
21+
"kmsProviders": {
22+
"aws": {
23+
"accessKeyId": "accessKeyId",
24+
"secretAccessKey": "secretAccessKey"
25+
},
26+
"azure": {
27+
"tenantId": "tenantId",
28+
"clientId": "clientId",
29+
"clientSecret": "clientSecret"
30+
},
31+
"gcp": {
32+
"email": "email",
33+
"privateKey": "cHJpdmF0ZUtleQo="
34+
},
35+
"kmip": {
36+
"endpoint": "endpoint"
37+
},
38+
"local": {
39+
"key": "a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5"
40+
}
41+
}
42+
}
43+
}
44+
}
45+
],
46+
"tests": [
47+
{
48+
"description": "",
49+
"operations": []
50+
}
51+
]
52+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"description": "kmsProviders-mixed_kms_credential_fields",
3+
"schemaVersion": "1.8",
4+
"runOnRequirements": [
5+
{
6+
"csfle": true
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0"
13+
}
14+
},
15+
{
16+
"clientEncryption": {
17+
"id": "clientEncryption0",
18+
"clientEncryptionOpts": {
19+
"keyVaultClient": "client0",
20+
"keyVaultNamespace": "keyvault.datakeys",
21+
"kmsProviders": {
22+
"aws": {
23+
"accessKeyId": "accessKeyId",
24+
"secretAccessKey": {
25+
"$$placeholder": 1
26+
}
27+
},
28+
"azure": {
29+
"tenantId": "tenantId",
30+
"clientId": {
31+
"$$placeholder": 1
32+
},
33+
"clientSecret": {
34+
"$$placeholder": 1
35+
}
36+
},
37+
"gcp": {
38+
"email": "email",
39+
"privateKey": {
40+
"$$placeholder": 1
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}
47+
],
48+
"tests": [
49+
{
50+
"description": "",
51+
"operations": []
52+
}
53+
]
54+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"description": "kmsProviders-placeholder_kms_credentials",
3+
"schemaVersion": "1.8",
4+
"runOnRequirements": [
5+
{
6+
"csfle": true
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0"
13+
}
14+
},
15+
{
16+
"clientEncryption": {
17+
"id": "clientEncryption0",
18+
"clientEncryptionOpts": {
19+
"keyVaultClient": "client0",
20+
"keyVaultNamespace": "keyvault.datakeys",
21+
"kmsProviders": {
22+
"aws": {
23+
"accessKeyId": {
24+
"$$placeholder": 1
25+
},
26+
"secretAccessKey": {
27+
"$$placeholder": 1
28+
}
29+
},
30+
"azure": {
31+
"tenantId": {
32+
"$$placeholder": 1
33+
},
34+
"clientId": {
35+
"$$placeholder": 1
36+
},
37+
"clientSecret": {
38+
"$$placeholder": 1
39+
}
40+
},
41+
"gcp": {
42+
"email": {
43+
"$$placeholder": 1
44+
},
45+
"privateKey": {
46+
"$$placeholder": 1
47+
}
48+
},
49+
"kmip": {
50+
"endpoint": {
51+
"$$placeholder": 1
52+
}
53+
},
54+
"local": {
55+
"key": {
56+
"$$placeholder": 1
57+
}
58+
}
59+
}
60+
}
61+
}
62+
}
63+
],
64+
"tests": [
65+
{
66+
"description": "",
67+
"operations": []
68+
}
69+
]
70+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"description": "kmsProviders-unconfigured_kms",
3+
"schemaVersion": "1.8",
4+
"runOnRequirements": [
5+
{
6+
"csfle": true
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0"
13+
}
14+
},
15+
{
16+
"clientEncryption": {
17+
"id": "clientEncryption0",
18+
"clientEncryptionOpts": {
19+
"keyVaultClient": "client0",
20+
"keyVaultNamespace": "keyvault.datakeys",
21+
"kmsProviders": {
22+
"aws": {},
23+
"azure": {},
24+
"gcp": {},
25+
"kmip": {},
26+
"local": {}
27+
}
28+
}
29+
}
30+
}
31+
],
32+
"tests": [
33+
{
34+
"description": "",
35+
"operations": []
36+
}
37+
]
38+
}

0 commit comments

Comments
 (0)