vrcmarcos/elasticmock

FR: Simulate Elastic Server Failure

disfluxly opened this issue · 1 comments

A suggested Feature Request:

For APIs that use Elastic on the backend, the clients are often instantiated early on. It would be nice to simulate the instantiation of the client as successful, but subsequent calls receiving server errors from Elastic.

Basic example test:

def test_api_elastic_down(self):
	res = self.client().post('/', json=test_data)

	self.assertEqual(res.status_code, 500)

In the above test, es = Elasticsearch(hosts=es_hosts) would have been instantiated early on, possibly when the app first started.

This would be nice for workflows where, if Elastic is down, the developer wants to send the data to a Queueing system for processing once Elastic is back up.

Done on version 1.4.0. See README for details