Modeling the Circuit Breaker
For stateful properties, we’d initially started our test suite by defining generators. We then needed to refine them when it came to writing the command generation, and ended up writing a shim module. This time around, we’re going to start directly with the shim module. It’s a good opportunity to revisit all kinds of possibile calls that can take place.
Since we’re testing the circuit breaker itself, we’ll want to cover these:
- Successful calls and their effect on the internal state of the breaker
- Calls ending in errors
- Calls ending in errors that are whitelisted, and therefore seen as successful
- Calls timing out
- Manual operations to trip and untrip the circuit breaker
Our first step is to ensure the libraries we need ...
Get Property-Based Testing with PropEr, Erlang, and Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.