Add test/ to make check, and fix that.

This commit is contained in:
Trent Mick 2015-09-25 12:24:37 -07:00
parent bf21ac467a
commit 1759b29f2f
4 changed files with 12 additions and 10 deletions

View File

@ -8,7 +8,7 @@
# Vars, Tools, Files, Flags
#
JS_FILES := bin/triton \
$(shell find lib -name '*.js' | grep -v '/tmp/')
$(shell find lib test -name '*.js' | grep -v '/tmp/')
JSL_CONF_NODE = tools/jsl.node.conf
JSL_FILES_NODE = $(JS_FILES)
JSSTYLE_FILES = $(JS_FILES)

View File

@ -54,15 +54,17 @@ function triton(t, args, cb) {
// global variable to hold vm instance JSON
var instance;
// --- Tests
if (opts.skip) {
console.error('** skipping manage workflow tests');
console.error('** set "destructiveAllowed" to enable');
}
test('triton manage workflow', opts, function (t) {
test('triton manage workflow', opts, function (tt) {
// create a test machine (blocking) and output JSON
test('triton create', function (t) {
tt.test('triton create', function (t) {
triton(t, ['create', '-wjn', VM_ALIAS, VM_IMAGE, VM_PACKAGE],
function (stdout) {
@ -87,7 +89,7 @@ test('triton manage workflow', opts, function (t) {
});
// test `triton instance -j` with the UUID, the alias, and the short ID
test('triton instance', function (t) {
tt.test('triton instance', function (t) {
var uuid = instance.id;
var shortId = common.uuidToShortId(uuid);
vasync.parallel({
@ -106,8 +108,8 @@ test('triton manage workflow', opts, function (t) {
triton(t, ['instance', '-j', shortId], function (stdout) {
cb(null, stdout);
});
},
],
}
]
}, function (err, results) {
if (h.ifErr(t, err, 'no error'))
return t.end();
@ -131,9 +133,10 @@ test('triton manage workflow', opts, function (t) {
});
// remove test instance
test('triton delete', function (t) {
tt.test('triton delete', function (t) {
triton(t, ['delete', '-w', instance.id], function (stdout) {
t.end();
});
});
});

View File

@ -40,7 +40,7 @@ var subs = [
['packages', 'pkgs'],
['package', 'pkg'],
['networks'],
['network'],
['network']
];
// --- Tests

View File

@ -177,7 +177,6 @@ test('humanDurationFromMs', function (t) {
var hour = minute * 60;
var day = hour * 24;
var week = day * 7;
var year = day * 365;
t.equal(humanDurationFromMs(47*second), '47s');
t.equal(humanDurationFromMs(1*week), '1w');