moto
moto copied to clipboard
Feature: Mocking firehose failing behavior
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.
We don't currently have a way to do this; open to ideas.
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 theresponse behavior
ofAPI methods
on differentclients
.
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.