Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: pass custom timeout to testrace in CI #87474

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ info --ui_event_filters=-WARNING

build:race --@io_bazel_rules_go//go/config:race "--test_env=GORACE=halt_on_error=1 log_path=stdout" --test_sharding_strategy=disabled
test:test --test_env=TZ=
# Note: these timeout values are used indirectly in `build/teamcity/cockroach/ci/tests/testrace_impl.sh`.
# If those values are updated, the script should be updated accordingly.
test:race --test_timeout=1200,6000,18000,72000

# CI should always run with `--config=ci` or `--config=cinolint`.
Expand Down
30 changes: 19 additions & 11 deletions build/teamcity/cockroach/ci/tests/testrace_impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -xeuo pipefail
# packages are expected to be formatted as go-style, e.g. ./pkg/cmd/bazci.

bazel build //pkg/cmd/bazci --config=ci
size_to_timeout=("small:1200" "medium:6000" "large:18000" "enormous:72000")
for pkg in "$@"
do
# Query to list all affected tests.
Expand All @@ -14,19 +15,26 @@ do
then
pkg="$pkg:all"
fi
tests=$(bazel query "kind(go_test, $pkg)" --output=label)

# Run affected tests.
for test in $tests
for kv in "${size_to_timeout[@]}";
do
if [[ ! -z $(bazel query "attr(tags, \"broken_in_bazel\", $test)") ]]
then
echo "Skipping test $test as it is broken in bazel"
continue
fi
$(bazel info bazel-bin --config=ci)/pkg/cmd/bazci/bazci_/bazci -- test --config=ci --config=race "$test" \
--test_env=COCKROACH_LOGIC_TESTS_SKIP=true \
--test_env=GOMAXPROCS=8
size="${kv%%:*}"
timeout="${kv#*:}"
go_timeout=$(($timeout - 5))
tests=$(bazel query "attr(size, $size, kind("go_test", tests($pkg)))" --output=label)
# Run affected tests.
for test in $tests
do
if [[ ! -z $(bazel query "attr(tags, \"broken_in_bazel\", $test)") ]]
then
echo "Skipping test $test as it is broken in bazel"
continue
fi
$(bazel info bazel-bin --config=ci)/pkg/cmd/bazci/bazci_/bazci -- test --config=ci --config=race "$test" \
--test_env=COCKROACH_LOGIC_TESTS_SKIP=true \
--test_env=GOMAXPROCS=8 \
--test_arg=-test.timeout="${go_timeout}s"
done
done
done