Skip to content

Commit

Permalink
add some more error handling to hopefully prevent flaking change stre…
Browse files Browse the repository at this point in the history
…am tests
  • Loading branch information
vkarpov15 committed Aug 21, 2024
1 parent 8c6bb8b commit a725a75
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3509,6 +3509,9 @@ describe('Model', function() {
}
changeStream.removeListener('change', listener);
listener = null;
// Change stream may still emit "MongoAPIError: ChangeStream is closed" because change stream
// may still poll after close.
changeStream.on('error', () => {});
changeStream.close();
changeStream = null;
});
Expand Down Expand Up @@ -3658,6 +3661,9 @@ describe('Model', function() {
assert.equal(changeData.operationType, 'insert');
assert.equal(changeData.fullDocument.name, 'Ned Stark');

// Change stream may still emit "MongoAPIError: ChangeStream is closed" because change stream
// may still poll after close.
changeStream.on('error', () => {});
await changeStream.close();
await db.close();
});
Expand Down

0 comments on commit a725a75

Please sign in to comment.