Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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('makes es.ConnectionFault a SavedObjectsClient/EsUnavailable error', () => {
const error = new esErrors.ConnectionFault();
expect(isEsUnavailableError(error)).to.be(false);
expect(decorateEsError(error)).to.be(error);
expect(isEsUnavailableError(error)).to.be(true);
});
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('handles ConnectionFault', () => {
const err = new errors.ConnectionFault();
expect(isKnownError(err)).to.be(true);
const wrappedErr = handleKnownError(err);
expect(wrappedErr.message).to.be(
'Connection Failure: ' +
'Check the Elasticsearch Monitoring cluster network connection and refer to the Kibana logs for more information.'
);
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: (