Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added daemon tests (first hacky version)
- Loading branch information
Showing
17 changed files
with
388 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
var acoverride = require('../lib/appconf-override'); | ||
var t = require('tap'); | ||
|
||
|
||
t.test('appconf-override', function(t) { | ||
var overriden = acoverride(['first', 'second'], { | ||
item: 1, | ||
servers: { | ||
first: { | ||
item:2 | ||
}, | ||
second: { | ||
item:3 | ||
module.exports = function(t) { | ||
t.test('appconf-override', function(t){ | ||
var overriden = acoverride(['first', 'second'], { | ||
item: 1, | ||
servers: { | ||
first: { | ||
item:2 | ||
}, | ||
second: { | ||
item:3 | ||
} | ||
} | ||
} | ||
}); | ||
t.equals(overriden.item, 2, 'highest priority tag chosen'); | ||
t.end(); | ||
}); | ||
t.equals(overriden.item, 2, 'highest priority tag chosen'); | ||
t.end(); | ||
}); | ||
}; | ||
|
||
if (!process.env.COVER) | ||
module.exports(require('tap')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var tap = require('tap'); | ||
|
||
process.env.COVER = true; | ||
|
||
fs.readdirSync(path.join(__dirname, '..')) | ||
.filter(function(f) { return f.indexOf('.js') > 0; }) | ||
.forEach(function (f) { | ||
var test = require('../' + f); | ||
test(tap); | ||
tap.test(function(t) { | ||
t.ok(true, 'All tests run'); | ||
setTimeout(process.exit, 1000) | ||
t.end(); | ||
|
||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
command: './process.js' | ||
args: | ||
die: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
command: './process.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env node | ||
|
||
var args = require('optimist').argv; | ||
|
||
|
||
console.log(process.env.ENV_TEST || "Hello world"); | ||
|
||
|
||
// Stay in the background | ||
setInterval(function () { | ||
|
||
}, 10000); | ||
|
||
|
||
if (args.die) setTimeout(function () { | ||
console.error("Had fatal error!"); | ||
process.exit(args.code || 0); | ||
}, args.die || 1); | ||
|
||
|
||
process.on('SIGUSR2', function() { | ||
console.log("SIGUSR2"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var mkdirp = require('mkdirp'); | ||
var path = require('path'); | ||
|
||
process.env.NACD_DATABASE = ''; | ||
process.env.NACD_CONFIG = path.join(__dirname, 'harness', 'nacd.conf'); | ||
process.env.NACD_LOGFLUSH = 1; | ||
|
||
var Daemon = require('../../lib/daemon/daemon'); | ||
|
||
exports.daemon = function create(cb) { | ||
Daemon.create(function (err, daemon) { | ||
if (err) | ||
return cb(err); | ||
cb(null, function createClient() { | ||
return Daemon.interface(process.getuid(), daemon); | ||
}); | ||
}); | ||
|
||
}; | ||
|
||
exports.config = path.join(__dirname, 'config.yaml'); | ||
exports.configErr = path.join(__dirname, 'config-err.yaml'); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.