Update mongodb to the latest version 🚀 (#6348)
* fix(package): update mongodb to version 3.5.0 * chore(package): update lockfile package-lock.json * Fix shutdown issues Properly retrieves the number of connections https://docs.mongodb.com/manual/reference/command/serverStatus/#connections Bump to 3.5.1 * remove fit Co-authored-by: Diamond Lewis <findlewis@gmail.com>
This commit is contained in:
@@ -61,16 +61,20 @@ describe('GridFSBucket and GridStore interop', () => {
|
||||
await expectMissingFile(gfsAdapter, 'myFileName');
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', done => {
|
||||
it('handleShutdown, close connection', async () => {
|
||||
const databaseURI = 'mongodb://localhost:27017/parse';
|
||||
const gfsAdapter = new GridFSBucketAdapter(databaseURI);
|
||||
|
||||
gfsAdapter._connect().then(db => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(true);
|
||||
gfsAdapter.handleShutdown().then(() => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
const db = await gfsAdapter._connect();
|
||||
const status = await db.admin().serverStatus();
|
||||
expect(status.connections.current > 0).toEqual(true);
|
||||
|
||||
await gfsAdapter.handleShutdown();
|
||||
try {
|
||||
await db.admin().serverStatus();
|
||||
expect(false).toBe(true);
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual('topology was destroyed');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user