mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Changes mkdir to sync in tests. Wrapped exception from request.get
This commit is contained in:
parent
4a021a2496
commit
c0a6572c15
6 changed files with 101 additions and 112 deletions
|
@ -19,14 +19,23 @@ module.exports = function (settings, logger) {
|
|||
|
||||
logger.log('attempting to download ' + sourceUrl);
|
||||
|
||||
return downloadSingle(sourceUrl, settings.workingPath, settings.timeout, logger)
|
||||
return Promise.try(function () {
|
||||
return downloadSingle(sourceUrl, settings.workingPath, settings.timeout, logger)
|
||||
.catch(function (err) {
|
||||
if (err.message === 'ENOTFOUND') {
|
||||
return tryNext();
|
||||
}
|
||||
if (err.message === 'EEXTRACT') {
|
||||
throw (new Error('Error extracting the plugin archive'));
|
||||
}
|
||||
throw (err);
|
||||
});
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err.message === 'ENOTFOUND') {
|
||||
//Special case for when request.get throws an exception
|
||||
if (err.message.match(/invalid uri/i)) {
|
||||
return tryNext();
|
||||
}
|
||||
if (err.message === 'EEXTRACT') {
|
||||
throw (new Error('Error extracting the plugin archive'));
|
||||
}
|
||||
throw (err);
|
||||
});
|
||||
}
|
||||
|
@ -44,22 +53,40 @@ module.exports = function (settings, logger) {
|
|||
requestOptions.timeout = timeout;
|
||||
}
|
||||
|
||||
var req = request.get(requestOptions);
|
||||
var reporter = progressReporter(logger, req);
|
||||
return wrappedRequest(requestOptions)
|
||||
.then(function (req) {
|
||||
//debugger;
|
||||
var reporter = progressReporter(logger, req);
|
||||
|
||||
req
|
||||
.on('response', reporter.handleResponse)
|
||||
.on('data', reporter.handleData)
|
||||
.on('error', _.partial(reporter.handleError, 'ENOTFOUND'))
|
||||
.pipe(gunzip)
|
||||
.on('error', _.partial(reporter.handleError, 'EEXTRACT'))
|
||||
.pipe(tarExtract)
|
||||
.on('error', _.partial(reporter.handleError, 'EEXTRACT'))
|
||||
.on('end', reporter.handleEnd);
|
||||
req
|
||||
.on('response', reporter.handleResponse)
|
||||
.on('data', reporter.handleData)
|
||||
.on('error', _.partial(reporter.handleError, 'ENOTFOUND'))
|
||||
.pipe(gunzip)
|
||||
.on('error', _.partial(reporter.handleError, 'EEXTRACT'))
|
||||
.pipe(tarExtract)
|
||||
.on('error', _.partial(reporter.handleError, 'EEXTRACT'))
|
||||
.on('end', reporter.handleEnd);
|
||||
|
||||
return reporter.deferred;
|
||||
return reporter.promise;
|
||||
});
|
||||
}
|
||||
|
||||
function wrappedRequest(requestOptions) {
|
||||
//debugger;
|
||||
return Promise.try(function () {
|
||||
//debugger;
|
||||
return request.get(requestOptions);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err.message.match(/invalid uri/i)) {
|
||||
throw new Error('ENOTFOUND');
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
download: download,
|
||||
_downloadSingle: downloadSingle
|
||||
|
|
|
@ -61,7 +61,7 @@ module.exports = function (logger, request) {
|
|||
}
|
||||
|
||||
return {
|
||||
deferred: promise,
|
||||
promise: promise,
|
||||
handleResponse: handleResponse,
|
||||
handleError: handleError,
|
||||
handleData: handleData,
|
||||
|
|
|
@ -36,7 +36,7 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
it('should throw an error if there is no package.json file in the archive', function () {
|
||||
fs.mkdir(testWorkingPath, function (e) { });
|
||||
fs.mkdirSync(testWorkingPath);
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return npmInstall(testWorkingPath, logger)
|
||||
|
@ -48,7 +48,7 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
it('should rethrow any errors other than "ENOENT" from fs.statSync', function () {
|
||||
fs.mkdir(testWorkingPath, function (e) {});
|
||||
fs.mkdirSync(testWorkingPath);
|
||||
|
||||
sinon.stub(fs, 'statSync', function () {
|
||||
throw new Error('This is unexpected.');
|
||||
|
|
|
@ -120,6 +120,7 @@ describe('kibana cli', function () {
|
|||
urls: [
|
||||
'http://www.files.com/badfile1.tar.gz',
|
||||
'http://www.files.com/badfile2.tar.gz',
|
||||
'I am a bad uri',
|
||||
'http://www.files.com/goodfile.tar.gz'
|
||||
],
|
||||
workingPath: testWorkingPath,
|
||||
|
@ -146,7 +147,8 @@ describe('kibana cli', function () {
|
|||
|
||||
expect(logger.log.getCall(0).args[0]).to.match(/badfile1.tar.gz/);
|
||||
expect(logger.log.getCall(1).args[0]).to.match(/badfile2.tar.gz/);
|
||||
expect(logger.log.getCall(2).args[0]).to.match(/goodfile.tar.gz/);
|
||||
expect(logger.log.getCall(2).args[0]).to.match(/I am a bad uri/);
|
||||
expect(logger.log.getCall(3).args[0]).to.match(/goodfile.tar.gz/);
|
||||
expect(logger.log.lastCall.args[0]).to.match(/complete/i);
|
||||
|
||||
var files = glob.sync('**/*', { cwd: testWorkingPath });
|
||||
|
@ -243,46 +245,6 @@ describe('kibana cli', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('should throw an error when it tries to use an invalid url.', function () {
|
||||
var settings = {
|
||||
urls: [
|
||||
'http://www.files.com/badfile1.tar.gz',
|
||||
'http://www.files.com/badfile2.tar.gz',
|
||||
'I should break everything',
|
||||
'http://www.files.com/badfile3.tar.gz'
|
||||
],
|
||||
workingPath: testWorkingPath,
|
||||
timeout: 0
|
||||
};
|
||||
downloader = pluginDownloader(settings, logger);
|
||||
|
||||
var couchdb = nock('http://www.files.com')
|
||||
.defaultReplyHeaders({
|
||||
'content-length': '10'
|
||||
})
|
||||
.get('/badfile1.tar.gz')
|
||||
.reply(404)
|
||||
.get('/badfile2.tar.gz')
|
||||
.reply(404)
|
||||
.get('/badfile3.tar.gz')
|
||||
.reply(404);
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return downloader.download(settings, logger)
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
expect(errorStub.lastCall.args[0].message).to.match(/invalid/i);
|
||||
|
||||
for (var i = 0; i < logger.log.callCount; i++) {
|
||||
expect(logger.log.getCall(i).args[0]).to.not.match(/badfile3.tar.gz/);
|
||||
}
|
||||
|
||||
var files = glob.sync('**/*', { cwd: testWorkingPath });
|
||||
expect(files).to.eql([]);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('kibana cli', function () {
|
|||
|
||||
it('should throw an error if the workingPath already exists.', function () {
|
||||
sinon.stub(process, 'exit');
|
||||
fs.mkdir(testWorkingPath, function (e) {});
|
||||
fs.mkdirSync(testWorkingPath);
|
||||
|
||||
var settings = {
|
||||
pluginPath: testWorkingPath
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 400 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -49,7 +49,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 401 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -61,7 +61,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 402 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -73,7 +73,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 403 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -85,7 +85,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 404 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -97,7 +97,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 405 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -109,7 +109,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 406 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -121,7 +121,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 407 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -133,7 +133,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 408 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -145,7 +145,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 409 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -157,7 +157,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 410 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -169,7 +169,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 411 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -181,7 +181,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 412 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -193,7 +193,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 413 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -205,7 +205,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 414 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -217,7 +217,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 415 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -229,7 +229,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 416 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -241,7 +241,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 417 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -253,7 +253,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 500 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -265,7 +265,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 501 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -277,7 +277,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 502 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -289,7 +289,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 503 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -301,7 +301,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 504 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -313,7 +313,7 @@ describe('kibana cli', function () {
|
|||
progress.handleResponse({ statusCode: 505 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -330,7 +330,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -343,7 +343,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -356,7 +356,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -369,7 +369,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -382,7 +382,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -395,7 +395,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -408,7 +408,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -421,7 +421,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -434,7 +434,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -447,7 +447,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -460,7 +460,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -473,7 +473,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -486,7 +486,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -499,7 +499,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -512,7 +512,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -525,7 +525,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -544,7 +544,7 @@ describe('kibana cli', function () {
|
|||
progress.handleData({ length: 100 });
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(progress.hasError()).to.be(true);
|
||||
|
@ -558,7 +558,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(logger.log.callCount).to.be(1);
|
||||
|
@ -572,7 +572,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(logger.log.callCount).to.be(2);
|
||||
|
@ -587,7 +587,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(logger.log.callCount).to.be(22);
|
||||
|
@ -644,7 +644,7 @@ describe('kibana cli', function () {
|
|||
expect(logger.log.callCount).to.be(22);
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -663,7 +663,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.firstCall.args[0].message).to.match(/ENOTFOUND/);
|
||||
|
@ -677,7 +677,7 @@ describe('kibana cli', function () {
|
|||
progress.handleEnd();
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(false);
|
||||
|
@ -693,7 +693,7 @@ describe('kibana cli', function () {
|
|||
progress.handleError('ERRORMESSAGE', new Error('oops!'));
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
@ -706,7 +706,7 @@ describe('kibana cli', function () {
|
|||
progress.handleError('ERRORMESSAGE', new Error('oops!'));
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(progress.hasError()).to.be(true);
|
||||
|
@ -720,7 +720,7 @@ describe('kibana cli', function () {
|
|||
progress.handleError('ERRORMESSAGE', new Error('fourth error!'));
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
return progress.deferred
|
||||
return progress.promise
|
||||
.catch(errorStub)
|
||||
.then(function (data) {
|
||||
expect(errorStub.called).to.be(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue