Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('makes es.RequestTimeout a SavedObjectsClient/EsUnavailable error', () => {
const error = new esErrors.RequestTimeout();
expect(isEsUnavailableError(error)).to.be(false);
expect(decorateEsError(error)).to.be(error);
expect(isEsUnavailableError(error)).to.be(true);
});
it('handles RequestTimeout', () => {
const err = new errors.RequestTimeout();
expect(isKnownError(err)).to.be(true);
const wrappedErr = handleKnownError(err);
expect(wrappedErr.message).to.be(
'Request Timeout: ' +
'Check the Elasticsearch Monitoring cluster network connection or the load level of the nodes.');
expect(wrappedErr.isBoom).to.be(true);
expect(wrappedErr.isServer).to.be(true);
expect(wrappedErr.data).to.be(null);
expect(wrappedErr.output).to.eql({
statusCode: 503,
payload: {
statusCode: 503,
error: 'Service Unavailable',
message: 'Request Timeout: Check the Elasticsearch Monitoring cluster network connection or the load level of the nodes.'
},
it('should return a boom 503 server timeout error for ES connection errors', function () {
expect(handleESError(new esErrors.ConnectionFault()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.ServiceUnavailable()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.NoConnections()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.RequestTimeout()).output.statusCode).to.be(503);
});
it('should return a boom 503 server timeout error for ES connection errors', function () {
expect(handleESError(new esErrors.ConnectionFault()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.ServiceUnavailable()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.NoConnections()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.RequestTimeout()).output.statusCode).to.be(503);
});
it('should return a boom 503 server timeout error for ES connection errors', function () {
expect(handleESError(new esErrors.ConnectionFault()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.ServiceUnavailable()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.NoConnections()).output.statusCode).to.be(503);
expect(handleESError(new esErrors.RequestTimeout()).output.statusCode).to.be(503);
});