Skip to content

Commit

Permalink
Feature/197 no migrations in test (winsleague#198)
Browse files Browse the repository at this point in the history
* log current environment

* lint fixes

* don't run migrations in test. i think this will still run migrations in chimp though. gotta fix that.

* test fix
  • Loading branch information
noahsw authored Aug 14, 2016
1 parent a9b9ef2 commit 75689e9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
5 changes: 4 additions & 1 deletion app/imports/startup/server/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import './loggly';

import './log-environment';

import './accounts_email_templates';

// Set up some rate limiting and other important security settings.
import './security.js';

import './register-api';
import './simple_schema';
import './loggly';
import './seeds';
import './migrations';
import './synced_cron';
Expand Down
10 changes: 10 additions & 0 deletions app/imports/startup/server/log-environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Meteor } from 'meteor/meteor';

import log from '../../utils/log';

log.info('Meteor.isTest:', Meteor.isTest);
log.info('Meteor.isAppTest:', Meteor.isAppTest);

log.info('Meteor.isDevelopment:', Meteor.isDevelopment);
log.info('Meteor.isProduction:', Meteor.isProduction);

10 changes: 6 additions & 4 deletions app/imports/startup/server/loggly.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Meteor } from 'meteor/meteor';
import log from '../../utils/log';

import 'winston-loggly-bulk';

import log from '../../utils/log';

const token = () => {
// mup.js sets this
return process.env.LOGGLY_TOKEN;
};

const init = () => {
if (! token()) {
if (!token()) {
log.warn('LOGGLY_TOKEN not found!');
return;
}
Expand All @@ -28,5 +28,7 @@ const init = () => {
};

Meteor.startup(() => {
if (Meteor.isProduction) init();
if (Meteor.isProduction) {
init();
}
});
7 changes: 5 additions & 2 deletions app/imports/startup/server/migrations.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import log from '../../utils/log';
import { Meteor } from 'meteor/meteor';
import { Migrations } from 'meteor/percolate:migrations';
import log from '../../utils/log';

Meteor.startup(() => {
Migrations.config({ logger: log });
Migrations.migrateTo('latest');
if (!Meteor.isTest && !Meteor.isAppTest) {
Migrations.migrateTo('latest');
}
});
2 changes: 1 addition & 1 deletion app/imports/startup/server/synced_cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MlbGameData from '../../api/games/server/mlb_game_data';

import WeeklyReport from '../../api/reports/server/weekly-report';

if (! Meteor.isTest && ! Meteor.isAppTest) {
if (!Meteor.isTest && !Meteor.isAppTest) {
log.info('Initializing SyncedCron');

const SyncedCronLogger = opts => {
Expand Down
2 changes: 1 addition & 1 deletion app/tests/pools-new-page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ describe('Pools.new page ui', () => {

browser.waitForExist('h3.Pools_show');

assert.equal(browser.getText('#Pools_title'), `2016 ${newTitle}`);
assert.equal(browser.getText('#Pools_title'), `2015 ${newTitle}`);
});
});

0 comments on commit 75689e9

Please sign in to comment.