Modeling the Circuit Breaker: The Shim Module
Set up the shim module of the circuit breaker and understand its usage and the way it is set up.
We'll cover the following
Getting started
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 possible calls that can take place.
Since we’re testing the circuit breaker itself, we’ll want to cover these situations:
- 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 un-trip the circuit breaker.
Adding the dependencies
Let’s take a look at how to add the circuit_breaker
dependency.
Our rebar.config
file will include the dependencies for the libraries we need. It would look like this:
Get hands-on with 1400+ tech skills courses.