Skip to content

Commit 9c3114b

Browse files
stIncMalejmikola
andauthored
DRIVERS-2624 Improve prose tests checking that neither mongocryptd nor its client are created when they are not supposed to be (#1415)
DRIVERS-2624 --------- Co-authored-by: Jeremy Mikola <[email protected]>
1 parent 474ddfc commit 9c3114b

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

source/client-side-encryption/tests/README.rst

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,14 @@ Test cases
979979
8. Bypass Spawning mongocryptd
980980
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
981981

982+
.. note::
983+
984+
CONSIDER: To reduce the chances of tests interfering with each other,
985+
drivers MAY use a different port for each test in this group,
986+
and include it in ``--pidfilepath``. The interference
987+
may come from the fact that once spawned by a test,
988+
``mongocryptd`` stays up and running for some time.
989+
982990
Via loading shared library
983991
``````````````````````````
984992

@@ -1021,19 +1029,27 @@ The following tests that loading crypt_shared_ bypasses spawning mongocryptd.
10211029
.. note::
10221030

10231031
IMPORTANT: If crypt_shared_ is visible to the operating system's library
1024-
search mechanism, the expected server error generated by these
1025-
``mongocryptdBypassSpawn`` tests will not appear because libmongocrypt will
1032+
search mechanism, the expected server error generated by the
1033+
``Via mongocryptdBypassSpawn``, ``Via bypassAutoEncryption``, ``Via bypassQueryAnalysis``
1034+
tests will not appear because libmongocrypt will
10261035
load the ``crypt_shared`` library instead of consulting mongocryptd. For
10271036
the following tests, it is required that libmongocrypt *not* load ``crypt_shared``.
10281037
Refer to the client-side-encryption document for more information on
1029-
"disabling" ``crypt_shared``.
1038+
"disabling" ``crypt_shared``. Take into account that once loaded,
1039+
for example, by another test,
1040+
``crypt_shared`` cannot be unloaded and may be used by ``MongoClient``,
1041+
thus making the tests misbehave in unexpected ways.
10301042

10311043

10321044
Via mongocryptdBypassSpawn
10331045
``````````````````````````
10341046

10351047
The following tests that setting ``mongocryptdBypassSpawn=true`` really does bypass spawning mongocryptd.
10361048

1049+
#. Insert the document `external/external-key.json <../external/external-key.json>`_ into ``keyvault.datakeys`` with majority write concern.
1050+
This step is not required to run this test, and drivers MAY skip it. But if the driver misbehaves,
1051+
then not having the encryption fully set up may complicate the process of figuring out what is wrong.
1052+
10371053
#. Create a MongoClient configured with auto encryption (referred to as ``client_encrypted``)
10381054

10391055
Configure the required options. Use the ``local`` KMS provider as follows:
@@ -2514,7 +2530,7 @@ The following tests that a mongocryptd client is not created when shared library
25142530
.. code:: javascript
25152531
25162532
{
2517-
"mongocryptdURI": "mongodb://localhost:27021"
2533+
"mongocryptdURI": "mongodb://localhost:27021/?serverSelectionTimeoutMS=1000"
25182534
}
25192535
25202536
#. Use ``client_encrypted`` to insert the document ``{"unencrypted": "test"}`` into ``db.coll``.

0 commit comments

Comments
 (0)