Browse Source

TRITON-1409 node-triton tests: improve skip messages, skip "known fails" by default

Reviewed by: Marsell Kukuljevic <marsell@joyent.com>
Approved by: Marsell Kukuljevic <marsell@joyent.com>
tags/7.1.1
Trent Mick 6 months ago
parent
commit
18b8fae335

+ 14
- 0
README.md View File

@@ -412,6 +412,20 @@ There are a few `TEST_...` vars that can tweak how the tests are run.
those with "image" in the name, use `make test TEST_GLOB=*image*`, or
to run a specific test file: `make test TEST_GLOB=metadataFromOpts`.

- `TEST_KNOWN_FAIL=1` - At any given time there may be some known failures
in the test suite that are being worked on in specific tickets. Those
tests may be excluded from the default test run. These will show up in
test output like this:

```
test/integration/cli-snapshots.test.js ................ 0/1 1s
Skipped: 1
triton instance snapshot known failure, see TRITON-1387
```

Set the `TEST_KNOWN_FAIL=1` environment variable to include these tests
in the test run.

- `TEST_JOBS=<number of test files to run concurrently>` - By default this is
10. Set to 1 to run tests serially.


+ 3
- 1
test/integration/api-vlans.test.js View File

@@ -75,7 +75,9 @@ test('TritonApi vlan', function (suite) {
});


suite.test(' TritonApi deleteFabricVlan', function (t) {
suite.test(' TritonApi deleteFabricVlan', {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
}, function (t) {
function check(genId, idType, cb) {
CLIENT.cloudapi.createFabricVlan({
vlan_id: 3291,

+ 1
- 1
test/integration/cli-account.test.js View File

@@ -21,7 +21,7 @@ var test = require('tap').test;
// --- Globals

var writeTestOpts = {
skip: !h.CONFIG.allowWriteActions
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};



+ 4
- 2
test/integration/cli-affinity.test.js View File

@@ -30,10 +30,12 @@ var h = require('./helpers');
var ALIAS_PREFIX = format('nodetritontest-affinity-%s', os.hostname());

var testOpts = {
skip: !h.CONFIG.allowWriteActions || h.CONFIG.skipAffinityTests
skip: (
(!h.CONFIG.allowWriteActions || h.CONFIG.skipAffinityTests) &&
'requires config.allowWriteActions and config.skipAffinityTests=false'
)
};


// --- Tests

test('affinity (triton create -a RULE ...)', testOpts, function (suite) {

+ 3
- 8
test/integration/cli-deletion-protection.test.js View File

@@ -22,8 +22,8 @@ var test = require('tap').test;

var INST_ALIAS = f('nodetritontest-deletion-protection-%s', os.hostname());
var INST;
var OPTS = {
skip: !h.CONFIG.allowWriteActions
var testOpts = {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};

// --- Helpers
@@ -44,12 +44,7 @@ function cleanup(t) {

// --- Tests

if (OPTS.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton instance', OPTS, function (suite) {
test('triton instance', testOpts, function (suite) {
h.printConfig(suite);

suite.test(' cleanup existing inst with alias ' + INST_ALIAS, cleanup);

+ 3
- 8
test/integration/cli-fwrules.test.js View File

@@ -25,18 +25,13 @@ var RULE2 = 'FROM any TO vm $id BLOCK tcp port 25';
var INST;
var ID;
var INST_ALIAS = f('nodetritontest-fwrules-%s', os.hostname());
var OPTS = {
skip: !h.CONFIG.allowWriteActions
var testOpts = {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};

// --- Tests

if (OPTS.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton fwrule', OPTS, function (suite) {
test('triton fwrule', testOpts, function (suite) {
h.printConfig(suite);

suite.test(' cleanup existing inst with alias ' + INST_ALIAS,

+ 2
- 1
test/integration/cli-image-create-kvm.test.js View File

@@ -33,7 +33,8 @@ var DERIVED_INST_ALIAS = _RESOURCE_NAME_PREFIX + '-derived';
delete _RESOURCE_NAME_PREFIX;

var testOpts = {
skip: !h.CONFIG.allowWriteActions || h.CONFIG.skipKvmTests
skip: (!h.CONFIG.allowWriteActions || h.CONFIG.skipKvmTests) &&
'requires config.allowWriteActions and config.skipKvmTests=false'
};



+ 1
- 1
test/integration/cli-image-create.test.js View File

@@ -32,7 +32,7 @@ var IMAGE_DATA = {
var DERIVED_ALIAS = format('nodetritontest-images-%s-derived', os.hostname());

var testOpts = {
skip: !h.CONFIG.allowWriteActions
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};



+ 3
- 8
test/integration/cli-instance-tag.test.js View File

@@ -26,19 +26,14 @@ var h = require('./helpers');
// --- globals

var INST_ALIAS = f('nodetritontest-insttag-%s', os.hostname());

var opts = {
skip: !h.CONFIG.allowWriteActions
var testOpts = {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};


// --- Tests

if (opts.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}
test('triton inst tag ...', opts, function (suite) {
test('triton inst tag ...', testOpts, function (suite) {
h.printConfig(suite);

var inst;

+ 3
- 7
test/integration/cli-manage-workflow.test.js View File

@@ -26,8 +26,8 @@ var h = require('./helpers');
var INST_ALIAS = f('nodetritontest-managewf-%s', os.hostname());
var INST_ALIAS_NEWNAME = INST_ALIAS + '-renamed';

var opts = {
skip: !h.CONFIG.allowWriteActions
var testOpts = {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};

// global variable to hold vm instance JSON
@@ -36,11 +36,7 @@ var instance;

// --- Tests

if (opts.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}
test('triton manage workflow', opts, function (suite) {
test('triton manage workflow', testOpts, function (suite) {
h.printConfig(suite);

suite.test(' cleanup existing inst with alias ' + INST_ALIAS,

+ 12
- 12
test/integration/cli-networks.test.js View File

@@ -27,18 +27,9 @@ var NET_NAME = f('nodetritontest-network-%s', os.hostname());
var networks;
var vlan;

var OPTS = {
skip: !h.CONFIG.allowWriteActions
};


// --- Tests

if (OPTS.skip) {
console.error('** skipping some %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton networks', function (suite) {

suite.test(' setup: find a test VLAN', function (t) {
@@ -238,7 +229,9 @@ test('triton network get', function (suite) {
});


test('triton network create', OPTS, function (suite) {
test('triton network create', {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
}, function (suite) {

suite.test(' cleanup: rm network ' + NET_NAME + ' if exists',
function (t) {
@@ -273,7 +266,9 @@ test('triton network create', OPTS, function (suite) {
});
});

suite.test(' triton network create VLAN', function (t) {
suite.test(' triton network create VLAN', {
skip: !process.env.TEST_KNOWN_FAIL && 'known failure, see TRITON-1389'
}, function (t) {
h.triton('network create --name=' + NET_NAME +
' --subnet=192.168.97.0/24 --start_ip=192.168.97.1' +
' --end_ip=192.168.97.254 -j ' + vlan.vlan_id,
@@ -300,7 +295,12 @@ test('triton network create', OPTS, function (suite) {
});


test('triton network delete', OPTS, function (suite) {
test('triton network delete', {
skip: (
(!process.env.TEST_KNOWN_FAIL && 'known failure, see TRITON-1389') ||
(!h.CONFIG.allowWriteActions && 'requires config.allowWriteActions')
)
}, function (suite) {

suite.test(' triton network delete -h', function (t) {
h.triton('network delete -h', function (err, stdout, stderr) {

+ 6
- 8
test/integration/cli-nics.test.js View File

@@ -25,19 +25,17 @@ var INST;
var NIC;
var NIC2;

var OPTS = {
skip: !h.CONFIG.allowWriteActions
var testOpts = {
skip: (
(!process.env.TEST_KNOWN_FAIL && 'known failure, see TRITON-1398') ||
(!h.CONFIG.allowWriteActions && 'requires config.allowVolumesTests')
)
};


// --- Tests

if (OPTS.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton instance nics', OPTS, function (suite) {
test('triton instance nics', testOpts, function (suite) {
h.printConfig(suite);

suite.test(' cleanup existing inst with alias ' + INST_ALIAS,

+ 3
- 8
test/integration/cli-profiles.test.js View File

@@ -21,18 +21,13 @@ var test = require('tap').test;
var PROFILE_FILE = path.join(__dirname, 'test-profile.json');
var PROFILE_DATA = JSON.parse(fs.readFileSync(PROFILE_FILE, 'utf8'));

var opts = {
skip: !h.CONFIG.allowWriteActions
var testOpts = {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};


// --- Tests

if (opts.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton profiles (read only)', function (suite) {
suite.test(' triton profile get env', function (t) {
h.safeTriton(t, {json: true, args: ['profile', 'get', '-j', 'env']},
@@ -52,7 +47,7 @@ test('triton profiles (read only)', function (suite) {
suite.end();
});

test('triton profiles (read/write)', opts, function (suite) {
test('triton profiles (read/write)', testOpts, function (suite) {
suite.test(' triton profile create', function (t) {
/*
* We need to skip the Docker setup with '--no-docker' because we are

+ 7
- 8
test/integration/cli-snapshots.test.js View File

@@ -22,18 +22,17 @@ var test = require('tap').test;
var SNAP_NAME = 'test-snapshot';
var INST_ALIAS = f('nodetritontest-snapshots-%s', os.hostname());
var INST;
var OPTS = {
skip: !h.CONFIG.allowWriteActions

var testOpts = {
skip: (
(!process.env.TEST_KNOWN_FAIL && 'known failure, see TRITON-1387') ||
(!h.CONFIG.allowWriteActions && 'requires config.allowWriteActions')
)
};

// --- Tests

if (OPTS.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton instance snapshot', OPTS, function (suite) {
test('triton instance snapshot', testOpts, function (suite) {
h.printConfig(suite);

suite.test(' cleanup existing inst with alias ' + INST_ALIAS,

+ 4
- 9
test/integration/cli-vlans.test.js View File

@@ -27,18 +27,13 @@ var VLAN_ID = 3197;

var VLAN;

var OPTS = {
skip: !h.CONFIG.allowWriteActions
var writeTestOpts = {
skip: !h.CONFIG.allowWriteActions && 'requires config.allowWriteActions'
};


// --- Tests

if (OPTS.skip) {
console.error('** skipping some %s tests', __filename);
console.error('** set "allowWriteActions" in test config to enable');
}

test('triton vlan list', function (suite) {

suite.test(' triton vlan list -h', function (t) {
@@ -281,7 +276,7 @@ test('triton vlan networks', function (suite) {
});


test('triton vlan create', OPTS, function (suite) {
test('triton vlan create', writeTestOpts, function (suite) {

suite.test(' cleanup: rm vlan ' + VLAN_NAME + ' if exists', function (t) {
h.triton('vlan delete ' + VLAN_NAME, function onTriton(err, stdout) {
@@ -348,7 +343,7 @@ test('triton vlan create', OPTS, function (suite) {
});


test('triton vlan delete', OPTS, function (suite) {
test('triton vlan delete', writeTestOpts, function (suite) {

suite.test(' triton vlan delete -h', function (t) {
h.triton('vlan delete -h', function onTriton(err, stdout, stderr) {

+ 4
- 6
test/integration/cli-volumes-size.test.js View File

@@ -25,13 +25,11 @@ var FABRIC_NETWORKS = [];
var MIBS_IN_GIB = 1024;

var testOpts = {
skip: !(h.CONFIG.allowWriteActions && h.CONFIG.allowVolumesTests)
skip: (
!(h.CONFIG.allowWriteActions && h.CONFIG.allowVolumesTests) &&
'requires config.allowWriteActions and config.allowVolumesTests'
)
};
if (testOpts.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" and "allowVolumesTests" '
+ 'in test config to enable');
}

test('triton volume create with non-default size...', testOpts,
function (suite) {

+ 6
- 8
test/integration/cli-volumes.test.js View File

@@ -20,16 +20,14 @@ var vasync = require('vasync');
var common = require('../../lib/common');
var h = require('./helpers');

var FABRIC_NETWORKS = [];

var testOpts = {
skip: !(h.CONFIG.allowWriteActions && h.CONFIG.allowVolumesTests)
skip: (
!(h.CONFIG.allowWriteActions && h.CONFIG.allowVolumesTests) &&
'requires config.allowWriteActions and config.allowVolumesTests'
)
};
if (testOpts.skip) {
console.error('** skipping %s tests', __filename);
console.error('** set "allowWriteActions" and "allowVolumesTests" '
+ 'in test config to enable');
}
var FABRIC_NETWORKS = [];


test('triton volume create ...', testOpts, function (suite) {
var currentVolume;

Loading…
Cancel
Save