joyent/node-triton#39 change the test config 'destructiveAllowed' var to 'writeActionsAllowed'

Fixes #39
This commit is contained in:
Trent Mick 2015-10-07 12:19:26 -07:00
parent 796f4d069e
commit 0ee966e1c8
6 changed files with 18 additions and 16 deletions

View File

@ -2,7 +2,8 @@
## 2.1.1 (not yet released) ## 2.1.1 (not yet released)
(nothing yet) - #39 Test suite: Change the test config 'destructiveAllowed' var to
'writeActionsAllowed'.
## 2.1.0 ## 2.1.0

View File

@ -275,7 +275,7 @@ test-integration`). Integration tests require a config file, by default at
$ cat test/config.json $ cat test/config.json
{ {
"profileName": "east3b", "profileName": "east3b",
"destructiveAllowed": true, "allowWriteActions": true,
"image": "minimal-64", "image": "minimal-64",
"package": "t4-standard-128M" "package": "t4-standard-128M"
} }
@ -292,7 +292,7 @@ You can use `TRITON_TEST_CONFIG` to override the test file, e.g.:
$ cat test/coal.json $ cat test/coal.json
{ {
"profileName": "coal", "profileName": "coal",
"destructiveAllowed": true "allowWriteActions": true
} }
$ TRITON_TEST_CONFIG=test/coal.json make test $ TRITON_TEST_CONFIG=test/coal.json make test

View File

@ -11,10 +11,10 @@
"insecure": false "insecure": false
} }
// Optional. Set this to allow the parts of the test suite // Optional. Set this to allow the parts of the test suite that create,
// that create and destroy resources: instances, images, networks, etc. // update and destroy resources: instances, images, networks, etc.
// This is essentially the "safe" guard. // This is essentially the "safe" guard.
"destructiveAllowed": true "allowWriteActions": true
// The params used for test provisions. By default the tests use: // The params used for test provisions. By default the tests use:
// the smallest RAM package, the latest base* image. // the smallest RAM package, the latest base* image.

View File

@ -27,7 +27,7 @@ var h = require('./helpers');
var INST_ALIAS = f('node-triton-test-%s-vm1', os.hostname()); var INST_ALIAS = f('node-triton-test-%s-vm1', os.hostname());
var opts = { var opts = {
skip: !h.CONFIG.destructiveAllowed skip: !h.CONFIG.allowWriteActions
}; };
// global variable to hold vm instance JSON // global variable to hold vm instance JSON
@ -52,8 +52,8 @@ function _jsonStreamParse(s) {
// --- Tests // --- Tests
if (opts.skip) { if (opts.skip) {
console.error('** skipping manage workflow tests'); console.error('** skipping %s tests', __filename);
console.error('** set "destructiveAllowed" to enable'); console.error('** set "allowWriteActions" in test config to enable');
} }
test('triton manage workflow', opts, function (tt) { test('triton manage workflow', opts, function (tt) {
tt.comment('Test config:'); tt.comment('Test config:');

View File

@ -22,14 +22,15 @@ var PROFILE_FILE = path.join(__dirname, 'test-profile.json');
var PROFILE_DATA = JSON.parse(fs.readFileSync(PROFILE_FILE, 'utf8')); var PROFILE_DATA = JSON.parse(fs.readFileSync(PROFILE_FILE, 'utf8'));
var opts = { var opts = {
skip: !h.CONFIG.destructiveAllowed skip: !h.CONFIG.allowWriteActions
}; };
//
// --- Tests // --- Tests
if (opts.skip) { if (opts.skip) {
console.error('** skipping triton profile creation tests'); console.error('** skipping %s tests', __filename);
console.error('** set "destructiveAllowed" to enable'); console.error('** set "allowWriteActions" in test config to enable');
} }
test('triton profiles (read only)', function (tt) { test('triton profiles (read only)', function (tt) {

View File

@ -49,8 +49,8 @@ try {
throw new Error('one of "profile" or "profileName" must be defined ' + throw new Error('one of "profile" or "profileName" must be defined ' +
'in ' + configPath); 'in ' + configPath);
} }
assert.optionalBool(CONFIG.destructiveAllowed, assert.optionalBool(CONFIG.allowWriteActions,
'test/config.json#destructiveAllowed'); 'test/config.json#allowWriteActions');
} catch (e) { } catch (e) {
error('* * *'); error('* * *');
error('node-triton integration tests require a config file. By default'); error('node-triton integration tests require a config file. By default');
@ -70,8 +70,8 @@ try {
} }
if (CONFIG.profile.insecure === undefined) if (CONFIG.profile.insecure === undefined)
CONFIG.profile.insecure = false; CONFIG.profile.insecure = false;
if (CONFIG.destructiveAllowed === undefined) if (CONFIG.allowWriteActions === undefined)
CONFIG.destructiveAllowed = false; CONFIG.allowWriteActions = false;
var TRITON = [process.execPath, path.resolve(__dirname, '../../bin/triton')]; var TRITON = [process.execPath, path.resolve(__dirname, '../../bin/triton')];
var UA = 'node-triton-test'; var UA = 'node-triton-test';