Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50655 views
1
/*
2
* check-process-test.js: Tests for forever.checkProcess(pid)
3
*
4
* (C) 2010 Nodejitsu Inc.
5
* MIT LICENCE
6
*
7
*/
8
9
var assert = require('assert'),
10
path = require('path'),
11
vows = require('vows'),
12
fmonitor = require('../../lib');
13
14
vows.describe('forever/core/check-process').addBatch({
15
"When using forever": {
16
"checking if process exists": {
17
"if process exists": {
18
topic: fmonitor.checkProcess(process.pid),
19
"should return true": function (result) {
20
assert.isTrue(result);
21
}
22
},
23
"if process doesn't exist": {
24
topic: fmonitor.checkProcess(255 * 255 * 255),
25
//
26
// This is insanely large value. On most systems there'll be no process
27
// with such PID. Also, there's no multiplatform way to check for
28
// PID limit.
29
//
30
"should return false": function (result) {
31
assert.isFalse(result);
32
}
33
}
34
}
35
}
36
}).export(module);
37
38