Modeling the Circuit Breaker: The Property
Explore how to model and test a circuit breaker using state machine properties in Erlang. Understand the role of generators, state transitions, and preconditions in defining a property-based test model that captures realistic system behavior.
We'll cover the following...
We'll cover the following...
The property
Let’s start by looking at the property.
There will be four generators:
ok/1tripped/1blocked/1,unregistered/1
- This generator is added because manual calls aren’t available until the circuit breaker’s service id is registered, and this occurs automatically on first use. This peculiarity will be encoded in the state machine itself.
Here we’ll begin the circuit breaker process ...