Skip to content

Commit 0c05f8a

Browse files
committed
Temporarily skip test runner related test failures and pull in client error sessions spec tests
1 parent 1fa915e commit 0c05f8a

File tree

3 files changed

+192
-1
lines changed

3 files changed

+192
-1
lines changed

test/functional/sessions.test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,20 @@ describe('Sessions - functional', function () {
201201
for (const sessionTests of loadSpecTests(path.join('sessions', 'unified'))) {
202202
expect(sessionTests).to.be.an('object');
203203
context(String(sessionTests.description), function () {
204+
// TODO: NODE-3393 fix test runner to apply session to all operations
205+
const testsToSkip =
206+
sessionTests.description === 'snapshot-sessions'
207+
? [
208+
'countDocuments operation with snapshot',
209+
'Distinct operation with snapshot',
210+
'Mixed operation with snapshot'
211+
]
212+
: ['Server returns an error on distinct with snapshot'];
204213
for (const test of sessionTests.tests) {
205214
it(String(test.description), {
206215
metadata: { sessions: { skipLeakTests: true } },
207216
test: async function () {
208-
await runUnifiedTest(this, sessionTests, test);
217+
await runUnifiedTest(this, sessionTests, test, testsToSkip);
209218
}
210219
});
211220
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"description": "snapshot-sessions-not-supported-client-error",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "3.6",
7+
"maxServerVersion": "4.4.99"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0",
14+
"observeEvents": [
15+
"commandStartedEvent",
16+
"commandFailedEvent"
17+
]
18+
}
19+
},
20+
{
21+
"database": {
22+
"id": "database0",
23+
"client": "client0",
24+
"databaseName": "database0"
25+
}
26+
},
27+
{
28+
"collection": {
29+
"id": "collection0",
30+
"database": "database0",
31+
"collectionName": "collection0"
32+
}
33+
},
34+
{
35+
"session": {
36+
"id": "session0",
37+
"client": "client0",
38+
"sessionOptions": {
39+
"snapshot": true
40+
}
41+
}
42+
}
43+
],
44+
"initialData": [
45+
{
46+
"collectionName": "collection0",
47+
"databaseName": "database0",
48+
"documents": [
49+
{
50+
"_id": 1,
51+
"x": 11
52+
}
53+
]
54+
}
55+
],
56+
"tests": [
57+
{
58+
"description": "Client error on find with snapshot",
59+
"operations": [
60+
{
61+
"name": "find",
62+
"object": "collection0",
63+
"arguments": {
64+
"session": "session0",
65+
"filter": {}
66+
},
67+
"expectError": {
68+
"isClientError": true,
69+
"errorContains": "Snapshot reads require MongoDB 5.0 or later"
70+
}
71+
}
72+
],
73+
"expectEvents": []
74+
},
75+
{
76+
"description": "Client error on aggregate with snapshot",
77+
"operations": [
78+
{
79+
"name": "aggregate",
80+
"object": "collection0",
81+
"arguments": {
82+
"session": "session0",
83+
"pipeline": []
84+
},
85+
"expectError": {
86+
"isClientError": true,
87+
"errorContains": "Snapshot reads require MongoDB 5.0 or later"
88+
}
89+
}
90+
],
91+
"expectEvents": []
92+
},
93+
{
94+
"description": "Client error on distinct with snapshot",
95+
"operations": [
96+
{
97+
"name": "distinct",
98+
"object": "collection0",
99+
"arguments": {
100+
"fieldName": "x",
101+
"filter": {},
102+
"session": "session0"
103+
},
104+
"expectError": {
105+
"isClientError": true,
106+
"errorContains": "Snapshot reads require MongoDB 5.0 or later"
107+
}
108+
}
109+
],
110+
"expectEvents": []
111+
}
112+
]
113+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
description: snapshot-sessions-not-supported-client-error
2+
3+
schemaVersion: "1.0"
4+
5+
runOnRequirements:
6+
- minServerVersion: "3.6"
7+
maxServerVersion: "4.4.99"
8+
9+
createEntities:
10+
- client:
11+
id: &client0 client0
12+
observeEvents: [ commandStartedEvent, commandFailedEvent ]
13+
- database:
14+
id: &database0Name database0
15+
client: *client0
16+
databaseName: *database0Name
17+
- collection:
18+
id: &collection0Name collection0
19+
database: *database0Name
20+
collectionName: *collection0Name
21+
- session:
22+
id: session0
23+
client: client0
24+
sessionOptions:
25+
snapshot: true
26+
27+
initialData:
28+
- collectionName: *collection0Name
29+
databaseName: *database0Name
30+
documents:
31+
- { _id: 1, x: 11 }
32+
33+
tests:
34+
- description: Client error on find with snapshot
35+
operations:
36+
- name: find
37+
object: collection0
38+
arguments:
39+
session: session0
40+
filter: {}
41+
expectError:
42+
isClientError: true
43+
errorContains: Snapshot reads require MongoDB 5.0 or later
44+
expectEvents: []
45+
46+
- description: Client error on aggregate with snapshot
47+
operations:
48+
- name: aggregate
49+
object: collection0
50+
arguments:
51+
session: session0
52+
pipeline: []
53+
expectError:
54+
isClientError: true
55+
errorContains: Snapshot reads require MongoDB 5.0 or later
56+
expectEvents: []
57+
58+
- description: Client error on distinct with snapshot
59+
operations:
60+
- name: distinct
61+
object: collection0
62+
arguments:
63+
fieldName: x
64+
filter: {}
65+
session: session0
66+
expectError:
67+
isClientError: true
68+
errorContains: Snapshot reads require MongoDB 5.0 or later
69+
expectEvents: []

0 commit comments

Comments
 (0)