Chaos settings - Basics
The idea of the chaos settings is to introduce an element of failure into your environment and observe how clients cope with it.
WireMock Cloud now allows introducing a random element of chaos across all the calls to a particular API. This would allow you to check that your client behaves appropriately; closes resources correctly, times out correctly, conveys sensible error messages to the end user and to your monitoring systems, perhaps opens circuit breakers to take load off the upstream system or other resilience mechanisms.
Enabling Chaos
You enable chaos by toggling the “Enable chaos” switch.
Once chaos is enabled, you can set a percentage of requests to that API to experience a failure using the slider, or type it directly.
The configured percentage of failures will be distributed evenly among the failure modes.
We support five failure modes:
Socket close
A request will just have the socket closed, with no data returned to the client at all. This would allow you to check that your client closes all resources appropriately in response.
Socket reset
The server will close the connection, setting SO_LINGER
to 0 and thus preventing the TIME_WAIT
state being entered. Typically causes a “Connection reset by peer” type error to be thrown by the client.
Note: this only seems to work properly on *nix OSs. On Windows it will most likely cause the connection to hang rather than reset.
This would allow you to check that your client closes all resources appropriately in response.
Invalid HTTP
The server will start by responding with a valid HTTP status line, then will return random bytes, so an invalid HTTP response. Then it will close the connection.
Long delay
The server will delay for the configured amount of time before responding. This would allow you to check that you have appropriately configured timeouts.
HTTP Error status
The server will return valid HTTP responses with the configured error status codes.