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
Copy file name to clipboardExpand all lines: source/sessions/driver-sessions.rst
+22-7Lines changed: 22 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Driver Sessions Specification
12
12
:Status: Accepted (Could be Draft, Accepted, Rejected, Final, or Replaced)
13
13
:Type: Standards
14
14
:Minimum Server Version: 3.6 (The minimum server version this spec applies to)
15
-
:Last Modified:11-Jan-2018
15
+
:Last Modified:20-Feb-2018
16
16
17
17
.. contents::
18
18
@@ -922,7 +922,21 @@ topologies. It MUST NOT be run against a standalone server.
922
922
* A find command from the ``find`` helper method
923
923
* An insert command from the ``insert_one`` helper method
924
924
925
-
3. Test that session argument is for the right client
925
+
3. Test explicit and implicit session arguments
926
+
* Register a command-started APM listener. If the driver has no APM support, inspect commands in another idiomatic way, such as monkey-patching or a mock server.
927
+
* Create ``client1``
928
+
* Get ``database`` from ``client1``
929
+
* Get ``collection`` from ``database``
930
+
* Start ``session`` from ``client1``
931
+
* Call ``collection.insertOne(session,...)``
932
+
* Assert that the command passed to the command-started listener contained the session ``lsid`` from ``session``.
933
+
* Call ``collection.insertOne(,...)`` (*without* a session argument)
934
+
* Assert that the command passed to the command-started listener contained a session ``lsid``.
935
+
936
+
Repeat for:
937
+
* All methods that take a session parameter.
938
+
939
+
4. Test that session argument is for the right client
926
940
* Create ``client1`` and ``client2``
927
941
* Get ``database`` from ``client1``
928
942
* Get ``collection`` from ``database``
@@ -933,7 +947,7 @@ topologies. It MUST NOT be run against a standalone server.
933
947
Repeat for:
934
948
* All methods that take a session parameter.
935
949
936
-
4. Test that no further operations can be performed using a session after ``endSession`` has been called
950
+
5. Test that no further operations can be performed using a session after ``endSession`` has been called
937
951
* Start a ``session``
938
952
* End the ``session``
939
953
* Call ``collection.InsertOne(session, ...)``
@@ -947,14 +961,14 @@ topologies. It MUST NOT be run against a standalone server.
947
961
sufficient to only test the disposal pattern since that ends up calling
948
962
``endSession``).
949
963
950
-
5. Authenticating as multiple users suppresses implicit sessions
964
+
6. Authenticating as multiple users suppresses implicit sessions
951
965
* Skip this test if your driver does not allow simultaneous authentication with multiple users
952
966
* Authenticate as two users
953
967
* Call ``findOne`` with no explicit session
954
968
* Capture the command sent to the server
955
969
* Assert that the command sent to the server does not have an ``lsid`` field
956
970
957
-
6. Client-side cursor that exhausts the results on the initial query immediately returns the implicit session
971
+
7. Client-side cursor that exhausts the results on the initial query immediately returns the implicit session
958
972
to the pool.
959
973
* Insert two documents into a collection
960
974
* Execute a find operation on the collection and iterate past the first document
@@ -963,14 +977,14 @@ to the pool.
963
977
* Track the lsid used for the find operation (e.g. with APM) and then do another operation and
964
978
assert that the same lsid is used as for the find operation.
965
979
966
-
7. Client-side cursor that exhausts the results after a ``getMore`` immediately returns the implicit session
980
+
8. Client-side cursor that exhausts the results after a ``getMore`` immediately returns the implicit session
967
981
to the pool.
968
982
* Insert four documents into a collection
969
983
* Execute a find operation on the collection with batch size of 2
970
984
* Iterate past the first three documents, forcing the final ``getMore`` operation
971
985
* Assert that the implicit session is returned to the pool prior to iterating past the last document
972
986
973
-
8. At the end of every individual functional test of the driver, there SHOULD be an assertion that
987
+
9. At the end of every individual functional test of the driver, there SHOULD be an assertion that
974
988
there are no remaining sessions checked out from the pool. This may require changes to existing tests to
975
989
ensure that they close any explicit client sessions and any unexhausted cursors.
976
990
@@ -1067,3 +1081,4 @@ Change log
1067
1081
:2018-01-10: Note that MongoClient must retain highest clusterTime
1068
1082
:2018-01-10: Update test plan for drivers without APM
1069
1083
:2018-01-11: Clarify that sessions require replica sets or sharded clusters
0 commit comments