mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-10 17:59:16 +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();
|
||||
}
|
||||
);
|
||||
|
||||
after(function() {
|
||||
Distributor.prototype._createNode.restore();
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -2,30 +2,19 @@
|
||||
|
||||
var expect = require('expect.js'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
createExecutor = require('../lib/executor').createExecutor,
|
||||
SpawnCommand = require('../lib/command/spawn').Command,
|
||||
_ = require('underscore'),
|
||||
mercurialRevs = _(require('./helpers').mercurialRevs).clone();
|
||||
helpers = require('./helpers'),
|
||||
mercurialRevs = helpers.mercurialRevs;
|
||||
|
||||
|
||||
['local'].forEach(function(type) {
|
||||
describe(type + ' executor', function() {
|
||||
var workspacePath = path.join(__dirname, 'workspace');
|
||||
|
||||
var removeDir = function (dir, callback) {
|
||||
new SpawnCommand().run({cmd: 'rm', args: ['-R', dir]}, callback);
|
||||
}
|
||||
|
||||
var clearWorkspace = function (done) {
|
||||
if (fs.exists(workspacePath, function(isExists) {
|
||||
if (isExists) {
|
||||
removeDir(workspacePath, done);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}));
|
||||
}
|
||||
var clearWorkspace = function(done) {
|
||||
helpers.removeDirIfExists(workspacePath, done);
|
||||
};
|
||||
|
||||
var makeExecutorParams = function(params) {
|
||||
params = params || {};
|
||||
|
@ -1,5 +1,24 @@
|
||||
'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
|
||||
exports.mercurialRevs = [{
|
||||
|
Loading…
Reference in New Issue
Block a user