Skip to content

Commit da7cecd

Browse files
authored
ci: no retry for flakes in coverage builds (#12752)
1 parent 6ed7976 commit da7cecd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ci/cloudbuild/builds/coverage.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ bazel coverage "${args[@]}" --test_tag_filters=-integration-test ...
5454

5555
GOOGLE_CLOUD_CPP_SPANNER_SLOW_INTEGRATION_TESTS="instance"
5656
mapfile -t integration_args < <(integration::bazel_args)
57+
# With code coverage the `--flaky_test_attempts` flag works in unexpected ways.
58+
# A flake produces an empty `coverage.dat` file, which breaks the build when
59+
# trying to consolidate all the `coverage.dat` files.
60+
#
61+
# This combination of a "successful" test (because the flake is retried) and a
62+
# failure in the consolidation of coverage results, which happens much later
63+
# in the build, easily leads the developer astray.
64+
i=0
65+
for arg in "${integration_args[@]}"; do
66+
case "${arg}" in
67+
--flaky_test_attempts=*)
68+
unset "integration_args[$i]"
69+
;;
70+
esac
71+
i=$((++i))
72+
done
5773
integration::bazel_with_emulators coverage "${args[@]}" "${integration_args[@]}"
5874

5975
# Where does this token come from? For triggered ci/pr builds GCB will securely

0 commit comments

Comments
 (0)