8000 test(pm2): once more, really making it more reliable this time · wxqGitHub/log4js-node@0d221a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d221a0

Browse files
author
Gareth Jones
committed
test(pm2): once more, really making it more reliable this time
1 parent a690ba0 commit 0d221a0

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

test/tap/pm2-support-test.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,29 @@ if (cluster.isMaster) {
3636
cluster.on('exit', () => {
3737
count += 1;
3838
if (count === 2) {
39-
test('PM2 Support', (batch) => {
40-
batch.test('should not get any events when turned off', (t) => {
41-
t.notOk(appEvents['0'].filter(e => e && e.data[0].indexOf('will not be logged') > -1).length);
42-
t.notOk(appEvents['1'].filter(e => e && e.data[0].indexOf('will not be logged') > -1).length);
43 8000 -
t.end();
44-
});
39+
// wait for any IPC messages still to come, because it seems they are slooooow.
40+
setTimeout(() => {
41+
test('PM2 Support', (batch) => {
42+
batch.test('should not get any events when turned off', (t) => {
43+
t.notOk(appEvents['0'].filter(e => e && e.data[0].indexOf('will not be logged') > -1).length);
44+
t.notOk(appEvents['1'].filter(e => e && e.data[0].indexOf('will not be logged') > -1).length);
45+
t.end();
46+
});
4547

46-
batch.test('should get events on app instance 0', (t) => {
47-
t.equal(appEvents['0'].length, 2);
48-
t.equal(appEvents['0'][0].data[0], 'this should now get logged');
49-
t.equal(appEvents['0'][1].data[0], 'this should now get logged');
50-
t.end();
51-
});
48+
batch.test('should get events on app instance 0', (t) => {
49+
t.equal(appEvents['0'].length, 2);
50+
t.equal(appEvents['0'][0].data[0], 'this should now get logged');
51+
t.equal(appEvents['0'][1].data[0], 'this should now get logged');
52+
t.end();
53+
});
5254

53-
batch.test('should not get events on app instance 1', (t) => {
54-
t.equal(appEvents['1'].length, 0);
55-
t.end();
55+
batch.test('should not get events on app instance 1', (t) => {
56+
t.equal(appEvents['1'].length, 0);
57+
t.end();
58+
});
59+
batch.end();
5660
});
57-
batch.end();
58-
});
61+
}, 1000);
5962
}
6063
cluster.removeListener('message', messageHandler);
6164
});

0 commit comments

Comments
 (0)
0