Xolvio:cleaner resetDatabase hangs

Hi!

I have an issue when running server tests. The tests worked until recently when i did som major package updating and updated Meteor to 1.6.1.

But now im getting:

"Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test

with no further trace or error info. I’ve narrowed it down to xolvio:cleaner resetDatabase that just wont finish.

The tests all start with something like:

describe(‘A test’, function() {
before(function (done) {
resetDatabase({ excludedCollections: [‘Collection1’, ‘Collection2’, ‘Collection3’] });
// some other setup stuff
done();
});

The app works, it’s just the tests that have stopped working because of resetDatabase that hangs.

Anyone else experiencing the same issue?

Thanks in advance!

I’ve had the same issue as you, it was stuck every time.
It’s happening because of:
remove({});

if you won’t pass object as a parameter to the “remove” then it won’t hang.
Because of that I placed the code from this dependency directly into my repo with this small fix.

server.execute(() => {
    const excludedCollections = [
        'meteor_accounts_loginServiceConfiguration',
        'system.indexes'
    ];
    const db = MongoInternals.defaultRemoteCollectionDriver().mongo.db;
    const getCollections = Meteor.wrapAsync(db.collections, db);
    const collections = getCollections();
    const appCollections = _.reject(collections, (col) => (
        col.collectionName.indexOf('velocity') === 0 ||
        excludedCollections.indexOf(col.collectionName) !== -1
    ));
    _.each(appCollections, (appCollection) => {
        const remove = Meteor.wrapAsync(appCollection.remove, appCollection);
        remove();
    });
});

Original: https://github.com/xolvio/cleaner/blob/master/cleaner.js

2 Likes

It worked, thank you so much for your help!

I have no idea why though, the docs clearly states:

“As a safety measure, if selector is omitted (or is undefined), no documents will be removed. Set selector to {} if you really want to remove all documents from your collection.”

Hey guys. This issue has been fixed and released in xolvio:cleaner v0.3.3

Please feel free to post an issue here https://github.com/xolvio/cleaner/issues

3 Likes