Set intern.js to run status and testSettings suites.

This commit is contained in:
LeeDr 2015-10-20 18:30:54 -05:00 committed by Joe Fleming
parent 05684c6326
commit 1e853f0d15
2 changed files with 31 additions and 1 deletions

View file

@ -82,4 +82,34 @@ ScenarioManager.prototype.deleteAll = function () {
});
};
/**
* Load a testing scenario if not already loaded
* @param {string} id The scenario id to load
* @return {Promise} A promise that is resolved when elasticsearch has a response
*/
ScenarioManager.prototype.loadIfEmpty = function (id) {
var self = this;
var scenario = config[id];
if (!scenario) throw new Error('No scenario found for ' + id);
var self = this;
return Promise.all(scenario.bulk.map(function mapBulk(bulk) {
var loadIndexDefinition;
return self.client.count({
index: bulk.indexName
}, function handleCountResponse(error, response) {
// if (error) {
// console.log('Need to load index. error=' + error);
// } else {
// console.log('index=' + bulk.indexName + ' count=' + response.count);
// }
// if the index is undefined or count ===0 then call the load function above
if (error || response.count === 0) {
self.load(id);
}
});
}));
};
module.exports = ScenarioManager;

View file

@ -15,6 +15,6 @@ define(function (require) {
'test/functional/status.js',
'test/functional/testSettings'
],
excludeInstrumentation: /^(?:tests|fixtures|node_modules)\//
excludeInstrumentation: /(fixtures|node_modules)\//
}, serverConfig);
});