Search⌘ K
AI Features

Modeling the Circuit Breaker: The Shim Module

Explore how to model a circuit breaker using a shim module within stateful property-based testing in Elixir. Understand handling of success, errors, timeouts, and manual operations while managing timing complexities. This lesson guides you through setting up dependencies and designing commands to test realistic circuit breaker scenarios effectively.

Getting started

For stateful properties, we’d initially began 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
...