From e4e1e66b520ef6b4a1f393d4cb2b8b438da0ccea Mon Sep 17 00:00:00 2001 From: LeeDr Date: Thu, 12 Nov 2015 12:05:22 -0600 Subject: [PATCH] Catch and ignore index_not_found_exception when deleting kibana index if not found. --- test/fixtures/scenarioManager.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/fixtures/scenarioManager.js b/test/fixtures/scenarioManager.js index 60c2afc4e828..84376c0f70ca 100644 --- a/test/fixtures/scenarioManager.js +++ b/test/fixtures/scenarioManager.js @@ -62,6 +62,13 @@ ScenarioManager.prototype.unload = function (id) { return this.client.indices.delete({ index: indices + }) + .catch(function (reason) { + // if the index never existed yet, or was already deleted it's OK + if (reason.message.indexOf('index_not_found_exception') < 0) { + console.log('reason.message: ' + reason.message); + throw reason; + } }); }; @@ -110,11 +117,11 @@ ScenarioManager.prototype.loadIfEmpty = function (id) { if (response.count === 0) { return self.load(id); } - }) + }); })) .catch(function (reason) { return self.load(id); }); }; -module.exports = ScenarioManager; \ No newline at end of file +module.exports = ScenarioManager;