...
1description: "driver-sessions-server-support"
2
3schemaVersion: "1.0"
4
5runOnRequirements:
6 - minServerVersion: "3.6"
7
8createEntities:
9 - client:
10 id: &client0 client0
11 useMultipleMongoses: false
12 observeEvents: [ commandStartedEvent ]
13 - database:
14 id: &database0 database0
15 client: *client0
16 databaseName: &database0Name session-tests
17 - collection:
18 id: &collection0 collection0
19 database: *database0
20 collectionName: &collection0Name test
21 - session:
22 id: &session0 session0
23 client: *client0
24
25initialData:
26 - collectionName: *collection0Name
27 databaseName: *database0Name
28 documents:
29 - { _id: 1 }
30
31tests:
32 - description: "Server supports explicit sessions"
33 operations:
34 - name: assertSessionNotDirty
35 object: testRunner
36 arguments:
37 session: *session0
38 - name: insertOne
39 object: *collection0
40 arguments:
41 session: *session0
42 document: { _id: 2 }
43 expectResult: { $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } }
44 - name: assertSessionNotDirty
45 object: testRunner
46 arguments:
47 session: *session0
48 - name: endSession
49 object: *session0
50 - &find_with_implicit_session
51 name: find
52 object: *collection0
53 arguments:
54 filter: { _id: -1 }
55 expectResult: []
56 - name: assertSameLsidOnLastTwoCommands
57 object: testRunner
58 arguments:
59 client: *client0
60 expectEvents:
61 - client: *client0
62 events:
63 - commandStartedEvent:
64 command:
65 insert: *collection0Name
66 documents: [ { _id: 2 } ]
67 ordered: true
68 lsid: { $$sessionLsid: *session0 }
69 commandName: insert
70 databaseName: *database0Name
71 - commandStartedEvent:
72 command:
73 find: *collection0Name
74 filter: { _id: -1 }
75 lsid: { $$sessionLsid: *session0 }
76 commandName: find
77 databaseName: *database0Name
78 outcome:
79 - collectionName: *collection0Name
80 databaseName: *database0Name
81 documents:
82 - { _id: 1 }
83 - { _id: 2 }
84
85 - description: "Server supports implicit sessions"
86 operations:
87 - name: insertOne
88 object: *collection0
89 arguments:
90 document: { _id: 2 }
91 expectResult: { $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 2 } } }
92 - *find_with_implicit_session
93 - name: assertSameLsidOnLastTwoCommands
94 object: testRunner
95 arguments:
96 client: *client0
97 expectEvents:
98 - client: *client0
99 events:
100 - commandStartedEvent:
101 command:
102 insert: *collection0Name
103 documents:
104 - { _id: 2 }
105 ordered: true
106 # There is no explicit session to use with $$sessionLsid, so
107 # just assert an arbitrary lsid document
108 lsid: { $$type: object }
109 commandName: insert
110 databaseName: *database0Name
111 - commandStartedEvent:
112 command:
113 find: *collection0Name
114 filter: { _id: -1 }
115 lsid: { $$type: object }
116 commandName: find
117 databaseName: *database0Name
118 outcome:
119 - collectionName: *collection0Name
120 databaseName: *database0Name
121 documents:
122 - { _id: 1 }
123 - { _id: 2 }
View as plain text