Skip to content

Commit 18a7e7e

Browse files
committed
GODRIVER-3140 Update spec tests.
1 parent 9e50281 commit 18a7e7e

File tree

2 files changed

+267
-0
lines changed

2 files changed

+267
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.4"
5+
}
6+
],
7+
"database_name": "cse-timeouts-db",
8+
"collection_name": "cse-timeouts-coll",
9+
"data": [],
10+
"json_schema": {
11+
"properties": {
12+
"encrypted_w_altname": {
13+
"encrypt": {
14+
"keyId": "/altname",
15+
"bsonType": "string",
16+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
17+
}
18+
},
19+
"encrypted_string": {
20+
"encrypt": {
21+
"keyId": [
22+
{
23+
"$binary": {
24+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
25+
"subType": "04"
26+
}
27+
}
28+
],
29+
"bsonType": "string",
30+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
31+
}
32+
},
33+
"random": {
34+
"encrypt": {
35+
"keyId": [
36+
{
37+
"$binary": {
38+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
39+
"subType": "04"
40+
}
41+
}
42+
],
43+
"bsonType": "string",
44+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
45+
}
46+
},
47+
"encrypted_string_equivalent": {
48+
"encrypt": {
49+
"keyId": [
50+
{
51+
"$binary": {
52+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
53+
"subType": "04"
54+
}
55+
}
56+
],
57+
"bsonType": "string",
58+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
59+
}
60+
}
61+
},
62+
"bsonType": "object"
63+
},
64+
"key_vault_data": [
65+
{
66+
"status": 1,
67+
"_id": {
68+
"$binary": {
69+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
70+
"subType": "04"
71+
}
72+
},
73+
"masterKey": {
74+
"provider": "aws",
75+
"key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
76+
"region": "us-east-1"
77+
},
78+
"updateDate": {
79+
"$date": {
80+
"$numberLong": "1552949630483"
81+
}
82+
},
83+
"keyMaterial": {
84+
"$binary": {
85+
"base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO",
86+
"subType": "00"
87+
}
88+
},
89+
"creationDate": {
90+
"$date": {
91+
"$numberLong": "1552949630483"
92+
}
93+
},
94+
"keyAltNames": [
95+
"altname",
96+
"another_altname"
97+
]
98+
}
99+
],
100+
"tests": [
101+
{
102+
"description": "timeoutMS applied to listCollections to get collection schema",
103+
"failPoint": {
104+
"configureFailPoint": "failCommand",
105+
"mode": {
106+
"times": 1
107+
},
108+
"data": {
109+
"failCommands": [
110+
"listCollections"
111+
],
112+
"blockConnection": true,
113+
"blockTimeMS": 60
114+
}
115+
},
116+
"clientOptions": {
117+
"autoEncryptOpts": {
118+
"kmsProviders": {
119+
"aws": {}
120+
}
121+
},
122+
"timeoutMS": 50
123+
},
124+
"operations": [
125+
{
126+
"name": "insertOne",
127+
"arguments": {
128+
"document": {
129+
"_id": 1,
130+
"encrypted_string": "string0",
131+
"random": "abc"
132+
}
133+
},
134+
"result": {
135+
"isTimeoutError": true
136+
}
137+
}
138+
],
139+
"expectations": [
140+
{
141+
"command_started_event": {
142+
"command": {
143+
"listCollections": 1,
144+
"filter": {
145+
"name": "cse-timeouts-coll"
146+
},
147+
"maxTimeMS": {
148+
"$$type": [
149+
"int",
150+
"long"
151+
]
152+
}
153+
},
154+
"command_name": "listCollections"
155+
}
156+
}
157+
]
158+
},
159+
{
160+
"description": "remaining timeoutMS applied to find to get keyvault data",
161+
"failPoint": {
162+
"configureFailPoint": "failCommand",
163+
"mode": {
164+
"times": 2
165+
},
166+
"data": {
167+
"failCommands": [
168+
"listCollections",
169+
"find"
170+
],
171+
"blockConnection": true,
172+
"blockTimeMS": 30
173+
}
174+
},
175+
"clientOptions": {
176+
"autoEncryptOpts": {
177+
"kmsProviders": {
178+
"aws": {}
179+
}
180+
},
181+
"timeoutMS": 50
182+
},
183+
"operations": [
184+
{
185+
"name": "insertOne",
186+
"arguments": {
187+
"document": {
188+
"_id": 1,
189+
"encrypted_string": "string0",
190+
"random": "abc"
191+
}
192+
},
193+
"result": {
194+
"isTimeoutError": true
195+
}
196+
}
197+
]
198+
}
199+
]
200+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
runOn:
2+
- minServerVersion: "4.4"
3+
database_name: &database_name "cse-timeouts-db"
4+
collection_name: &collection_name "cse-timeouts-coll"
5+
6+
data: []
7+
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'}
8+
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']}]
9+
10+
tests:
11+
- description: "timeoutMS applied to listCollections to get collection schema"
12+
failPoint:
13+
configureFailPoint: failCommand
14+
mode: { times: 1 }
15+
data:
16+
failCommands: ["listCollections"]
17+
blockConnection: true
18+
blockTimeMS: 60
19+
clientOptions:
20+
autoEncryptOpts:
21+
kmsProviders:
22+
aws: {} # Credentials filled in from environment.
23+
timeoutMS: 50
24+
operations:
25+
- name: insertOne
26+
arguments:
27+
document: &doc0 { _id: 1, encrypted_string: "string0", random: "abc" }
28+
result:
29+
isTimeoutError: true
30+
expectations:
31+
# Auto encryption will request the collection info.
32+
- command_started_event:
33+
command:
34+
listCollections: 1
35+
filter:
36+
name: *collection_name
37+
maxTimeMS: { $$type: ["int", "long"] }
38+
command_name: listCollections
39+
40+
# Test that timeoutMS applies to the sum of all operations done for client-side encryption. This is done by blocking
41+
# listCollections and find for 30ms each and running an insertOne with timeoutMS=50. There should be one
42+
# listCollections command and one "find" command, so the sum should take more than timeoutMS. A second listCollections
43+
# event doesn't occur due to the internal MongoClient lacking configured auto encryption, plus libmongocrypt holds the
44+
# collection schema in cache for a minute.
45+
#
46+
# This test does not include command monitoring expectations because the exact command sequence is dependent on the
47+
# amount of time taken by mongocryptd communication. In slow runs, mongocryptd communication can breach the timeout
48+
# and result in the final "find" not being sent.
49+
- description: "remaining timeoutMS applied to find to get keyvault data"
50+
failPoint:
51+
configureFailPoint: failCommand
52+
mode: { times: 2 }
53+
data:
54+
failCommands: ["listCollections", "find"]
55+
blockConnection: true
56+
blockTimeMS: 30
57+
clientOptions:
58+
autoEncryptOpts:
59+
kmsProviders:
60+
aws: {} # Credentials filled in from environment.
61+
timeoutMS: 50
62+
operations:
63+
- name: insertOne
64+
arguments:
65+
document: *doc0
66+
result:
67+
isTimeoutError: true

0 commit comments

Comments
 (0)