wiremock-rs
wiremock-rs copied to clipboard
Simulate fault
It would be very useful to be able simulate faults to test how the program reacts to them.
What kind of faults?
Sorry for the lack of details. I meant to come back and fill the details.
The base and most useful case is simulating a network failure/disconnect (usually an EOF) mid transmission. That happens often to regular users so it interesting to test. This can also be used to simulate an offline mode.
It would also be nice to be able to control the frames that sent (like in chunked encoding) to introduce delays between chunks and also failures after a number of chunks.
See the Java implementation: https://wiremock.org/docs/simulating-faults/#bad-responses
One array that would be very interesting for us are things that translate to io::Errors in reqwest, such as io::ErrorKind::ConnectionReset, io::ErrorKind::UnexpectedEof and io::ErrorKind::BrokenPipe. Users reported seeing these errors (especially in GitHub Actions there are a lot of connectivity problems) and we'd like to simulate these error to ensure we're retrying correctly when encountering them. These are errors without an HTTP status code, so we're looking for a way to simulate lower-level errors in response templates.
Yep that is exactly my thought @konstin, I would like to try our logic for cloud connectivity and ensure that the code reacts correctly when the network is unstable.
One array that would be very interesting for us are things that translate to
io::Errors in reqwest, such asio::ErrorKind::ConnectionReset, io::ErrorKind::UnexpectedEofandio::ErrorKind::BrokenPipe`. Users reported seeing these errors (especially in GitHub Actions there are a lot of connectivity problems) and we'd like to simulate these error to ensure we're retrying correctly when encountering them. These are errors without an HTTP status code, so we're looking for a way to simulate lower-level errors in response templates.
That sounds like a good enough characterization and I'd be happy to support it.