Skip to content

Commit 284e2f9

Browse files
GODRIVER-2433 Add specification tests for Range Index (#1140)
* resync unrelated test files. * add fle2-Range spec tests * install libmongocrypt 1.7.0-alpha0 Necessary to get range feature support. This will be updated once there is a 1.7.0 stable release. * print error if 'fullDocument' not present This is to help diagnose an observed test failure. Co-authored-by: Benjamin Rewis <[email protected]>
1 parent df2ba0f commit 284e2f9

File tree

69 files changed

+34690
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+34690
-17
lines changed

.evergreen/config.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ functions:
9393
go version
9494
go env
9595
96-
LIBMONGOCRYPT_TAG="1.6.1"
96+
# TODO(GODRIVER-2676): use libmongocrypt 1.7.0 once it is released.
97+
LIBMONGOCRYPT_TAG="1.7.0-alpha0"
9798
# Install libmongocrypt based on OS.
9899
if [ "Windows_NT" = "$OS" ]; then
99100
mkdir -p c:/libmongocrypt/include
@@ -102,7 +103,11 @@ functions:
102103
mkdir libmongocrypt-all
103104
cd libmongocrypt-all
104105
# The following URL is published from the upload-all task in the libmongocrypt Evergreen project.
105-
curl https://mciuploads.s3.amazonaws.com/libmongocrypt/all/$LIBMONGOCRYPT_TAG/libmongocrypt-all.tar.gz -o libmongocrypt-all.tar.gz
106+
# TODO(GODRIVER-2676): replace this URL once libmongocrypt 1.7.0 is released with the following:
107+
# curl https://mciuploads.s3.amazonaws.com/libmongocrypt/all/$LIBMONGOCRYPT_TAG/libmongocrypt-all.tar.gz -o libmongocrypt-all.tar.gz
108+
# There is no tag URL for libmongocrypt pre-releases.
109+
LIBMONGOCRYPT_COMMIT=a162f4871cface46bdade94cdf7e3ad9459297af
110+
curl https://mciuploads.s3.amazonaws.com/libmongocrypt/all/master/$LIBMONGOCRYPT_COMMIT/libmongocrypt-all.tar.gz -o libmongocrypt-all.tar.gz
106111
tar -xf libmongocrypt-all.tar.gz
107112
cd ..
108113
cp libmongocrypt-all/windows-test/bin/mongocrypt.dll c:/libmongocrypt/bin

mongo/integration/client_side_encryption_prose_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
11401140
// Insert already encrypted data and verify that it is automatically decrypted by Next().
11411141
insertDocuments(mt, cpt.coll, []bson.Raw{testConfig.EncryptedDocument})
11421142
assert.True(mt, stream.Next(context.Background()), "expected Next to return true, got false")
1143-
gotDocument := stream.Current.Lookup("fullDocument").Document()
1143+
gotValue, err := stream.Current.LookupErr("fullDocument")
1144+
assert.Nil(mt, err, "did not find fullDocument in stream.Current: %v", stream.Current)
1145+
gotDocument := gotValue.Document()
11441146
err = compareDocs(mt, testConfig.DecryptedDocument, gotDocument)
11451147
assert.Nil(mt, err, "compareDocs error: %v", err)
11461148
})

testdata/client-side-encryption/legacy/azureKMS.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@
6464
"bsonType": "string",
6565
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
6666
}
67+
},
68+
"encrypted_string_kmip": {
69+
"encrypt": {
70+
"keyId": [
71+
{
72+
"$binary": {
73+
"base64": "dBHpr8aITfeBQ15grpbLpQ==",
74+
"subType": "04"
75+
}
76+
}
77+
],
78+
"bsonType": "string",
79+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
80+
}
6781
}
6882
},
6983
"bsonType": "object"

testdata/client-side-encryption/legacy/azureKMS.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ database_name: &database_name "default"
44
collection_name: &collection_name "default"
55

66
data: []
7-
json_schema: {'properties': {'encrypted_string_aws': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_azure': {'encrypt': {'keyId': [{'$binary': {'base64': 'AZURE+AAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_gcp': {'encrypt': {'keyId': [{'$binary': {'base64': 'GCP+AAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_local': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}}, 'bsonType': 'object'}
7+
json_schema: {'properties': {'encrypted_string_aws': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_azure': {'encrypt': {'keyId': [{'$binary': {'base64': 'AZURE+AAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_gcp': {'encrypt': {'keyId': [{'$binary': {'base64': 'GCP+AAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_local': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'encrypted_string_kmip': {'encrypt': {'keyId': [{'$binary': {'base64': 'dBHpr8aITfeBQ15grpbLpQ==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}}, 'bsonType': 'object'}
88
key_vault_data: [{'_id': {'$binary': {'base64': 'AZURE+AAAAAAAAAAAAAAAA==', 'subType': '04'}}, 'keyMaterial': {'$binary': {'base64': 'n+HWZ0ZSVOYA3cvQgP7inN4JSXfOH85IngmeQxRpQHjCCcqT3IFqEWNlrsVHiz3AELimHhX4HKqOLWMUeSIT6emUDDoQX9BAv8DR1+E1w4nGs/NyEneac78EYFkK3JysrFDOgl2ypCCTKAypkn9CkAx1if4cfgQE93LW4kczcyHdGiH36CIxrCDGv1UzAvERN5Qa47DVwsM6a+hWsF2AAAJVnF0wYLLJU07TuRHdMrrphPWXZsFgyV+lRqJ7DDpReKNO8nMPLV/mHqHBHGPGQiRdb9NoJo8CvokGz4+KE8oLwzKf6V24dtwZmRkrsDV4iOhvROAzz+Euo1ypSkL3mw==', 'subType': '00'}}, 'creationDate': {'$date': {'$numberLong': '1601573901680'}}, 'updateDate': {'$date': {'$numberLong': '1601573901680'}}, 'status': {'$numberInt': '0'}, 'masterKey': {'provider': 'azure', 'keyVaultEndpoint': 'key-vault-csfle.vault.azure.net', 'keyName': 'key-name-csfle'}, 'keyAltNames': ['altname', 'azure_altname']}]
99

1010
tests:

testdata/client-side-encryption/legacy/badQueries.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ tests:
476476
filter: { }
477477
update: { $set : { "encrypted_string": [1,2] }}
478478
result:
479-
# The expected error message changed in mongocryptd 6.0. Before it was:
479+
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
480480
# "Cannot encrypt element of type array because schema requires that type is one of: [ string ]"
481481
# After it is:
482482
# "Cannot encrypt element of type: array"
@@ -505,7 +505,7 @@ tests:
505505
arguments:
506506
document: { encrypted_string: [ "123", "456"] }
507507
result:
508-
# The expected error message changed in mongocryptd 6.0. Before it was:
508+
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
509509
# "Cannot encrypt element of type array because schema requires that type is one of: [ string ]"
510510
# After it is:
511511
# "Cannot encrypt element of type: array"

0 commit comments

Comments
 (0)