From ceebbc4447c79b74f118d983d5f073d08c6f9077 Mon Sep 17 00:00:00 2001 From: Madushan Nishantha Date: Tue, 26 Jan 2016 13:21:19 +0530 Subject: [PATCH] Updated tests --- lib/modules/default/__tests__/index.js | 3 ++- lib/modules/docker/__tests__/index.js | 4 +++- lib/modules/meteor/__tests__/index.js | 26 ++++++++++++++------------ lib/modules/mongo/__tests__/index.js | 16 +++++++++------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lib/modules/default/__tests__/index.js b/lib/modules/default/__tests__/index.js index 499773dc..1be5f753 100644 --- a/lib/modules/default/__tests__/index.js +++ b/lib/modules/default/__tests__/index.js @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ import {expect} from 'chai'; import path from 'path'; import sh from 'shelljs'; @@ -39,7 +40,7 @@ describe('module - default', function () { describe('init', function () { it('should create "mup.js" and "setting.json" in ./tests/project-2', done => { - const dir = path.resolve(__rootdir, 'tests/project-2'); + const dir = path.resolve(__rootdir, 'tests/project-tmp'); sh.mkdir(dir); sh.cd(dir); sh.exec('mup init'); diff --git a/lib/modules/docker/__tests__/index.js b/lib/modules/docker/__tests__/index.js index eb59d63b..bdf4a259 100644 --- a/lib/modules/docker/__tests__/index.js +++ b/lib/modules/docker/__tests__/index.js @@ -1,9 +1,11 @@ +/* eslint-disable max-len */ import {describe, it} from 'mocha'; import assert from 'assert'; import path from 'path'; import sh from 'shelljs'; import {countOccurences, runSSHCommand} from '../../utils'; +sh.config.silent = false; // require server ssh auth information from tests directory const servers = require(path.resolve(__rootdir, 'tests/servers')); @@ -28,7 +30,7 @@ describe('module - docker', function () { sh.cd(path.resolve(__rootdir, 'tests/project-1')); - const out = sh.exec('mup docker setup', {silent: false}); + const out = sh.exec('mup docker setup'); assert.equal(out.code, 0); const num = countOccurences('setup docker: SUCCESS', out.output); diff --git a/lib/modules/meteor/__tests__/index.js b/lib/modules/meteor/__tests__/index.js index 2926073b..fbbae3b7 100644 --- a/lib/modules/meteor/__tests__/index.js +++ b/lib/modules/meteor/__tests__/index.js @@ -1,9 +1,11 @@ +/* eslint-disable max-len */ import assert from 'assert'; import path from 'path'; import sh from 'shelljs'; import {describe, it} from 'mocha'; import {countOccurences, runSSHCommand} from '../../utils'; +sh.config.silent = false; const servers = require(path.resolve(__rootdir, 'tests/servers')); describe('module - meteor', function () { @@ -27,7 +29,7 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp/', 'tests/project-1')); - const out = sh.exec('mup meteor setup', {silent: true}); + const out = sh.exec('mup meteor setup'); assert.equal(out.code, 0); const num = countOccurences('Setup Environment: SUCCESS', out.output); @@ -50,9 +52,9 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp','tests/project-1')); - sh.exec('mup meteor setup', {silent: true}); + sh.exec('mup meteor setup'); - const out = sh.exec('mup meteor push', {silent: true}); + const out = sh.exec('mup meteor push'); assert.equal(out.code, 0); const num = countOccurences('Pushing Meteor App Bundle to The Server: SUCCESS', out.output); @@ -75,9 +77,9 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp', 'tests/project-1')); - sh.exec('mup meteor setup', {silent: true}); + sh.exec('mup meteor setup'); - const out = sh.exec('mup meteor envconfig', {silent: true}); + const out = sh.exec('mup meteor envconfig'); assert.equal(out.code, 0); const num = countOccurences('Sending Environment Variables: SUCCESS', out.output); @@ -100,8 +102,8 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp', 'tests/project-1')); - sh.exec('mup docker setup && mup meteor setup && mup meteor push && mup meteor envconfig', {silent: true}); - const out = sh.exec('mup meteor start', {silent: true}); + sh.exec('mup docker setup && mup meteor setup && mup meteor push && mup meteor envconfig'); + const out = sh.exec('mup meteor start'); assert.equal(out.code, 0); const num = countOccurences('Start Meteor: SUCCESS', out.output); @@ -122,8 +124,8 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp', 'tests/project-1')); - sh.exec('mup docker setup && mup meteor setup', {silent: true}); - const out = sh.exec('mup meteor deploy', {silent: true}); + sh.exec('mup docker setup && mup meteor setup'); + const out = sh.exec('mup meteor deploy'); assert.equal(out.code, 0); const num = countOccurences('Sending Environment Variables: SUCCESS', out.output); @@ -147,7 +149,7 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp','tests/project-1')); - const out = sh.exec('mup meteor logs', {silent: true}); + const out = sh.exec('mup meteor logs'); assert.equal(out.code, 0); }); }); @@ -160,8 +162,8 @@ describe('module - meteor', function () { sh.cd(path.resolve('/tmp', 'tests/project-1')); - sh.exec('mup docker setup && mup meteor setup && mup meteor deploy', {silent: true}); - const out = sh.exec('mup meteor stop', {silent: true}); + sh.exec('mup docker setup && mup meteor setup && mup meteor deploy'); + const out = sh.exec('mup meteor stop'); assert.equal(out.code, 0); const num = countOccurences('Stop Meteor: SUCCESS', out.output); diff --git a/lib/modules/mongo/__tests__/index.js b/lib/modules/mongo/__tests__/index.js index a2c23603..6f526c5b 100644 --- a/lib/modules/mongo/__tests__/index.js +++ b/lib/modules/mongo/__tests__/index.js @@ -1,9 +1,11 @@ +/* eslint-disable max-len */ import {expect} from 'chai'; import path from 'path'; import sh from 'shelljs'; import {describe, it} from 'mocha'; import {countOccurences, runSSHCommand} from '../../utils'; +sh.config.silent = false; const servers = require(path.resolve(__rootdir, 'tests/servers')); describe('module - mongo', function () { @@ -21,8 +23,8 @@ describe('module - mongo', function () { it('should pull logs from "meteor" vm', async done => { sh.cd(path.resolve(__rootdir, 'tests/project-1')); - sh.exec('mup docker setup && mup mongo setup && mup mongo start', {silent: true}); - const out = sh.exec('mup mongo logs', {silent: true}); + sh.exec('mup docker setup && mup mongo setup && mup mongo start'); + const out = sh.exec('mup mongo logs'); expect(out.code).to.be.equal(0); expect(countOccurences('MongoDB starting :', out.output)).to.be.equal(1); @@ -38,7 +40,7 @@ describe('module - mongo', function () { const serverInfo = servers['mymongo']; sh.cd(path.resolve(__rootdir,'tests/project-1')); - const out = sh.exec('mup mongo setup', {silent: true}); + const out = sh.exec('mup mongo setup'); expect(out.code).to.be.equal(0); expect(countOccurences('setup environment: SUCCESS', out.output)).to.be.equal(1); @@ -57,9 +59,9 @@ describe('module - mongo', function () { const serverInfo = servers['mymongo']; sh.cd(path.resolve(__rootdir, 'tests/project-1')); - sh.exec('mup docker setup && mup mongo setup', {silent: true}); + sh.exec('mup docker setup && mup mongo setup'); - const out = sh.exec('mup mongo start', {silent: true}); + const out = sh.exec('mup mongo start'); expect(out.code).to.be.equal(0); expect(countOccurences('start mongo: SUCCESS', out.output)).to.be.equal(1); @@ -78,9 +80,9 @@ describe('module - mongo', function () { const serverInfo = servers['mymongo']; sh.cd(path.resolve(__rootdir, 'tests/project-1')); - sh.exec('mup docker setup && mup mongo setup && mup mongo start', {silent: true}); + sh.exec('mup docker setup && mup mongo setup && mup mongo start'); - const out = sh.exec('mup mongo stop', {silent: true}); + const out = sh.exec('mup mongo stop'); expect(out.code).to.be.equal(0); expect(countOccurences('stop mongo: SUCCESS', out.output)).to.be.equal(1);