@@ -9,76 +9,14 @@ Driver Session Tests
9
9
Introduction
10
10
============
11
11
12
- The YAML and JSON files in the ``legacy `` and ``unified `` sub-directories are platform-independent tests
13
- that 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 <../../transactions/tests/README.rst#test-format >`_.. Tests in the
16
- ``unified `` directory are written using the `Unified Test Format <../../unified-test-format/unified-test-format.rst >`_.
12
+ The YAML and JSON files in this directory are platform-independent tests
13
+ meant to exercise a driver's implementation of sessions. These tests utilize the
14
+ `Unified Test Format <../../unified-test-format/unified-test-format.rst >`__.
17
15
18
16
Several prose tests, which are not easily expressed in YAML, are also presented
19
17
in the Driver Sessions Spec. Those tests will need to be manually implemented
20
18
by each driver.
21
19
22
- Test Format
23
- ===========
24
-
25
- The same as the `Transactions Spec Test format
26
- <../../transactions/tests/README.rst#test-format> `_.
27
-
28
- Special Test Operations
29
- ```````````````````````
30
-
31
- Certain operations that appear in the "operations" array do not correspond to
32
- API methods but instead represent special test operations. Such operations are
33
- defined on the "testRunner" object and are documented in the
34
- `Transactions Spec Test
35
- <../../transactions/tests/README.rst#special-test-operations> `_.
36
- Additional, session test specific operations are documented here:
37
-
38
- assertDifferentLsidOnLastTwoCommands
39
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
-
41
- The "assertDifferentLsidOnLastTwoCommands" operation instructs the test runner
42
- to assert that the last two command started events from the test's MongoClient
43
- have different "lsid" fields. This assertion is used to ensure that dirty
44
- server sessions are discarded from the pool::
45
-
46
- - name: assertDifferentLsidOnLastTwoCommands
47
- object: testRunner
48
-
49
- assertSameLsidOnLastTwoCommands
50
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51
-
52
- The "assertSameLsidOnLastTwoCommands" operation instructs the test runner
53
- to assert that the last two command started events from the test's MongoClient
54
- have the same "lsid" field. This assertion is used to ensure that non-dirty
55
- server sessions are not discarded from the pool::
56
-
57
- - name: assertSameLsidOnLastTwoCommands
58
- object: testRunner
59
-
60
- assertSessionDirty
61
- ~~~~~~~~~~~~~~~~~~
62
-
63
- The "assertSessionDirty" operation instructs the test runner to assert that
64
- the given session is marked dirty::
65
-
66
- - name: assertSessionDirty
67
- object: testRunner
68
- arguments:
69
- session: session0
70
-
71
- assertSessionNotDirty
72
- ~~~~~~~~~~~~~~~~~~~~~
73
-
74
- The "assertSessionNotDirty" operation instructs the test runner to assert that
75
- the given session is *not * marked dirty::
76
-
77
- - name: assertSessionNotDirty
78
- object: testRunner
79
- arguments:
80
- session: session0
81
-
82
20
Snapshot session tests
83
21
======================
84
22
Snapshot sessions tests require server of version 5.0 or higher and
@@ -92,13 +30,17 @@ may lead to `SnapshotTooOld` errors. Drivers can work around this issue by incre
92
30
93
31
Prose tests
94
32
```````````
95
- - Setting both ``snapshot `` and ``causalConsistency `` is not allowed
96
33
97
- * ``client.startSession(snapshot = true, causalConsistency = true) ``
98
- * Assert that an error was raised by driver
34
+ 1. Setting both ``snapshot `` and ``causalConsistency `` to true is not allowed
35
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
+
37
+ * ``client.startSession(snapshot = true, causalConsistency = true) ``
38
+ * Assert that an error was raised by driver
99
39
100
40
Changelog
101
41
=========
102
42
103
43
:2019-05-15: Initial version.
104
44
:2021-06-15: Added snapshot-session tests. Introduced legacy and unified folders.
45
+ :2021-07-30: Use numbering for prose test
46
+ :2022-02-11: Convert legacy tests to unified format
0 commit comments