Skip to content

Commit 1458b9f

Browse files
CSHARP-4135: Add CSFLE spec test for auto encryption on a collection with no jsonSchema. (#770)
1 parent 88769e2 commit 1458b9f

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.1.10"
5+
}
6+
],
7+
"database_name": "default",
8+
"collection_name": "unencrypted",
9+
"tests": [
10+
{
11+
"description": "Insert on an unencrypted collection",
12+
"clientOptions": {
13+
"autoEncryptOpts": {
14+
"kmsProviders": {
15+
"aws": {}
16+
}
17+
}
18+
},
19+
"operations": [
20+
{
21+
"name": "insertOne",
22+
"arguments": {
23+
"document": {
24+
"_id": 1
25+
}
26+
}
27+
}
28+
],
29+
"expectations": [
30+
{
31+
"command_started_event": {
32+
"command": {
33+
"listCollections": 1,
34+
"filter": {
35+
"name": "unencrypted"
36+
}
37+
},
38+
"command_name": "listCollections"
39+
}
40+
},
41+
{
42+
"command_started_event": {
43+
"command": {
44+
"insert": "unencrypted",
45+
"documents": [
46+
{
47+
"_id": 1
48+
}
49+
],
50+
"ordered": true
51+
},
52+
"command_name": "insert"
53+
}
54+
}
55+
],
56+
"outcome": {
57+
"collection": {
58+
"data": [
59+
{
60+
"_id": 1
61+
}
62+
]
63+
}
64+
}
65+
}
66+
]
67+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Test auto encryption on a collection with no jsonSchema configured.
2+
# This is a regression test for MONGOCRYPT-378/PYTHON-3188.
3+
runOn:
4+
- minServerVersion: "4.1.10"
5+
database_name: &database_name "default"
6+
collection_name: &collection_name "unencrypted"
7+
8+
tests:
9+
- description: "Insert on an unencrypted collection"
10+
clientOptions:
11+
autoEncryptOpts:
12+
kmsProviders:
13+
aws: {} # Credentials filled in from environment.
14+
operations:
15+
- name: insertOne
16+
arguments:
17+
document: &doc0 { _id: 1 }
18+
expectations:
19+
# Auto encryption will request the collection info.
20+
- command_started_event:
21+
command:
22+
listCollections: 1
23+
filter:
24+
name: *collection_name
25+
command_name: listCollections
26+
- command_started_event:
27+
command:
28+
insert: *collection_name
29+
documents:
30+
- *doc0
31+
ordered: true
32+
command_name: insert
33+
outcome:
34+
collection:
35+
# Outcome is checked using a separate MongoClient without auto encryption.
36+
data:
37+
- *doc0

0 commit comments

Comments
 (0)