moto icon indicating copy to clipboard operation
moto copied to clipboard

Feature: Mocking firehose failing behavior

Open zeeshanabid94 opened this issue 6 years ago • 2 comments

I have a use case of this sort. I have a function with this signature.

write_to_firehose(data, firehose_name, num_retries)

Inside the function, I use a firehose client that is a global variable. I want to simulate the behavior of firehose failing for num_retries time so that I can check if an exception is raised. Idk if I read the docs right, may be there is already a way to do this. Any guidance would help. If this has not been implemented, then I can look into implementing it.

zeeshanabid94 avatar Oct 11 '18 23:10 zeeshanabid94

We don't currently have a way to do this; open to ideas.

spulec avatar Oct 15 '18 05:10 spulec

All right, so my use case was the following: I had a serverless function running on AWS Lambda reading from a stream and pushing to Firehose. PutRecordBatch on firehose is an unreliable call that can Fail completely or Fail partially. I had a retry mechanism in place that I needed to test through unittests. Hence, I had to create successful and failed responses and mock PutRecordBatch method on an empty object

So I figured out: 1- Moto does not have AWS Firehose methods implemented yet. 2- There is no explanation about mocking / simulating failing behavior of API methods.

Proposition:

  • Allow tester to specify the response behavior of API methods on different clients.

Idk if this is a good idea, but let me know what you guys think. It is always great to have conversation with fellow engineers.

zeeshanabid94 avatar Oct 18 '18 21:10 zeeshanabid94