You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#. If ``autoEncryptOpts`` does not include ``keyVaultNamespace``, default it
215
+
to ``keyvault.datakeys``.
152
216
153
217
#. For each element in ``operations``:
154
218
@@ -318,7 +382,7 @@ For each KMS provider (``aws``, ``azure``, ``gcp``, and ``local``), referred to
318
382
319
383
- Expect the return value to be a BSON binary subtype 6, referred to as ``encrypted``.
320
384
- Use ``client_encrypted`` to insert ``{ _id: "<provider_name>", "value": <encrypted> }`` into ``db.coll``.
321
-
- Use ``client_encrypted`` to run a find querying with ``_id`` of "<provider_name>" and expect ``value`` to be "hello local".
385
+
- Use ``client_encrypted`` to run a find querying with ``_id`` of "<provider_name>" and expect ``value`` to be "hello <provider_name>".
322
386
323
387
#. Call ``client_encryption.encrypt()`` with the value "hello <provider_name>", the algorithm ``AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic``, and the ``key_alt_name`` of ``<provider_name>_altname``.
324
388
@@ -769,4 +833,178 @@ The following tests that setting ``bypassAutoEncryption=true`` really does bypas
769
833
770
834
#. Use ``client_encrypted`` to insert the document ``{"unencrypted": "test"}`` into ``db.coll``. Expect this to succeed.
771
835
772
-
#. Validate that mongocryptd was not spawned. Create a MongoClient to localhost:27021 (or whatever was passed via ``--port``) with serverSelectionTimeoutMS=1000. Run an ``isMaster`` command and ensure it fails with a server selection timeout.
836
+
#. Validate that mongocryptd was not spawned. Create a MongoClient to localhost:27021 (or whatever was passed via ``--port``) with serverSelectionTimeoutMS=1000. Run an ``isMaster`` command and ensure it fails with a server selection timeout.
837
+
838
+
Deadlock tests
839
+
~~~~~~~~~~~~~~
840
+
841
+
.. _Connection Monitoring and Pooling: /source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst
842
+
843
+
The following tests only apply to drivers that have implemented a connection pool (see the `Connection Monitoring and Pooling`_ specification).
844
+
845
+
There are multiple parameterized test cases. Before each test case, perform the setup.
846
+
847
+
Setup
848
+
`````
849
+
850
+
Create a ``MongoClient`` for setup operations named ``client_test``.
851
+
852
+
Create a ``MongoClient`` for key vault operations with ``maxPoolSize=1`` named ``client_keyvault``. Capture command started events.
853
+
854
+
Using ``client_test``, drop the collections ``keyvault.datakeys`` and ``db.coll``.
855
+
856
+
Insert the document `external/external-key.json <../external/external-key.json>`_ into ``keyvault.datakeys`` with majority write concern.
857
+
858
+
Create a collection ``db.coll`` configured with a JSON schema `external/external-schema.json <../external/external-schema.json>`_ as the validator, like so:
Use ``client_encryption`` to encrypt the value "string0" with ``algorithm``="AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" and ``keyAltName``="local". Store the result in a variable named ``ciphertext``.
870
+
871
+
Proceed to run the test case.
872
+
873
+
Each test case configures a ``MongoClient`` with automatic encryption (named ``client_encrypted``).
874
+
875
+
Each test must assert the number of unique ``MongoClient``s created. This can be accomplished by capturing ``TopologyOpeningEvent``, or by checking command started events for a client identifier (not possible in all drivers).
876
+
877
+
Running a test case
878
+
```````````````````
879
+
- Create a ``MongoClient`` named ``client_encrypted`` configured as follows:
0 commit comments