У меня есть набор тестов на основе Java, на котором работает Bazel 4.2.2, и моя цель — собрать покрытие кода независимо от ненадежности теста. Я попытался добавить эти параметры:
bazel coverage ... --runs_per_test=3 --cache_test_results=no ...
но похоже, что если 1/3 из них терпит неудачу, то тест провален, и данные о покрытии не собираются для неудачных тестов.
Есть ли в Bazel какие-либо флаги, чтобы принять первый пройденный результат и повторить попытку только при сбоях?
Полная команда, которую я пробовал,
bazel coverage --jobs=6 --runs_per_test=3 --cache_test_results=no --combined_report=lcov --coverage_report_generator = "@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main" -- //$TARGET/... 2>&1
Спасибо!





Ответ на мой вопрос (пока не могу принять): в документации, которую я нашел, есть вариант https://docs.bazel.build/versions/0.25.0/command-line-reference.html
--flaky_test_attempts=<a positive integer, the string "default", or test_regex@attempts. This flag may be passed more than once> multiple uses are accumulated
Each test will be retried up to the specified number of times in case of any test failure. Tests that required more than one attempt to pass would be marked as 'FLAKY' in the test summary. If this option is set, it should specify an int N or the string 'default'. If it's an int, then all tests will be run up to N times. If it is not specified or its value is ' default', then only a single test attempt will be made for regular tests and three for tests marked explicitly as flaky by their rule (flaky=1 attribute).
Другой вариант — использовать шелушащийся атрибут в правилах тестирования для проблемных тестов. Это запустит их до 3 раз даже с обычным bazel test, без каких-либо флагов.