mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-14 04:49:17 +00:00
add test helpers for removing dir + small tests fixes
This commit is contained in:
parent
827c3d4888
commit
9af5e9ade4
@ -173,4 +173,9 @@ describe('Distributor blocking with max 2 executors count', function() {
|
|||||||
itRunParallelProjects();
|
itRunParallelProjects();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
after(function() {
|
||||||
|
Distributor.prototype._createNode.restore();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -2,30 +2,19 @@
|
|||||||
|
|
||||||
var expect = require('expect.js'),
|
var expect = require('expect.js'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
fs = require('fs'),
|
|
||||||
createExecutor = require('../lib/executor').createExecutor,
|
createExecutor = require('../lib/executor').createExecutor,
|
||||||
SpawnCommand = require('../lib/command/spawn').Command,
|
|
||||||
_ = require('underscore'),
|
_ = require('underscore'),
|
||||||
mercurialRevs = _(require('./helpers').mercurialRevs).clone();
|
helpers = require('./helpers'),
|
||||||
|
mercurialRevs = helpers.mercurialRevs;
|
||||||
|
|
||||||
|
|
||||||
['local'].forEach(function(type) {
|
['local'].forEach(function(type) {
|
||||||
describe(type + ' executor', function() {
|
describe(type + ' executor', function() {
|
||||||
var workspacePath = path.join(__dirname, 'workspace');
|
var workspacePath = path.join(__dirname, 'workspace');
|
||||||
|
|
||||||
var removeDir = function (dir, callback) {
|
var clearWorkspace = function(done) {
|
||||||
new SpawnCommand().run({cmd: 'rm', args: ['-R', dir]}, callback);
|
helpers.removeDirIfExists(workspacePath, done);
|
||||||
}
|
};
|
||||||
|
|
||||||
var clearWorkspace = function (done) {
|
|
||||||
if (fs.exists(workspacePath, function(isExists) {
|
|
||||||
if (isExists) {
|
|
||||||
removeDir(workspacePath, done);
|
|
||||||
} else {
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
var makeExecutorParams = function(params) {
|
var makeExecutorParams = function(params) {
|
||||||
params = params || {};
|
params = params || {};
|
||||||
|
@ -1,5 +1,24 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var SpawnCommand = require('../lib/command/spawn').Command,
|
||||||
|
fs = require('fs');
|
||||||
|
|
||||||
|
|
||||||
|
exports.removeDir = function(dir, callback) {
|
||||||
|
new SpawnCommand().run({cmd: 'rm', args: ['-R', dir]}, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.removeDirIfExists = function(dir, done) {
|
||||||
|
if (fs.exists(dir, function(isExists) {
|
||||||
|
if (isExists) {
|
||||||
|
exports.removeDir(dir, done);
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// revisions for the test mercurial repo
|
// revisions for the test mercurial repo
|
||||||
exports.mercurialRevs = [{
|
exports.mercurialRevs = [{
|
||||||
|
Loading…
Reference in New Issue
Block a user