| 1 |
===================== |
| 2 |
Atlas Data Lake Tests |
| 3 |
===================== |
| 4 |
|
| 5 |
.. contents:: |
| 6 |
|
| 7 |
---- |
| 8 |
|
| 9 |
Introduction |
| 10 |
============ |
| 11 |
|
| 12 |
The YAML and JSON files in this directory tree are platform-independent tests |
| 13 |
that drivers can use to assert compatibility with `Atlas Data Lake <https://www.mongodb.com/docs/datalake>`_. |
| 14 |
|
| 15 |
Running these integration tests will require a running ``mongohoused`` |
| 16 |
with data available in its ``test.driverdata`` collection. See the |
| 17 |
`ADL directory in drivers-evergreen-tools <https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/atlas_data_lake>`_ |
| 18 |
and `10gen/mongohouse README <https://github.com/10gen/mongohouse/blob/master/README.md>`_ |
| 19 |
for more information. |
| 20 |
|
| 21 |
Several prose tests, which are not easily expressed in YAML, are also presented |
| 22 |
in this file. Those tests will need to be manually implemented by each driver. |
| 23 |
|
| 24 |
Test Format |
| 25 |
=========== |
| 26 |
|
| 27 |
The same as the `CRUD Spec Test format <../../crud/tests/README.rst#Test-Format>`_. |
| 28 |
|
| 29 |
Test Runner Implementation |
| 30 |
========================== |
| 31 |
|
| 32 |
The same as the `CRUD Spec Test Runner Implementation <../../crud/tests#test-runner-implementation>`_, |
| 33 |
with one notable differences: the test runner for Atlas Data Lake Testing |
| 34 |
MUST NOT drop the collection and/or database under test. In contrast to other |
| 35 |
CRUD tests, which insert their own data fixtures into an empty collection, data |
| 36 |
for these tests is specified in the ``mongohoused`` configuration file. |
| 37 |
|
| 38 |
Prose Tests |
| 39 |
=========== |
| 40 |
|
| 41 |
The following tests MUST be implemented to fully test compatibility with |
| 42 |
Atlas Data Lake. |
| 43 |
|
| 44 |
#. Test that the driver properly constructs and issues a |
| 45 |
`killCursors <https://www.mongodb.com/docs/manual/reference/command/killCursors/>`_ |
| 46 |
command to Atlas Data Lake. For this test, configure an APM listener on a |
| 47 |
client and execute a query on the ``test.driverdata`` collection that will |
| 48 |
leave a cursor open on the server (e.g. specify ``batchSize=2`` for a query |
| 49 |
that would match 3+ documents). Drivers MAY iterate the cursor if necessary |
| 50 |
to execute the initial ``find`` command but MUST NOT iterate further to avoid |
| 51 |
executing a ``getMore``. |
| 52 |
|
| 53 |
Observe the CommandSucceededEvent event for the ``find`` command and extract |
| 54 |
the cursor's ID and namespace from the response document's ``cursor.id`` and |
| 55 |
``cursor.ns`` fields, respectively. Destroy the cursor object and observe |
| 56 |
a CommandStartedEvent and CommandSucceededEvent for the ``killCursors`` |
| 57 |
command. Assert that the cursor ID and target namespace in the outgoing |
| 58 |
command match the values from the ``find`` command's CommandSucceededEvent. |
| 59 |
When matching the namespace, note that the ``killCursors`` field will contain |
| 60 |
the collection name and the database may be inferred from either the ``$db`` |
| 61 |
field or accessed via the CommandStartedEvent directly. Finally, assert that |
| 62 |
the ``killCursors`` CommandSucceededEvent indicates that the expected cursor |
| 63 |
was killed in the ``cursorsKilled`` field. |
| 64 |
|
| 65 |
Note: this test assumes that drivers only issue a ``killCursors`` command |
| 66 |
internally when destroying a cursor that may still exist on the server. If |
| 67 |
a driver constructs and issues ``killCursors`` commands in other ways (e.g. |
| 68 |
public API), this test MUST be adapted to test all such code paths. |
| 69 |
|
| 70 |
#. Test that the driver can establish a connection with Atlas Data Lake |
| 71 |
without authentication. For these tests, create a MongoClient using a |
| 72 |
valid connection string without auth credentials and execute a ping |
| 73 |
command. |
| 74 |
|
| 75 |
#. Test that the driver can establish a connection with Atlas Data Lake |
| 76 |
with authentication. For these tests, create a MongoClient using a |
| 77 |
valid connection string with SCRAM-SHA-1 and credentials from the |
| 78 |
drivers-evergreen-tools ADL configuration and execute a ping command. |
| 79 |
Repeat this test using SCRAM-SHA-256. |
| 80 |
|
| 81 |
Changelog |
| 82 |
========= |
| 83 |
|
| 84 |
:2020-07-15: Link to CRUD test runner implementation and note that the collection |
| 85 |
under test must not be dropped before each test. |