[solved] Meteor:jasmine: How to set up mirror database?

Hi guys, Hi @Sanjo,

I am running jasmine within velocity in an “all-in-packages” structure
and I wonder how to get database mirrors to work in order to seperate my development-db from my testrunner-db.

The velocity-docs talk about velocity taking care of mirror-dbs ( https://velocity.readme.io/docs/mirrors ).

BUT right now I am actually removing all rows from my development-db and NOT from a mirror / testrunner-db:

describe('Test it', function(){
  it('Collection runs in mirror-db', function(){
    var Collection = new Mongo.Collection('tester');
    Collection.remove({});  // yes: this code runs in the testrunner-db
  });
});

I noticed that process.env.IS_MIRROR is undefined
and I could NOT get the fixture scripts working (https://github.com/Sanjo/SpaceTalk/blob/feature/testing/packages/testing/fixtures.js)… they fail at the line with this code: if (!process.env.IS_MIRROR) {...

What do I need to do to get this running? Any ideas?

Is the removing of the data in your development-db really happening for you, or is this just what you think, that will happen? The package tests run with its own database in a separate app. When you use Mongo.Collection etc. it will automatically use the test database.

For the fixtures you need to change the check to if (!(process.env.IS_MIRROR || process.env.VELOCITY_TEST_PACKAGES))

1 Like

@Sanjo: You are right: it does NOT touch the development-db. I interpreted the word “mirror” to automatically mirror the development-db-data into the testrunner-db with every testrun…

OK, cool… thanks a lot for helping me go one more step in the right direction. :smile: