Add test/ to make check, and fix that.
This commit is contained in:
parent
bf21ac467a
commit
1759b29f2f
2
Makefile
2
Makefile
@ -8,7 +8,7 @@
|
|||||||
# Vars, Tools, Files, Flags
|
# Vars, Tools, Files, Flags
|
||||||
#
|
#
|
||||||
JS_FILES := bin/triton \
|
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_CONF_NODE = tools/jsl.node.conf
|
||||||
JSL_FILES_NODE = $(JS_FILES)
|
JSL_FILES_NODE = $(JS_FILES)
|
||||||
JSSTYLE_FILES = $(JS_FILES)
|
JSSTYLE_FILES = $(JS_FILES)
|
||||||
|
@ -54,15 +54,17 @@ function triton(t, args, cb) {
|
|||||||
// global variable to hold vm instance JSON
|
// global variable to hold vm instance JSON
|
||||||
var instance;
|
var instance;
|
||||||
|
|
||||||
|
|
||||||
// --- Tests
|
// --- Tests
|
||||||
|
|
||||||
if (opts.skip) {
|
if (opts.skip) {
|
||||||
console.error('** skipping manage workflow tests');
|
console.error('** skipping manage workflow tests');
|
||||||
console.error('** set "destructiveAllowed" to enable');
|
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
|
// 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],
|
triton(t, ['create', '-wjn', VM_ALIAS, VM_IMAGE, VM_PACKAGE],
|
||||||
function (stdout) {
|
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 -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 uuid = instance.id;
|
||||||
var shortId = common.uuidToShortId(uuid);
|
var shortId = common.uuidToShortId(uuid);
|
||||||
vasync.parallel({
|
vasync.parallel({
|
||||||
@ -106,8 +108,8 @@ test('triton manage workflow', opts, function (t) {
|
|||||||
triton(t, ['instance', '-j', shortId], function (stdout) {
|
triton(t, ['instance', '-j', shortId], function (stdout) {
|
||||||
cb(null, stdout);
|
cb(null, stdout);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}, function (err, results) {
|
}, function (err, results) {
|
||||||
if (h.ifErr(t, err, 'no error'))
|
if (h.ifErr(t, err, 'no error'))
|
||||||
return t.end();
|
return t.end();
|
||||||
@ -131,9 +133,10 @@ test('triton manage workflow', opts, function (t) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// remove test instance
|
// remove test instance
|
||||||
test('triton delete', function (t) {
|
tt.test('triton delete', function (t) {
|
||||||
triton(t, ['delete', '-w', instance.id], function (stdout) {
|
triton(t, ['delete', '-w', instance.id], function (stdout) {
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,7 @@ var subs = [
|
|||||||
['packages', 'pkgs'],
|
['packages', 'pkgs'],
|
||||||
['package', 'pkg'],
|
['package', 'pkg'],
|
||||||
['networks'],
|
['networks'],
|
||||||
['network'],
|
['network']
|
||||||
];
|
];
|
||||||
|
|
||||||
// --- Tests
|
// --- Tests
|
||||||
|
@ -25,7 +25,7 @@ var log = require('../lib/log');
|
|||||||
|
|
||||||
test('objCopy+deepObjCopy', function (t) {
|
test('objCopy+deepObjCopy', function (t) {
|
||||||
var o1 = {foo: 'bar'};
|
var o1 = {foo: 'bar'};
|
||||||
var o2 = {arr: [1,2,3]};
|
var o2 = {arr: [1, 2, 3]};
|
||||||
|
|
||||||
// shallow copy
|
// shallow copy
|
||||||
var c1 = common.objCopy(o1);
|
var c1 = common.objCopy(o1);
|
||||||
@ -177,7 +177,6 @@ test('humanDurationFromMs', function (t) {
|
|||||||
var hour = minute * 60;
|
var hour = minute * 60;
|
||||||
var day = hour * 24;
|
var day = hour * 24;
|
||||||
var week = day * 7;
|
var week = day * 7;
|
||||||
var year = day * 365;
|
|
||||||
|
|
||||||
t.equal(humanDurationFromMs(47*second), '47s');
|
t.equal(humanDurationFromMs(47*second), '47s');
|
||||||
t.equal(humanDurationFromMs(1*week), '1w');
|
t.equal(humanDurationFromMs(1*week), '1w');
|
||||||
|
Reference in New Issue
Block a user