Skip to content

Commit

Permalink
Temporarily skip test runner related test failures and pull in client…
Browse files Browse the repository at this point in the history
… error sessions spec tests
  • Loading branch information
dariakp committed Jul 9, 2021
1 parent 1fa915e commit 0c05f8a
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/functional/sessions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,20 @@ describe('Sessions - functional', function () {
for (const sessionTests of loadSpecTests(path.join('sessions', 'unified'))) {
expect(sessionTests).to.be.an('object');
context(String(sessionTests.description), function () {
// TODO: NODE-3393 fix test runner to apply session to all operations
const testsToSkip =
sessionTests.description === 'snapshot-sessions'
? [
'countDocuments operation with snapshot',
'Distinct operation with snapshot',
'Mixed operation with snapshot'
]
: ['Server returns an error on distinct with snapshot'];
for (const test of sessionTests.tests) {
it(String(test.description), {
metadata: { sessions: { skipLeakTests: true } },
test: async function () {
await runUnifiedTest(this, sessionTests, test);
await runUnifiedTest(this, sessionTests, test, testsToSkip);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"description": "snapshot-sessions-not-supported-client-error",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"maxServerVersion": "4.4.99"
}
],
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent",
"commandFailedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "collection0"
}
},
{
"session": {
"id": "session0",
"client": "client0",
"sessionOptions": {
"snapshot": true
}
}
}
],
"initialData": [
{
"collectionName": "collection0",
"databaseName": "database0",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
],
"tests": [
{
"description": "Client error on find with snapshot",
"operations": [
{
"name": "find",
"object": "collection0",
"arguments": {
"session": "session0",
"filter": {}
},
"expectError": {
"isClientError": true,
"errorContains": "Snapshot reads require MongoDB 5.0 or later"
}
}
],
"expectEvents": []
},
{
"description": "Client error on aggregate with snapshot",
"operations": [
{
"name": "aggregate",
"object": "collection0",
"arguments": {
"session": "session0",
"pipeline": []
},
"expectError": {
"isClientError": true,
"errorContains": "Snapshot reads require MongoDB 5.0 or later"
}
}
],
"expectEvents": []
},
{
"description": "Client error on distinct with snapshot",
"operations": [
{
"name": "distinct",
"object": "collection0",
"arguments": {
"fieldName": "x",
"filter": {},
"session": "session0"
},
"expectError": {
"isClientError": true,
"errorContains": "Snapshot reads require MongoDB 5.0 or later"
}
}
],
"expectEvents": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
description: snapshot-sessions-not-supported-client-error

schemaVersion: "1.0"

runOnRequirements:
- minServerVersion: "3.6"
maxServerVersion: "4.4.99"

createEntities:
- client:
id: &client0 client0
observeEvents: [ commandStartedEvent, commandFailedEvent ]
- database:
id: &database0Name database0
client: *client0
databaseName: *database0Name
- collection:
id: &collection0Name collection0
database: *database0Name
collectionName: *collection0Name
- session:
id: session0
client: client0
sessionOptions:
snapshot: true

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
documents:
- { _id: 1, x: 11 }

tests:
- description: Client error on find with snapshot
operations:
- name: find
object: collection0
arguments:
session: session0
filter: {}
expectError:
isClientError: true
errorContains: Snapshot reads require MongoDB 5.0 or later
expectEvents: []

- description: Client error on aggregate with snapshot
operations:
- name: aggregate
object: collection0
arguments:
session: session0
pipeline: []
expectError:
isClientError: true
errorContains: Snapshot reads require MongoDB 5.0 or later
expectEvents: []

- description: Client error on distinct with snapshot
operations:
- name: distinct
object: collection0
arguments:
fieldName: x
filter: {}
session: session0
expectError:
isClientError: true
errorContains: Snapshot reads require MongoDB 5.0 or later
expectEvents: []

0 comments on commit 0c05f8a

Please sign in to comment.