Switched from downloading zips to downloading tarballs, as the unzip module was randomly sucking.

This commit is contained in:
Spencer Alger
2013-10-23 21:52:31 -07:00
parent 63d0d04796
commit e231876702
20 changed files with 230 additions and 138 deletions

View File

@ -1,2 +0,0 @@
require('./yaml-suite');
require('./network-failures');

View File

@ -20,8 +20,7 @@ var argv = require('optimist')
Error.stackTraceLimit = Infinity;
// Where do the tests live?
var TEST_DIR = path.resolve(__dirname, '../../../es_api_spec/test/');
var testDir = path.resolve(__dirname, './tests');
var doPattern = new Minimatch(argv.match);
@ -84,7 +83,7 @@ before(function (done) {
} else {
done();
}
})
});
}
});
@ -105,27 +104,6 @@ before(function () {
before(clearIndices);
/**
* recursively crawl the directory, looking for yaml files which will be passed to loadFile
* @param {String} dir - The directory to crawl
* @return {undefined}
*/
function loadDir(dir) {
fs.readdirSync(dir).forEach(function (fileName) {
describe(fileName, function () {
var location = path.join(dir, fileName),
stat = fs.statSync(location);
if (stat.isFile() && fileName.match(/\.yaml$/) && doPattern.match(path.relative(TEST_DIR, location))) {
loadFile(location);
}
else if (stat.isDirectory()) {
loadDir(location);
}
});
});
}
/**
* The version that ES is running, in comparable string form XXX-XXX-XXX, fetched when needed
* @type {String}
@ -206,24 +184,6 @@ function rangeMatchesCurrentVersion(rangeString, done) {
}
}
/**
* read the file's contents, parse the yaml, pass to makeTestFromYamlDoc
*
* @param {String} path - Full path to yaml file
* @return {undefined}
*/
function loadFile(location) {
jsYaml.loadAll(
fs.readFileSync(location, { encoding: 'utf8' }),
function (doc) {
makeTestFromYamlDoc(doc);
},
{
filename: location
}
);
}
/**
* Read the test descriptions from a yaml document (usually only one test, per doc but
* sometimes multiple docs per file, and because of the layout there COULD be
@ -589,4 +549,46 @@ ActionRunner.prototype = {
}
};
loadDir(TEST_DIR);
/**
* recursively crawl the directory, looking for yaml files which will be passed to loadFile
* @param {String} dir - The directory to crawl
* @return {undefined}
*/
(function () {
/**
* read the file's contents, parse the yaml, pass to makeTestFromYamlDoc
*
* @param {String} path - Full path to yaml file
* @return {undefined}
*/
function loadFile(location) {
jsYaml.loadAll(
fs.readFileSync(location, { encoding: 'utf8' }),
function (doc) {
makeTestFromYamlDoc(doc);
},
{
filename: location
}
);
}
function loadDir(dir) {
fs.readdirSync(dir).forEach(function (fileName) {
describe(fileName, function () {
var location = path.join(dir, fileName),
stat = fs.statSync(location);
if (stat.isFile() && fileName.match(/\.yaml$/) && doPattern.match(path.relative(testDir, location))) {
loadFile(location);
}
else if (stat.isDirectory()) {
loadDir(location);
}
});
});
}
loadDir(testDir);
})();

View File

@ -42,7 +42,7 @@ exports.start = function (params, cb) {
if (line.match(/started\s*$/m)) {
console.log('Personal ES Server started at', server.__hostname + ':' + server.__port);
server.stdout.removeListener('data', onProcessData);
server.stdout.on('data', _.noop);
server.stdout.resume();
cb(null, server);
}
});