Skip to content

Commit 0bc76f1

Browse files
author
zhuwang
committed
Added test case to verify the number of workers
1 parent c597268 commit 0bc76f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/nanny-feature-test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe('Test Cluster2 Nanny Feature', function () {
1818
_.extend(env, {
1919
host: '127.0.0.1',
2020
port: 3000,
21+
monPort: 3001,
2122
noWorkers: 2,
2223
heartbeatInterval: 500,
2324
maxHeartbeatDelay: 1500
@@ -52,6 +53,15 @@ describe('Test Cluster2 Nanny Feature', function () {
5253
}
5354
});
5455
});
56+
57+
it('Should always has 2 workers running', function (done) {
58+
request.get('http://127.0.0.1:3001/ComponentStatus?component=worker', function (err, res, body) {
59+
console.log(body);
60+
var pids = body.substring(1, body.length - 1).split(',');
61+
pids.length.should.equal(3); // master & 2 workers
62+
done();
63+
});
64+
});
5565

5666
after(function (done) {
5767
childProc.kill('SIGKILL');

0 commit comments

Comments
 (0)