Skip to content

DRIVERS-2888 Support QE with Client.bulkWrite #1770

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

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 273 additions & 0 deletions source/crud/tests/unified/client-bulkWrite-qe.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions source/crud/tests/unified/client-bulkWrite-qe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
description: client bulkWrite with queryable encryption

schemaVersion: "1.23"

runOnRequirements:
- minServerVersion: "8.0"
serverless: forbid # Serverless does not support bulkWrite: CLOUDP-256344.

createEntities:
- client:
id: &client0 client0
observeEvents:
- commandStartedEvent
- commandSucceededEvent
autoEncryptOpts:
keyVaultNamespace: keyvault.datakeys
kmsProviders:
local:
key: Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name crud-tests
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0
- database:
id: &database1 database1
client: *client0
databaseName: &database1Name keyvault
- collection:
id: &collection1 collection1
database: *database0
collectionName: &collection1Name datakeys


initialData:
- databaseName: *database1Name
collectionName: *collection1Name
documents:
- _id: &local_key_id { $binary: { base64: EjRWeBI0mHYSNBI0VniQEg==, subType: "04" } }
keyAltNames: ["local_key"]
keyMaterial: { $binary: { base64: sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==, subType: "00" } }
creationDate: { $date: { $numberLong: "1641024000000" } }
updateDate: { $date: { $numberLong: "1641024000000" } }
status: 1
masterKey: &local_masterkey
provider: local
- databaseName: *database0Name
collectionName: *collection0Name
documents: []
createOptions:
encryptedFields: &encrypted_fields {'fields': [{'keyId': {'$binary': {'base64': 'EjRWeBI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedInt', 'bsonType': 'int', 'queries': {'queryType': 'equality', 'contention': {'$numberLong': '0'}}}]}

_yamlAnchors:
namespace: &namespace "crud-tests.coll0"

tests:
- description: client bulkWrite QE replaceOne
operations:
- object: *collection0
name: insertMany
arguments:
documents:
- { _id: 1, encryptedInt: 11 }
- { _id: 2, encryptedInt: 22 }
- { _id: 3, encryptedInt: 33 }
- object: *client0
name: clientBulkWrite
arguments:
models:
- replaceOne:
namespace: *namespace
filter: { encryptedInt: { $eq: 11 } }
replacement: { encryptedInt: 44 }
expectResult:
insertedCount: 0
upsertedCount: 0
matchedCount: 1
modifiedCount: 1
deletedCount: 0
- object: *collection0
name: find
arguments:
filter: { encryptedInt: 44 }
expectResult:
- _id: 1
encryptedInt: 44
outcome:
- collectionName: *collection0Name
databaseName: *database0Name
documents:
- { _id: 1, encryptedInt: { $$type: binData }, __safeContent__: { $$type: array} }
- { _id: 2, encryptedInt: { $$type: binData }, __safeContent__: { $$type: array} }
- { _id: 3, encryptedInt: { $$type: binData }, __safeContent__: { $$type: array} }
- description: client bulkWrite QE with multiple replace fails
operations:
- object: *client0
name: clientBulkWrite
arguments:
models:
- replaceOne:
namespace: *namespace
filter: { encryptedInt: { $eq: 11 } }
replacement: { encryptedInt: 44 }
- replaceOne:
namespace: *namespace
filter: { encryptedInt: { $eq: 22 } }
replacement: { encryptedInt: 44 }
expectError:
# Expect error from mongocryptd or crypt_shared
isError: true
Loading