|
| 1 | +==================== |
| 2 | +Driver Session Tests |
| 3 | +==================== |
| 4 | + |
| 5 | +.. contents:: |
| 6 | + |
| 7 | +---- |
| 8 | + |
| 9 | +Introduction |
| 10 | +============ |
| 11 | + |
| 12 | +The YAML and JSON files in this directory are platform-independent tests that |
| 13 | +drivers can use to prove their conformance to the Driver Sessions Spec. They are |
| 14 | +designed with the intention of sharing most test-runner code with the |
| 15 | +Transactions spec tests. |
| 16 | + |
| 17 | +Several prose tests, which are not easily expressed in YAML, are also presented |
| 18 | +in the Driver Sessions Spec. Those tests will need to be manually implemented |
| 19 | +by each driver. |
| 20 | + |
| 21 | +Test Format |
| 22 | +=========== |
| 23 | + |
| 24 | +The same as the `Transactions Spec Test format |
| 25 | +<../../transactions/tests/README.rst#test-format>`_. |
| 26 | + |
| 27 | +Special Test Operations |
| 28 | +``````````````````````` |
| 29 | + |
| 30 | +Certain operations that appear in the "operations" array do not correspond to |
| 31 | +API methods but instead represent special test operations. Such operations are |
| 32 | +defined on the "testRunner" object and are documented in the |
| 33 | +`Transactions Spec Test |
| 34 | +<../../transactions/tests/README.rst#special-test-operations>`_. |
| 35 | +Additional, session test specific operations are documented here: |
| 36 | + |
| 37 | +assertDifferentLsidOnLastTwoCommands |
| 38 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 39 | + |
| 40 | +The "assertDifferentLsidOnLastTwoCommands" operation instructs the test runner |
| 41 | +to assert that the last two command started events from the test's MongoClient |
| 42 | +have different "lsid" fields. This assertion is used to ensure that dirty |
| 43 | +server sessions are discarded from the pool:: |
| 44 | + |
| 45 | + - name: assertDifferentLsidOnLastTwoCommands |
| 46 | + object: testRunner |
| 47 | + |
| 48 | +assertSameLsidOnLastTwoCommands |
| 49 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 50 | + |
| 51 | +The "assertSameLsidOnLastTwoCommands" operation instructs the test runner |
| 52 | +to assert that the last two command started events from the test's MongoClient |
| 53 | +have the same "lsid" field. This assertion is used to ensure that non-dirty |
| 54 | +server sessions are not discarded from the pool:: |
| 55 | + |
| 56 | + - name: assertSameLsidOnLastTwoCommands |
| 57 | + object: testRunner |
| 58 | + |
| 59 | +assertSessionDirty |
| 60 | +~~~~~~~~~~~~~~~~~~ |
| 61 | + |
| 62 | +The "assertSessionDirty" operation instructs the test runner to assert that |
| 63 | +the given session is marked dirty:: |
| 64 | + |
| 65 | + - name: assertSessionDirty |
| 66 | + object: testRunner |
| 67 | + arguments: |
| 68 | + session: session0 |
| 69 | + |
| 70 | +assertSessionNotDirty |
| 71 | +~~~~~~~~~~~~~~~~~~~~~ |
| 72 | + |
| 73 | +The "assertSessionNotDirty" operation instructs the test runner to assert that |
| 74 | +the given session is *not* marked dirty:: |
| 75 | + |
| 76 | + - name: assertSessionNotDirty |
| 77 | + object: testRunner |
| 78 | + arguments: |
| 79 | + session: session0 |
| 80 | + |
| 81 | +Changelog |
| 82 | +========= |
| 83 | + |
| 84 | +:2019-05-15: Initial version. |
0 commit comments