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"
|
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME"
|
||||||
}
|
}
|
||||||
$c += "`"-tags`" " + "`"autogen`" "
|
$c += "`"-tags`" " + "`"autogen`" "
|
||||||
$c += "`"-timeout`" " + "`"10m`" "
|
|
||||||
$c += "`"-test.timeout`" " + "`"200m`" "
|
$c += "`"-test.timeout`" " + "`"200m`" "
|
||||||
|
|
||||||
if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
|
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"
|
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME"
|
||||||
}
|
}
|
||||||
$c += "`"-tags`" " + "`"autogen`" "
|
$c += "`"-tags`" " + "`"autogen`" "
|
||||||
$c += "`"-timeout`" " + "`"10m`" "
|
|
||||||
$c += "`"-test.timeout`" " + "`"200m`" "
|
$c += "`"-test.timeout`" " + "`"200m`" "
|
||||||
|
|
||||||
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:"
|
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:"
|
||||||
|
|
|
@ -23,9 +23,10 @@ setup_integration_test_filter() {
|
||||||
fi
|
fi
|
||||||
TESTFLAGS+="-test.run ${TEST_FILTER}"
|
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
|
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
|
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
|
||||||
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
|
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
|
||||||
TEST_SKIP_INTEGRATION=1
|
TEST_SKIP_INTEGRATION=1
|
||||||
|
@ -67,7 +68,7 @@ run_test_integration_suites() {
|
||||||
|
|
||||||
run_test_integration_legacy_suites() {
|
run_test_integration_legacy_suites() {
|
||||||
(
|
(
|
||||||
flags="-test.v -timeout=${TIMEOUT} $TESTFLAGS"
|
flags="-test.v -test.timeout=360m $TESTFLAGS"
|
||||||
cd integration-cli
|
cd integration-cli
|
||||||
echo "Running $PWD flags=${flags}"
|
echo "Running $PWD flags=${flags}"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
|
|
@ -35,7 +35,7 @@ run_test_integration_suites() {
|
||||||
|
|
||||||
run_test_integration_legacy_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
|
cd /tests/integration-cli
|
||||||
echo "Running $PWD"
|
echo "Running $PWD"
|
||||||
test_env ./test.main $flags
|
test_env ./test.main $flags
|
||||||
|
|
|
@ -4,16 +4,14 @@ package suite
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TimeoutFlag is the flag to set a per-test timeout when running tests. Defaults to `-timeout`.
|
// 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))
|
var typTestingT = reflect.TypeOf(new(testing.T))
|
||||||
|
|
||||||
|
@ -53,32 +51,7 @@ func Run(t *testing.T, suite interface{}) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var timeout <-chan time.Time
|
method.Func.Call([]reflect.Value{reflect.ValueOf(suite), reflect.ValueOf(t)})
|
||||||
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)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue