Testing for Reliability
The SRE testing hierarchy — unit through production — and how each layer targets a different class of reliability failure.
Overview
Testing to build confidence in production
SRE Book Chapter 17 frames testing not as quality assurance but as a confidence-building exercise for production. Traditional QA asks 'does the feature work?'; SRE testing asks 'does the system remain reliable under real production conditions?'
To answer that, tests climb six layers. At the bottom are unit tests that run in milliseconds and number in the thousands. Above them come integration tests that check contracts, system tests on the full stack, and stress tests that find the capacity cliff. Then canaries meet live traffic, and disaster recovery tests sit at the top.
> [!IMPORTANT] 'If you haven't tested your recovery process, you don't have a recovery process.' DR tests, chaos engineering and game days all validate this layer.
Key concepts
- Unit test
- Integration test
- System test
- Stress test
- Canary test
- DR test
Interview questions
- Why can't you rely on unit tests alone to validate service reliability?
- How do you design a stress test for a service whose peak traffic you've never seen?
Sign up free to read the full topic
More SRE topics
Start free on Cariara · Coding problems · System design studio