opts.skip for destructive stuff

This commit is contained in:
Dave Eddy 2015-09-25 13:45:16 -04:00
parent 2eeb68cba5
commit 403e4bd204

View File

@ -12,7 +12,6 @@
* Test create/start/stop/delete/etc. work flows
*/
var assert = require('assert');
var f = require('util').format;
var vasync = require('vasync');
@ -26,12 +25,9 @@ var VM_ALIAS = 'node-triton-test-vm-1';
var VM_IMAGE = 'base-64@15.2.0';
var VM_PACKAGE = 't4-standard-128M';
// TODO clean this up
assert.equal(h.CONFIG.url, 'https://us-east-3b.api.joyent.com');
if (h.CONFIG.destructiveAllowed !== true) {
console.error('skipping manage integration tests - destructive actions disabled');
return;
}
var opts = {
skip: !h.CONFIG.destructiveAllowed
};
/*
* h.triton wrapper that:
@ -60,8 +56,13 @@ var instance;
// --- Tests
// create a test machine (blocking) and output JSON
test('triton create', function (t) {
if (opts.skip) {
console.error('** skipping manage workflow tests');
console.error('** set "destructiveAllowed" to enable');
}
test('triton manage workflow', opts, function (t) {
// create a test machine (blocking) and output JSON
test('triton create', function (t) {
triton(t, ['create', '-wjn', VM_ALIAS, VM_IMAGE, VM_PACKAGE],
function (stdout) {
@ -83,10 +84,10 @@ test('triton create', function (t) {
t.end();
});
});
});
// test `triton instance -j` with the UUID, the alias, and the short ID
test('triton instance', function (t) {
// test `triton instance -j` with the UUID, the alias, and the short ID
test('triton instance', function (t) {
var uuid = instance.id;
var shortId = common.uuidToShortId(uuid);
vasync.parallel({
@ -127,11 +128,12 @@ test('triton instance', function (t) {
t.end();
});
});
});
// remove test instance
test('triton delete', function (t) {
// remove test instance
test('triton delete', function (t) {
triton(t, ['delete', '-w', instance.id], function (stdout) {
t.end();
});
});
});