mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
remove per-test -timeout logic because it does not work
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
beadc92e07
commit
8bffe9524d
4 changed files with 7 additions and 35 deletions
|
@ -804,7 +804,6 @@ Try {
|
|||
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME"
|
||||
}
|
||||
$c += "`"-tags`" " + "`"autogen`" "
|
||||
$c += "`"-timeout`" " + "`"10m`" "
|
||||
$c += "`"-test.timeout`" " + "`"200m`" "
|
||||
|
||||
if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
|
||||
|
@ -899,7 +898,6 @@ Try {
|
|||
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME"
|
||||
}
|
||||
$c += "`"-tags`" " + "`"autogen`" "
|
||||
$c += "`"-timeout`" " + "`"10m`" "
|
||||
$c += "`"-test.timeout`" " + "`"200m`" "
|
||||
|
||||
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:"
|
||||
|
|
|
@ -23,9 +23,10 @@ setup_integration_test_filter() {
|
|||
fi
|
||||
TESTFLAGS+="-test.run ${TEST_FILTER}"
|
||||
|
||||
local dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
|
||||
local dirs
|
||||
dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
|
||||
if [ -z "${TEST_SKIP_INTEGRATION}" ]; then
|
||||
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')"
|
||||
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')}"
|
||||
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
|
||||
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
|
||||
TEST_SKIP_INTEGRATION=1
|
||||
|
@ -67,7 +68,7 @@ run_test_integration_suites() {
|
|||
|
||||
run_test_integration_legacy_suites() {
|
||||
(
|
||||
flags="-test.v -timeout=${TIMEOUT} $TESTFLAGS"
|
||||
flags="-test.v -test.timeout=360m $TESTFLAGS"
|
||||
cd integration-cli
|
||||
echo "Running $PWD flags=${flags}"
|
||||
# shellcheck disable=SC2086
|
||||
|
|
|
@ -35,7 +35,7 @@ run_test_integration_suites() {
|
|||
|
||||
run_test_integration_legacy_suites() {
|
||||
(
|
||||
flags="-test.v -timeout=${TIMEOUT:-10m} -test.timeout=360m $TESTFLAGS"
|
||||
flags="-test.v -test.timeout=360m $TESTFLAGS"
|
||||
cd /tests/integration-cli
|
||||
echo "Running $PWD"
|
||||
test_env ./test.main $flags
|
||||
|
|
|
@ -4,16 +4,14 @@ package suite
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TimeoutFlag is the flag to set a per-test timeout when running tests. Defaults to `-timeout`.
|
||||
var TimeoutFlag = flag.Duration("timeout", 0, "per-test panic after duration `d` (default 0, timeout disabled)")
|
||||
var TimeoutFlag = flag.Duration("timeout", 0, "DO NOT USE")
|
||||
|
||||
var typTestingT = reflect.TypeOf(new(testing.T))
|
||||
|
||||
|
@ -53,32 +51,7 @@ func Run(t *testing.T, suite interface{}) {
|
|||
}
|
||||
}()
|
||||
|
||||
var timeout <-chan time.Time
|
||||
if *TimeoutFlag > 0 {
|
||||
timeout = time.After(*TimeoutFlag)
|
||||
}
|
||||
panicCh := make(chan error)
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
panicCh <- fmt.Errorf("test panicked: %v\n%s", r, debug.Stack())
|
||||
} else {
|
||||
close(panicCh)
|
||||
}
|
||||
}()
|
||||
method.Func.Call([]reflect.Value{reflect.ValueOf(suite), reflect.ValueOf(t)})
|
||||
}()
|
||||
select {
|
||||
case err := <-panicCh:
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
case <-timeout:
|
||||
if timeoutSuite, ok := suite.(TimeoutTestSuite); ok {
|
||||
timeoutSuite.OnTimeout()
|
||||
}
|
||||
t.Fatalf("timeout: test timed out after %s since start of test", *TimeoutFlag)
|
||||
}
|
||||
method.Func.Call([]reflect.Value{reflect.ValueOf(suite), reflect.ValueOf(t)})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue