mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
pushed new blog post
This commit is contained in:
67
node_modules/forever/test/core/start-stop-json-array-test.js
generated
vendored
Normal file
67
node_modules/forever/test/core/start-stop-json-array-test.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* start-stop-json-test.js: start or stop forever using relative paths, the script path could be start with './', '../' ...
|
||||
*
|
||||
* (C) 2010 Charlie Robbins & the Contributors
|
||||
* MIT LICENCE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
vows = require('vows'),
|
||||
async = require('utile').async,
|
||||
request = require('request'),
|
||||
forever = require('../../lib/forever'),
|
||||
runCmd = require('../helpers').runCmd;
|
||||
|
||||
vows.describe('forever/core/start-stop-json-array').addBatch({
|
||||
"When using forever" : {
|
||||
"to start process using JSON configuration file containing an array" : {
|
||||
topic: function () {
|
||||
runCmd('start', [
|
||||
'./test/fixtures/servers.json'
|
||||
]);
|
||||
setTimeout(function (that) {
|
||||
forever.list(false, that.callback);
|
||||
}, 2000, this);
|
||||
},
|
||||
"the startup should works fine": function (err, procs) {
|
||||
assert.isNull(err);
|
||||
assert.isArray(procs);
|
||||
assert.equal(procs.length, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).addBatch({
|
||||
"When the script is running": {
|
||||
"request to both ports": {
|
||||
topic: function () {
|
||||
async.parallel({
|
||||
one: async.apply(request, { uri: 'http://localhost:8080', json: true }),
|
||||
two: async.apply(request, { uri: 'http://localhost:8081', json: true })
|
||||
}, this.callback);
|
||||
},
|
||||
"should respond correctly": function (err, results) {
|
||||
assert.isNull(err);
|
||||
assert.isTrue(!results.one[1].p);
|
||||
assert.equal(results.two[1].p, 8081);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).addBatch({
|
||||
"When the script is running" : {
|
||||
"try to stopall" : {
|
||||
topic: function () {
|
||||
runCmd('stopall', []);
|
||||
setTimeout(function (that) {
|
||||
forever.list(false, that.callback);
|
||||
}, 2000, this);
|
||||
},
|
||||
"the shut down should works fine": function (err, procs) {
|
||||
assert.isNull(err);
|
||||
assert.isNull(procs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
51
node_modules/forever/test/core/start-stop-json-obj-test.js
generated
vendored
Normal file
51
node_modules/forever/test/core/start-stop-json-obj-test.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* start-stop-json-test.js: start or stop forever using relative paths, the script path could be start with './', '../' ...
|
||||
*
|
||||
* (C) 2010 Charlie Robbins & the Contributors
|
||||
* MIT LICENCE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
vows = require('vows'),
|
||||
forever = require('../../lib/forever'),
|
||||
runCmd = require('../helpers').runCmd;
|
||||
|
||||
vows.describe('forever/core/start-stop-json-obj').addBatch({
|
||||
"When using forever" : {
|
||||
"to start process using JSON configuration file containing an object" : {
|
||||
topic: function () {
|
||||
runCmd('start', [
|
||||
'./test/fixtures/server.json'
|
||||
]);
|
||||
setTimeout(function (that) {
|
||||
forever.list(false, that.callback);
|
||||
}, 2000, this);
|
||||
},
|
||||
"the startup should works fine": function (err, procs) {
|
||||
assert.isNull(err);
|
||||
assert.isArray(procs);
|
||||
assert.equal(procs.length, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).addBatch({
|
||||
"When the script is running" : {
|
||||
"try to stop by uid" : {
|
||||
topic: function () {
|
||||
runCmd('stop', [
|
||||
'server'
|
||||
]);
|
||||
setTimeout(function (that) {
|
||||
forever.list(false, that.callback);
|
||||
}, 2000, this);
|
||||
},
|
||||
"the shut down should works fine": function (err, procs) {
|
||||
assert.isNull(err);
|
||||
assert.isNull(procs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
Reference in New Issue
Block a user