-
Notifications
You must be signed in to change notification settings - Fork 906
GODRIVER-3140 Update client-side-encryption spec tests. #1651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
qingyang-hu
wants to merge
13
commits into
mongodb:master
Choose a base branch
from
qingyang-hu:godriver3140
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
18a7e7e
GODRIVER-3140 Update spec tests.
qingyang-hu 5ab8f15
GODRIVER-3140 Update help function.
qingyang-hu b0455bf
minor fix for configureFailPoint
qingyang-hu 47abc06
updates
qingyang-hu 3ddf46a
clear logic
qingyang-hu 737d995
Merge branch 'v1' into godriver3140
qingyang-hu 928555a
updates
qingyang-hu 12fb07c
minor fix
qingyang-hu bec2c08
Merge branch 'v1' into godriver3140
qingyang-hu 163b83e
minor update
qingyang-hu a2e8ac9
Merge branch 'v1' into godriver3140
qingyang-hu e230a32
Merge branch 'master' into godriver3140
qingyang-hu 828df7b
cache clients for failpoints.
qingyang-hu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
{ | ||
"runOn": [ | ||
{ | ||
"minServerVersion": "4.4" | ||
} | ||
], | ||
"database_name": "cse-timeouts-db", | ||
"collection_name": "cse-timeouts-coll", | ||
"data": [], | ||
"json_schema": { | ||
"properties": { | ||
"encrypted_w_altname": { | ||
"encrypt": { | ||
"keyId": "/altname", | ||
"bsonType": "string", | ||
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" | ||
} | ||
}, | ||
"encrypted_string": { | ||
"encrypt": { | ||
"keyId": [ | ||
{ | ||
"$binary": { | ||
"base64": "AAAAAAAAAAAAAAAAAAAAAA==", | ||
"subType": "04" | ||
} | ||
} | ||
], | ||
"bsonType": "string", | ||
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" | ||
} | ||
}, | ||
"random": { | ||
"encrypt": { | ||
"keyId": [ | ||
{ | ||
"$binary": { | ||
"base64": "AAAAAAAAAAAAAAAAAAAAAA==", | ||
"subType": "04" | ||
} | ||
} | ||
], | ||
"bsonType": "string", | ||
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" | ||
} | ||
}, | ||
"encrypted_string_equivalent": { | ||
"encrypt": { | ||
"keyId": [ | ||
{ | ||
"$binary": { | ||
"base64": "AAAAAAAAAAAAAAAAAAAAAA==", | ||
"subType": "04" | ||
} | ||
} | ||
], | ||
"bsonType": "string", | ||
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" | ||
} | ||
} | ||
}, | ||
"bsonType": "object" | ||
}, | ||
"key_vault_data": [ | ||
{ | ||
"status": 1, | ||
"_id": { | ||
"$binary": { | ||
"base64": "AAAAAAAAAAAAAAAAAAAAAA==", | ||
"subType": "04" | ||
} | ||
}, | ||
"masterKey": { | ||
"provider": "aws", | ||
"key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", | ||
"region": "us-east-1" | ||
}, | ||
"updateDate": { | ||
"$date": { | ||
"$numberLong": "1552949630483" | ||
} | ||
}, | ||
"keyMaterial": { | ||
"$binary": { | ||
"base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", | ||
"subType": "00" | ||
} | ||
}, | ||
"creationDate": { | ||
"$date": { | ||
"$numberLong": "1552949630483" | ||
} | ||
}, | ||
"keyAltNames": [ | ||
"altname", | ||
"another_altname" | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "timeoutMS applied to listCollections to get collection schema", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"listCollections" | ||
], | ||
"blockConnection": true, | ||
"blockTimeMS": 60 | ||
} | ||
}, | ||
"clientOptions": { | ||
"autoEncryptOpts": { | ||
"kmsProviders": { | ||
"aws": {} | ||
} | ||
}, | ||
"timeoutMS": 50 | ||
}, | ||
"operations": [ | ||
{ | ||
"name": "insertOne", | ||
"arguments": { | ||
"document": { | ||
"_id": 1, | ||
"encrypted_string": "string0", | ||
"random": "abc" | ||
} | ||
}, | ||
"result": { | ||
"isTimeoutError": true | ||
} | ||
} | ||
], | ||
"expectations": [ | ||
{ | ||
"command_started_event": { | ||
"command": { | ||
"listCollections": 1, | ||
"filter": { | ||
"name": "cse-timeouts-coll" | ||
}, | ||
"maxTimeMS": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
} | ||
}, | ||
"command_name": "listCollections" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "remaining timeoutMS applied to find to get keyvault data", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 2 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"listCollections", | ||
"find" | ||
], | ||
"blockConnection": true, | ||
"blockTimeMS": 30 | ||
} | ||
}, | ||
"clientOptions": { | ||
"autoEncryptOpts": { | ||
"kmsProviders": { | ||
"aws": {} | ||
} | ||
}, | ||
"timeoutMS": 50 | ||
}, | ||
"operations": [ | ||
{ | ||
"name": "insertOne", | ||
"arguments": { | ||
"document": { | ||
"_id": 1, | ||
"encrypted_string": "string0", | ||
"random": "abc" | ||
} | ||
}, | ||
"result": { | ||
"isTimeoutError": true | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
runOn: | ||
- minServerVersion: "4.4" | ||
database_name: &database_name "cse-timeouts-db" | ||
collection_name: &collection_name "cse-timeouts-coll" | ||
|
||
data: [] | ||
json_schema: {'properties': {'encrypted_w_altname': {'encrypt': {'keyId': '/altname', 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'}}, 'encrypted_string': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}, 'random': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'}}, 'encrypted_string_equivalent': {'encrypt': {'keyId': [{'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}], 'bsonType': 'string', 'algorithm': 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'}}}, 'bsonType': 'object'} | ||
key_vault_data: [{'status': 1, '_id': {'$binary': {'base64': 'AAAAAAAAAAAAAAAAAAAAAA==', 'subType': '04'}}, 'masterKey': {'provider': 'aws', 'key': 'arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0', 'region': 'us-east-1'}, 'updateDate': {'$date': {'$numberLong': '1552949630483'}}, 'keyMaterial': {'$binary': {'base64': 'AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO', 'subType': '00'}}, 'creationDate': {'$date': {'$numberLong': '1552949630483'}}, 'keyAltNames': ['altname', 'another_altname']}] | ||
|
||
tests: | ||
- description: "timeoutMS applied to listCollections to get collection schema" | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 1 } | ||
data: | ||
failCommands: ["listCollections"] | ||
blockConnection: true | ||
blockTimeMS: 60 | ||
clientOptions: | ||
autoEncryptOpts: | ||
kmsProviders: | ||
aws: {} # Credentials filled in from environment. | ||
timeoutMS: 50 | ||
operations: | ||
- name: insertOne | ||
arguments: | ||
document: &doc0 { _id: 1, encrypted_string: "string0", random: "abc" } | ||
result: | ||
isTimeoutError: true | ||
expectations: | ||
# Auto encryption will request the collection info. | ||
- command_started_event: | ||
command: | ||
listCollections: 1 | ||
filter: | ||
name: *collection_name | ||
maxTimeMS: { $$type: ["int", "long"] } | ||
command_name: listCollections | ||
|
||
# Test that timeoutMS applies to the sum of all operations done for client-side encryption. This is done by blocking | ||
# listCollections and find for 30ms each and running an insertOne with timeoutMS=50. There should be one | ||
# listCollections command and one "find" command, so the sum should take more than timeoutMS. A second listCollections | ||
# event doesn't occur due to the internal MongoClient lacking configured auto encryption, plus libmongocrypt holds the | ||
# collection schema in cache for a minute. | ||
# | ||
# This test does not include command monitoring expectations because the exact command sequence is dependent on the | ||
# amount of time taken by mongocryptd communication. In slow runs, mongocryptd communication can breach the timeout | ||
# and result in the final "find" not being sent. | ||
- description: "remaining timeoutMS applied to find to get keyvault data" | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 2 } | ||
data: | ||
failCommands: ["listCollections", "find"] | ||
blockConnection: true | ||
blockTimeMS: 30 | ||
clientOptions: | ||
autoEncryptOpts: | ||
kmsProviders: | ||
aws: {} # Credentials filled in from environment. | ||
timeoutMS: 50 | ||
operations: | ||
- name: insertOne | ||
arguments: | ||
document: *doc0 | ||
result: | ||
isTimeoutError: true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added spec tests include both
AutoEncryptionOptions
and"configureFailPoint"
, which seems to suggest that"configureFailPoint"
is being run successfully during the test (to enable the failpoint). Does disabling failpoints behave differently than enabling failpoints whenAutoEncryptionOptions
are set?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, clearing fail point fails for "mongocrypt error 1: command not supported for auto encryption: configureFailPoint".^ The issue was caused because of GODRIVER-2123.