Flaky tests fail 1 in 5 runs and developers just click "re-run". How do you fix this culture and the tests?
BeginnerScenarioPipelines at scale
Answer
Situation read → Flaky tests train people to ignore red builds, and then real failures get ignored too.
What I'd do →
- Measure: track per-test pass/fail across runs to find the actual flaky ones (most CI tools or test reporters can do this).
- Quarantine: move known-flaky tests to a non-blocking job with an owner and a ticket, so main stays meaningful.
- Fix the common causes: shared state between tests, timing (
sleepinstead of waiting for a condition), test order dependence, real network calls, unseeded random data. - Set a rule: quarantined tests must be fixed or deleted within two weeks.
- Publish a weekly flakiness report so it stays visible.
Why → A trustworthy red build is worth more than a large but unreliable test suite.
Interview tip → "Quarantine with an owner and a deadline" is the practical answer interviewers expect.
More on Pipelines at scale
The CI pipeline takes 45 minutes. Developers want it under 10. How do you approach it?IntermediateYou have a monorepo with 40 services. Every commit builds and tests all of them. How do you fix that?AdvancedYour self-hosted GitHub runners can't keep up at peak and sit idle at night. How do you run them at scale?AdvancedDocker builds in CI take 12 minutes because every runner starts with an empty cache. How do you speed them up?IntermediateHow do you secure the software supply chain from commit to production?AdvancedFifty teams have copy-pasted pipelines that have drifted apart. How do you standardise them?Intermediate