Merge pull request #39535 from michael2012z/fix_timeout_setting
Set TIMEOUT according to architecture.
This commit is contained in:
commit
a9dc697fd2
4 changed files with 37 additions and 22 deletions
|
@ -150,15 +150,6 @@ ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS"
|
|||
|
||||
BUILDFLAGS=( ${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}" )
|
||||
|
||||
# Test timeout.
|
||||
if [ "${DOCKER_ENGINE_GOARCH}" == "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
|
||||
: ${TIMEOUT:=10m}
|
||||
elif [ "${DOCKER_ENGINE_GOARCH}" == "windows" ]; then
|
||||
: ${TIMEOUT:=8m}
|
||||
else
|
||||
: ${TIMEOUT:=5m}
|
||||
fi
|
||||
|
||||
LDFLAGS_STATIC_DOCKER="
|
||||
$LDFLAGS_STATIC
|
||||
-extldflags \"$EXTLDFLAGS_STATIC\"
|
||||
|
|
|
@ -20,6 +20,7 @@ integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
|
|||
grep -vE '(^./integration($|/internal)|/testdata)')"}
|
||||
|
||||
run_test_integration() {
|
||||
set_platform_timeout
|
||||
if [[ "$TESTFLAGS" != *-check.f* ]]; then
|
||||
run_test_integration_suites
|
||||
fi
|
||||
|
@ -108,10 +109,9 @@ test_env() {
|
|||
"$@"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
error_on_leaked_containerd_shims() {
|
||||
if [ "$(go env GOOS)" == 'windows' ]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -124,3 +124,23 @@ error_on_leaked_containerd_shims() {
|
|||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
set_platform_timeout() {
|
||||
# Test timeout.
|
||||
if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then
|
||||
: ${TIMEOUT:=10m}
|
||||
elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then
|
||||
: ${TIMEOUT:=8m}
|
||||
else
|
||||
: ${TIMEOUT:=5m}
|
||||
fi
|
||||
|
||||
if [ "${TEST_REPEAT}" -gt 1 ]; then
|
||||
# TIMEOUT needs to take TEST_REPEAT into account, or a premature time out may happen.
|
||||
# The following ugliness will:
|
||||
# - remove last character (usually 'm' from '10m')
|
||||
# - multiply by testcount
|
||||
# - add last character back
|
||||
TIMEOUT=$((${TIMEOUT::-1} * ${TEST_REPEAT}))${TIMEOUT:$((${#TIMEOUT}-1)):1}
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -20,18 +20,10 @@ echo "Running stress test for them."
|
|||
(
|
||||
TESTARRAY=$(echo "$new_tests" | sed 's/+func //' | awk -F'\\(' '{print $1}' | tr '\n' '|')
|
||||
# Note: TEST_REPEAT will make the test suite run 5 times, restarting the daemon
|
||||
# whereas testcount will make each test run 5 times in a row under the same daemon.
|
||||
# and each test will run 5 times in a row under the same daemon.
|
||||
# This will make a total of 25 runs for each test in TESTARRAY.
|
||||
export TEST_REPEAT=5
|
||||
local testcount=5
|
||||
# However, TIMEOUT needs to take testcount into account, or a premature time out may happen.
|
||||
# The following ugliness will:
|
||||
# - remove last character (usually 'm' from '10m')
|
||||
# - multiply by testcount
|
||||
# - add last character back
|
||||
export TIMEOUT=$((${TIMEOUT::-1} * $testcount))${TIMEOUT:$((${#TIMEOUT}-1)):1}
|
||||
|
||||
export TESTFLAGS="-test.count $testcount -test.run ${TESTARRAY%?}"
|
||||
export TESTFLAGS="-test.count ${TEST_REPEAT} -test.run ${TESTARRAY%?}"
|
||||
echo "Using test flags: $TESTFLAGS"
|
||||
source hack/make/test-integration
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e -u -o pipefail
|
||||
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" == "x86_64" ]; then
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
|
@ -17,6 +17,7 @@ integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
|
|||
grep -vE '(^/tests/integration($|/internal)|/testdata)')"}
|
||||
|
||||
run_test_integration() {
|
||||
set_platform_timeout
|
||||
if [[ "$TESTFLAGS" != *-check.f* ]]; then
|
||||
run_test_integration_suites
|
||||
fi
|
||||
|
@ -72,5 +73,16 @@ test_env() {
|
|||
)
|
||||
}
|
||||
|
||||
set_platform_timeout() {
|
||||
# Test timeout.
|
||||
if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then
|
||||
: ${TIMEOUT:=10m}
|
||||
elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then
|
||||
: ${TIMEOUT:=8m}
|
||||
else
|
||||
: ${TIMEOUT:=5m}
|
||||
fi
|
||||
}
|
||||
|
||||
sh /scripts/ensure-emptyfs.sh
|
||||
run_test_integration
|
||||
|
|
Loading…
Reference in a new issue