Skip to content

Commit

Permalink
fix: support change streams tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Mar 17, 2022
1 parent 1066654 commit 0224de0
Show file tree
Hide file tree
Showing 2 changed files with 314 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/integration/change-streams/change_streams.spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ describe('Change Streams Spec - Unified', function () {
runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified')), [
'Test with document comment',
'Test with string comment',
'Test that comment is set on getMore',
'Test with document comment - pre 4.4'
'Test that comment is set on getMore'
]);
});

describe('Change Streams Spec - Node-Specific', function () {
runUnifiedSuite(loadSpecTests(path.join('change-streams', 'node-specific')));
});

// TODO: NODE-3819: Unskip flaky MacOS tests.
const maybeDescribe = process.platform === 'darwin' ? describe.skip : describe;
maybeDescribe('Change Stream Spec - v1', function () {
Expand Down
309 changes: 309 additions & 0 deletions test/spec/change-streams/node-specific/change-streams.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
{
"description": "change-streams",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"topologies": [
"replicaset",
"sharded-replicaset"
]
}
],
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "collection0"
}
}
],
"initialData": [
{
"collectionName": "collection0",
"databaseName": "database0",
"documents": []
}
],
"tests": [
{
"description": "Test with document comment",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"operations": [
{
"name": "createChangeStream",
"object": "collection0",
"arguments": {
"pipeline": [],
"comment": {
"name": "test1"
}
},
"saveResultAsEntity": "changeStream0"
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "collection0",
"pipeline": [
{
"$changeStream": {}
}
],
"comment": {
"name": "test1"
}
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "collection0",
"comment": {
"name": "test1"
}
},
"commandName": "getMore",
"databaseName": "database0"
}
}
]
}
]
},
{
"description": "Test with document comment - pre 4.4",
"runOnRequirements": [
{
"minServerVersion": "3.6.0",
"maxServerVersion": "4.2.99"
}
],
"operations": [
{
"name": "createChangeStream",
"object": "collection0",
"arguments": {
"pipeline": [],
"comment": {
"name": "test1"
}
},
"expectError": {
"isClientError": false
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "collection0",
"pipeline": [
{
"$changeStream": {}
}
],
"comment": {
"name": "test1"
}
}
}
}
]
}
]
},
{
"description": "Test with string comment",
"runOnRequirements": [
{
"minServerVersion": "3.6.0"
}
],
"operations": [
{
"name": "createChangeStream",
"object": "collection0",
"arguments": {
"pipeline": [],
"comment": "comment"
},
"saveResultAsEntity": "changeStream0"
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "collection0",
"pipeline": [
{
"$changeStream": {}
}
],
"comment": "comment"
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "collection0",
"comment": "comment"
},
"commandName": "getMore",
"databaseName": "database0"
}
}
]
}
]
},
{
"description": "Test that comment is set on getMore",
"runOnRequirements": [
{
"minServerVersion": "4.4.0",
"topologies": [
"single",
"replicaset"
]
}
],
"operations": [
{
"name": "createChangeStream",
"object": "collection0",
"arguments": {
"pipeline": [],
"comment": "comment"
},
"saveResultAsEntity": "changeStream0"
},
{
"name": "insertOne",
"object": "collection0",
"arguments": {
"document": {
"_id": 1,
"a": 1
}
}
},
{
"name": "iterateUntilDocumentOrError",
"object": "changeStream0"
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "collection0",
"pipeline": [
{
"$changeStream": {}
}
],
"comment": "comment"
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "collection0",
"comment": "comment"
},
"commandName": "getMore",
"databaseName": "database0"
}
},
{
"commandStartedEvent": {
"command": {
"insert": "collection0",
"documents": [
{
"_id": 1,
"a": 1
}
]
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "collection0",
"comment": "comment"
},
"commandName": "getMore",
"databaseName": "database0"
}
}
]
}
]
}
]
}

0 comments on commit 0224de0

Please sign in to comment.