Testing a Failure of One Service Dependency
A controlled dependency failure can verify what the caller returns, which work is retained, and whether other features remain available.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a safe test case
A fake search backend may report temporary unavailability while the article catalogue still reads its stored pages. Verify the distinct response for the failed search and successful read. See slow service versus an empty list.
Check effects and limits
If retries are enabled, count them and verify deadline handling. Ordinary failure injection explains how to isolate the tested condition.[1]
Break one dependency and inspect the aggregate contract
A listing endpoint depends on metadata and stock. If stock fails during a controlled test, the API may expose item descriptions with clearly unavailable stock status or report full failure according to policy. Test that missing stock is not represented as zero. See combining fan-out results.
Metadata service returns item IDs and titles
Stock returns a controlled error
Assert the documented partial or full-failure state
Restore stock and verify recovery
Include a successful observation before and after
This shows the fixture exercises real behavior and that failure state does not persist unexpectedly. Capture status and structured fields. Use test data and the intended service boundary.