Bazel returns a special
FLAKY status when a test has a mix of fail and pass.Managing flaky tests
There are two reasonable approaches for continuous integration:- Use
--flaky_test_attempts=[number]
- Tag tests as
flaky = True
We recommend giving the BuildCop a one-click way to mark a test as flaky (or remove it)
by making a bot commit to the repository that uses Buildozer to edit the BUILD file.
Aspect plans to build a GitHub bot which does exactly this.
Determining if flakiness is fixed
When fixing a flaky test, it can be hard to know whether a flaky test has been fully resolved. A few passing runs in a row do not guarantee reliability, since the test may pass or fail unpredictably. To ensure a flaky test has been fixed, run it multiple times locally using--runs_per_test=[number]. This helps confirm that the test consistently passes.
