chore: set extended timeout only for `protocol` package

It mitigates #4585 until the root cause is fixed.
This commit is contained in:
Patryk Osmaczko 2024-01-24 14:25:58 +01:00 committed by osmaczko
parent 7c9977b780
commit e29332a374
2 changed files with 20 additions and 2 deletions

View File

@ -323,6 +323,7 @@ test-unit: export UNIT_TEST_PACKAGES ?= $(shell go list ./... | \
grep -v /t/benchmarks | \
grep -v /transactions/fake | \
grep -E -v '/wakuv2(/.*|$$)')
test-unit: export UNIT_TEST_PACKAGES_WITH_EXTENDED_TIMEOUT ?= github.com/status-im/status-go/protocol
test-unit: ##@tests Run unit and integration tests
./_assets/scripts/run_unit_tests.sh

View File

@ -13,7 +13,8 @@ if [[ -z "${UNIT_TEST_COUNT}" ]]; then
UNIT_TEST_COUNT=1
fi
UNIT_TEST_PACKAGE_TIMEOUT="$((UNIT_TEST_COUNT * 30))m"
UNIT_TEST_PACKAGE_TIMEOUT="$((UNIT_TEST_COUNT * 2))m"
UNIT_TEST_PACKAGE_TIMEOUT_EXTENDED="$((UNIT_TEST_COUNT * 30))m"
redirect_stdout() {
output_file=$1
@ -26,6 +27,16 @@ redirect_stdout() {
fi
}
has_extended_timeout() {
local package
for package in ${UNIT_TEST_PACKAGES_WITH_EXTENDED_TIMEOUT}; do
if [[ "$1" == "${package}" ]]; then
return 0
fi
done
return 1
}
last_failing_exit_code=0
for package in ${UNIT_TEST_PACKAGES}; do
@ -33,8 +44,14 @@ for package in ${UNIT_TEST_PACKAGES}; do
package_dir=$(go list -f "{{.Dir}}" "${package}")
output_file=${package_dir}/test.log
if has_extended_timeout "${package}"; then
package_timeout="${UNIT_TEST_PACKAGE_TIMEOUT_EXTENDED}"
else
package_timeout="${UNIT_TEST_PACKAGE_TIMEOUT}"
fi
go test "${package}" -v ${GOTEST_EXTRAFLAGS} \
-timeout "${UNIT_TEST_PACKAGE_TIMEOUT}" \
-timeout "${package_timeout}" \
-count "${UNIT_TEST_COUNT}" \
-tags "${BUILD_TAGS}" | \
redirect_stdout "${output_file}"