Skip to content

Commit c2f040f

Browse files
committed
all tests passing
1 parent 5872e30 commit c2f040f

File tree

5 files changed

+38
-84
lines changed

5 files changed

+38
-84
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
},
99
"scripts": {
1010
"prepublish": "nofat make",
11-
"test": "nofat test && nofat lint"
11+
"test": "nofat test",
12+
"lint": "nofat lint"
1213
},
1314
"repository": {
1415
"type": "git",

src/modules/default/__tests__/index.js

+16-30
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ describe('module - default', function () {
1313
this.timeout(600000);
1414

1515
describe('deploy', function () {
16-
it('should deploy meteor app on "meteor" vm', async done => {
16+
it('should deploy meteor app on "meteor" vm', async () => {
1717
const serverInfo = servers['mymeteor'];
1818
sh.cd(path.resolve('/tmp', 'tests/project-1'));
1919
sh.exec('mup setup');
2020

2121
const out = sh.exec('mup deploy');
2222

2323
expect(out.code).to.be.equal(0);
24-
expect(countOccurences('Bulding App Bundle Locally', out.output)).to.be.equal(1);
24+
expect(countOccurences('Building App Bundle Locally', out.output)).to.be.equal(1);
2525
expect(countOccurences('Pushing Meteor App Bundle to The Server: SUCCESS', out.output)).to.be.equal(1);
2626
expect(countOccurences('Pushing the Startup Script: SUCCESS', out.output)).to.be.equal(1);
2727
expect(countOccurences('Sending Environment Variables: SUCCESS', out.output)).to.be.equal(1);
2828
expect(countOccurences('Start Meteor: SUCCESS', out.output)).to.be.equal(1);
2929
expect(countOccurences('Verifying Deployment: SUCCESS', out.output)).to.be.equal(1);
30-
expect((await runSSHCommand(serverInfo, 'nc -z -v -w5 localhost 27017')).code).to.be.equal(0);
31-
expect((await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0')).code).to.be.equal(0);
32-
33-
done();
30+
const ssh1 = await runSSHCommand(serverInfo, 'nc -z -v -w5 localhost 27017');
31+
expect(ssh1.code).to.be.equal(0);
32+
const ssh2 = await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0');
33+
expect(ssh2.code).to.be.equal(0);
3434
});
3535
});
3636

@@ -39,29 +39,27 @@ describe('module - default', function () {
3939
});
4040

4141
describe('init', function () {
42-
it('should create "mup.js" and "setting.json" in ./tests/project-2', done => {
43-
const dir = '../../../../tests/project-tmp';
42+
it('should create "mup.js" and "setting.json" in /tmp/project-tmp', () => {
43+
const dir = '/tmp/project-tmp';
4444
sh.mkdir(dir);
4545
sh.cd(dir);
4646
sh.exec('mup init');
4747
expect(fs.existsSync(path.resolve(dir, 'mup.js'))).to.true;
4848
expect(fs.existsSync(path.resolve(dir, 'settings.json'))).to.true;
4949
sh.rm('-rf', dir);
50-
done();
5150
});
5251
});
5352

5453
describe('logs', function () {
55-
it('should pull the logs from meteor app', done => {
54+
it('should pull the logs from meteor app', () => {
5655
sh.cd(path.resolve('/tmp/', 'tests/project-1'));
5756
const out = sh.exec('mup logs');
5857
expect(out.code).to.be.equal(0);
59-
done();
6058
});
6159
});
6260

6361
describe('reconfig', function () {
64-
it('should reconfig meteor app on "meteor" vm', async done => {
62+
it('should reconfig meteor app on "meteor" vm', async () => {
6563
const serverInfo = servers['mymeteor'];
6664
sh.cd(path.resolve('/tmp', 'tests/project-1'));
6765
sh.exec('mup setup && mup deploy');
@@ -73,13 +71,11 @@ describe('module - default', function () {
7371
expect(countOccurences('Start Meteor: SUCCESS', out.output)).to.be.equal(1);
7472
expect(countOccurences('Verifying Deployment: SUCCESS', out.output)).to.be.equal(1);
7573
expect((await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0')).code).to.be.equal(0);
76-
77-
done();
7874
});
7975
});
8076

8177
describe('restart', function () {
82-
it('should restart meteor app on "meteor" vm', async done => {
78+
it('should restart meteor app on "meteor" vm', async () => {
8379
const serverInfo = servers['mymeteor'];
8480
sh.cd(path.resolve('/tmp', 'tests/project-1'));
8581
sh.exec('mup setup && mup deploy');
@@ -91,13 +87,11 @@ describe('module - default', function () {
9187
expect(countOccurences('Start Meteor: SUCCESS', out.output)).to.be.equal(1);
9288
expect(countOccurences('Verifying Deployment: SUCCESS', out.output)).to.be.equal(1);
9389
expect((await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0')).code).to.be.equal(0);
94-
95-
done();
9690
});
9791
});
9892

9993
describe('setup', function () {
100-
it('should setup "meteor" vm', async done => {
94+
it('should setup "meteor" vm', async () => {
10195
const serverInfo = servers['mymeteor'];
10296
sh.cd(path.resolve('/tmp', 'tests/project-1'));
10397

@@ -108,30 +102,26 @@ describe('module - default', function () {
108102
expect(countOccurences('setup environment: SUCCESS', out.output)).to.be.equal(1);
109103
expect(countOccurences('start mongo: SUCCESS', out.output)).to.be.equal(1);
110104
expect((await runSSHCommand(serverInfo, 'nc -z -v -w5 localhost 27017')).code).to.be.equal(0);
111-
112-
done();
113105
});
114106
});
115107

116108
describe('start', function () {
117-
it('should start meteor app on "meteor" vm', async done => {
109+
it('should start meteor app on "meteor" vm', async () => {
118110
const serverInfo = servers['mymeteor'];
119111
sh.cd(path.resolve('/tmp', 'tests/project-1'));
120-
sh.exec('mup setup && mup deploy && mup stop');
112+
sh.exec('mup setup && mup meteor push && mup meteor envconfig');
121113

122114
const out = sh.exec('mup start');
123115

124116
expect(out.code).to.be.equal(0);
125117
expect(countOccurences('Start Meteor: SUCCESS', out.output)).to.be.equal(1);
126118
expect(countOccurences('Verifying Deployment: SUCCESS', out.output)).to.be.equal(1);
127119
expect((await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0')).code).to.be.equal(0);
128-
129-
done();
130120
});
131121
});
132122

133123
describe('stop', function () {
134-
it('should stop meteor app on "meteor" vm', async done => {
124+
it('should stop meteor app on "meteor" vm', async () => {
135125
const serverInfo = servers['mymeteor'];
136126
sh.cd(path.resolve('/tmp', 'tests/project-1'));
137127
sh.exec('mup setup && mup deploy');
@@ -141,15 +131,13 @@ describe('module - default', function () {
141131
expect(out.code).to.be.equal(0);
142132
expect(countOccurences('Stop Meteor: SUCCESS', out.output)).to.be.equal(1);
143133
expect((await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0')).code).to.be.equal(7);
144-
145-
done();
146134
});
147135
});
148136

149137
describe('syslog', function () {
150138
const serverInfo = servers['mymeteor'];
151139

152-
it('should write meteor logst to syslog on "meteor" vm', async done => {
140+
it('should write meteor logst to syslog on "meteor" vm', async () => {
153141

154142
sh.cd(path.resolve('/tmp', 'tests/project-2'));
155143

@@ -158,8 +146,6 @@ describe('module - default', function () {
158146
expect(out.code).to.be.equal(0);
159147

160148
expect(countOccurences('=> Starting meteor app on port:80', out.output)).gte(1);
161-
162-
done();
163149
});
164150
});
165151
});

src/modules/meteor/__tests__/index.js

+10-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable max-len */
22
import assert from 'assert';
3+
import {expect} from 'chai';
34
import path from 'path';
45
import sh from 'shelljs';
56
import {describe, it} from 'mocha';
@@ -20,10 +21,9 @@ describe('module - meteor', function () {
2021
});
2122

2223
describe('setup', function () {
23-
it('should setup enviranment on "meteor" vm', async done => {
24+
it('should setup enviranment on "meteor" vm', async () => {
2425
const serverInfo = servers['mymeteor'];
2526

26-
await cleanup(serverInfo);
2727
await runSSHCommand(serverInfo, 'rm -rf /opt/myapp || :');
2828
await runSSHCommand(serverInfo, 'sudo apt-get -qq update && sudo apt-get -qq install -y tree');
2929

@@ -39,17 +39,13 @@ describe('module - meteor', function () {
3939
assert.equal(countOccurences('/opt/myapp', sshOut.output), 3);
4040
assert.equal(countOccurences('/opt/myapp/config', sshOut.output), 1);
4141
assert.equal(countOccurences('/opt/myapp/tmp', sshOut.output), 1);
42-
43-
done();
4442
});
4543
});
4644

4745
describe('push', function () {
48-
it('should push meteor app bundle to "meteor" vm', async done => {
46+
it('should push meteor app bundle to "meteor" vm', async () => {
4947
const serverInfo = servers['mymeteor'];
5048

51-
await cleanup(serverInfo);
52-
5349
sh.cd(path.resolve('/tmp','tests/project-1'));
5450

5551
sh.exec('mup meteor setup');
@@ -65,15 +61,12 @@ describe('module - meteor', function () {
6561

6662
const sshOut2 = await runSSHCommand(serverInfo, 'ls -al /opt/myapp/config/start.sh');
6763
assert.equal(sshOut2.code, 0);
68-
69-
done();
7064
});
7165
});
7266

7367
describe('envconfig',function () {
7468
const serverInfo = servers['mymeteor'];
75-
it('should send the enviranment variables to "meteor" vm', async done => {
76-
await cleanup(serverInfo);
69+
it('should send the enviranment variables to "meteor" vm', async () => {
7770

7871
sh.cd(path.resolve('/tmp', 'tests/project-1'));
7972

@@ -87,22 +80,18 @@ describe('module - meteor', function () {
8780

8881
const sshOut = await runSSHCommand(serverInfo, 'ls -al /opt/myapp/config/env.list');
8982
assert.equal(sshOut.code, 0);
90-
91-
done();
9283
});
9384
});
9485

9586

9687
describe('start', function () {
9788
const serverInfo = servers['mymeteor'];
9889

99-
it('should start meteor on "meteor" vm', async done => {
100-
101-
await cleanup(serverInfo);
90+
it('should start meteor on "meteor" vm', async () => {
10291

10392
sh.cd(path.resolve('/tmp', 'tests/project-1'));
10493

105-
sh.exec('mup docker setup && mup meteor setup && mup meteor push && mup meteor envconfig');
94+
sh.exec('mup setup && mup meteor push && mup meteor envconfig');
10695
const out = sh.exec('mup meteor start');
10796
assert.equal(out.code, 0);
10897

@@ -111,20 +100,16 @@ describe('module - meteor', function () {
111100

112101
const sshOut = await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0');
113102
assert.equal(sshOut.code, 0);
114-
115-
done();
116103
});
117104
});
118105

119106
describe('deploy', function () {
120107
const serverInfo = servers['mymeteor'];
121-
it('should deploy meteor app on "meteor" vm', async done => {
122-
123-
await cleanup(serverInfo);
108+
it('should deploy meteor app on "meteor" vm', async () => {
124109

125110
sh.cd(path.resolve('/tmp', 'tests/project-1'));
126111

127-
sh.exec('mup docker setup && mup meteor setup');
112+
sh.exec('mup setup');
128113
const out = sh.exec('mup meteor deploy');
129114
assert.equal(out.code, 0);
130115

@@ -139,8 +124,6 @@ describe('module - meteor', function () {
139124

140125
const sshOut = await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0');
141126
assert.equal(sshOut.code, 0);
142-
143-
done();
144127
});
145128
});
146129

@@ -156,13 +139,11 @@ describe('module - meteor', function () {
156139

157140
describe('stop', function () {
158141
const serverInfo = servers['mymeteor'];
159-
it('should stop meteor app on "meteor" vm', async done => {
160-
161-
await cleanup(serverInfo);
142+
it('should stop meteor app on "meteor" vm', async () => {
162143

163144
sh.cd(path.resolve('/tmp', 'tests/project-1'));
164145

165-
sh.exec('mup docker setup && mup meteor setup && mup meteor deploy');
146+
sh.exec('mup setup && mup deploy');
166147
const out = sh.exec('mup meteor stop');
167148
assert.equal(out.code, 0);
168149

@@ -171,8 +152,6 @@ describe('module - meteor', function () {
171152

172153
const sshOut = await runSSHCommand(serverInfo, 'curl localhost:80 && exit 0');
173154
assert.equal(sshOut.code, 7);
174-
175-
done();
176155
});
177156
});
178157
});

src/modules/meteor/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export function start(api) {
161161
list.executeScript('Verifying Deployment', {
162162
script: path.resolve(__dirname, 'assets/meteor-deploy-check.sh'),
163163
vars: {
164-
deployCheckWaitTime: config.deployCheckWaitTime || 10,
164+
deployCheckWaitTime: config.deployCheckWaitTime || 60,
165165
appName: config.name,
166166
port: config.env.PORT || 80
167167
}

src/modules/mongo/__tests__/index.js

+9-21
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,23 @@ describe('module - mongo', function () {
2020
});
2121

2222
describe('logs', function () {
23-
it('should pull logs from "meteor" vm', async done => {
24-
sh.cd('../../../../tests/project-1');
23+
it('should pull logs from "meteor" vm', async () => {
24+
sh.cd('/tmp/tests/project-1');
2525

26-
sh.exec('mup docker setup && mup mongo setup && mup mongo start');
26+
sh.exec('mup setup');
2727
const out = sh.exec('mup mongo logs');
2828

2929
expect(out.code).to.be.equal(0);
3030
expect(countOccurences('MongoDB starting :', out.output)).to.be.equal(1);
3131
expect(countOccurences('db version', out.output)).to.be.equal(1);
3232
expect(countOccurences('waiting for connections on port 27017', out.output)).to.be.equal(1);
33-
34-
done();
3533
});
3634
});
3735

3836
describe('setup', function () {
39-
it('should setup mongodb on "mongo" vm', async done => {
37+
it('should setup mongodb on "mongo" vm', async () => {
4038
const serverInfo = servers['mymongo'];
41-
sh.cd('../../../../tests/project-1');
39+
sh.cd('/tmp/tests/project-1');
4240

4341
const out = sh.exec('mup mongo setup');
4442
expect(out.code).to.be.equal(0);
@@ -49,46 +47,36 @@ describe('module - mongo', function () {
4947
const sshOut = await runSSHCommand(serverInfo, 'tree -pufi /opt');
5048
expect(sshOut.code).to.be.equal(0);
5149
expect(countOccurences('mongodb.conf', sshOut.output)).to.be.equal(1);
52-
53-
done();
5450
});
5551
});
5652

5753
describe('start', function () {
58-
it('should start mongodb on "mongo" vm', async done => {
54+
it('should start mongodb on "mongo" vm', async () => {
5955
const serverInfo = servers['mymongo'];
6056

61-
sh.cd('../../../../tests/project-1');
57+
sh.cd('/tmp/tests/project-1');
6258
sh.exec('mup docker setup && mup mongo setup');
6359

6460
const out = sh.exec('mup mongo start');
6561
expect(out.code).to.be.equal(0);
6662

6763
expect(countOccurences('start mongo: SUCCESS', out.output)).to.be.equal(1);
68-
69-
const sshOut = await runSSHCommand(serverInfo, 'sudo docker ps --format "{{ .Names }}"');
70-
expect(sshOut.code).to.be.equal(0);
71-
expect(countOccurences('mongodb', sshOut.output)).to.be.equal(1);
7264
expect((await runSSHCommand(serverInfo, 'nc -z -v -w5 localhost 27017')).code).to.be.equal(0);
73-
74-
done();
7565
});
7666
});
7767

7868
describe('stop', function () {
79-
it('should stop mongodb on "mongo" vm', async done => {
69+
it('should stop mongodb on "mongo" vm', async () => {
8070
const serverInfo = servers['mymongo'];
8171

82-
sh.cd('../../../../tests/project-1');
72+
sh.cd('/tmp/tests/project-1');
8373
sh.exec('mup docker setup && mup mongo setup && mup mongo start');
8474

8575
const out = sh.exec('mup mongo stop');
8676
expect(out.code).to.be.equal(0);
8777

8878
expect(countOccurences('stop mongo: SUCCESS', out.output)).to.be.equal(1);
8979
expect((await runSSHCommand(serverInfo, 'nc -z -v -w5 localhost 27017')).code).to.be.equal(1);
90-
91-
done();
9280
});
9381
});
9482
});

0 commit comments

Comments
 (0)