8000 remove per-test -timeout logic because it does not work · thaJeztah/docker@8bffe95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8bffe95

Browse files
author
Tibor Vass
committed
remove per-test -timeout logic because it does not work
Signed-off-by: Tibor Vass <tibor@docker.com>
1 parent beadc92 commit 8bffe95

File tree

4 files changed

+7
-35
lines changed

4 files changed

+7
-35
lines changed

hack/ci/windows.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,6 @@ Try {
804804
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME"
805805
}
806806
$c += "`"-tags`" " + "`"autogen`" "
807-
$c += "`"-timeout`" " + "`"10m`" "
808807
$c += "`"-test.timeout`" " + "`"200m`" "
809808

810809
if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
@@ -899,7 +898,6 @@ Try {
899898
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME"
900899
}
901900
$c += "`"-tags`" " + "`"autogen`" "
902-
$c += "`"-timeout`" " + "`"10m`" "
903901
$c += "`"-test.timeout`" " + "`"200m`" "
904902

905903
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:"

hack/make/.integration-test-helpers

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ setup_integration_test_filter() {
2323
fi
2424
TESTFLAGS+="-test.run ${TEST_FILTER}"
2525

26-
local dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
26+
local dirs
27+
dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
2728
if [ -z "${TEST_SKIP_INTEGRATION}" ]; then
28-
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')"
29+
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')}"
2930
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
3031
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
3132
TEST_SKIP_INTEGRATION=1
@@ -67,7 +68,7 @@ run_test_integration_suites() {
6768

6869
run_test_integration_legacy_suites() {
6970
(
70-
flags="-test.v -timeout=${TIMEOUT} $TESTFLAGS"
71+
flags="-test.v -test.timeout=360m $TESTFLAGS"
7172
cd integration-cli
7273
echo "Running $PWD flags=${flags}"
7374
# shellcheck disable=SC2086

hack/test/e2e-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ run_test_integration_suites() {
3535

3636
run_test_integration_legacy_suites() {
3737
(
38-
flags="-test.v -timeout=${TIMEOUT:-10m} -test.timeout=360m $TESTFLAGS"
38+
flags="-test.v -test.timeout=360m $TESTFLAGS"
3939
cd /tests/integration-cli
4040
echo "Running $PWD"
4141
test_env ./test.main $flags

internal/test/suite/suite.go

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ package suite
44

55
import (
66
"flag"
7-
"fmt"
87
"reflect"
98
"runtime/debug"
109
"strings"
1110
"testing"
12-
"time"
1311
)
1412

1513
// TimeoutFlag is the flag to set a per-test timeout when running tests. Defaults to `-timeout`.
16-
var TimeoutFlag = flag.Duration("timeout", 0, "per-test panic after duration `d` (default 0, timeout disabled)")
14+
var TimeoutFlag = flag.Duration("timeout", 0, "DO NOT USE")
1715

1816
var typTestingT = reflect.TypeOf(new(testing.T))
1917

@@ -53,32 +51,7 @@ func Run(t *testing.T, suite interface{}) {
5351
}
5452
}()
5553

56-
var timeout <-chan time.Time
57-
if *TimeoutFlag > 0 {
58-
timeout = time.After(*TimeoutFlag)
59-
}
60-
panicCh := make(chan error)
61-
go func() {
62-
defer func() {
63-
if r := recover(); r != nil {
64-
panicCh <- fmt.Errorf("test panicked: %v\n%s", r, debug.Stack())
65-
} else {
66-
close(panicCh)
67-
}
68-
}()
69-
method.Func.Call([]reflect.Value{reflect.ValueOf(suite), reflect.ValueOf(t)})
70-
}()
71-
select {
72-
case err := <-panicCh:
73-
if err != nil {
74-
t.Fatal(err.Error())
75-
}
76-
case <-timeout:
77-
if timeoutSuite, ok := suite.(TimeoutTestSuite); ok {
78-
timeoutSuite.OnTimeout()
79-
}
80-
t.Fatalf("timeout: test timed out after %s since start of test", *TimeoutFlag)
81-
}
54+
method.Func.Call([]reflect.Value{reflect.ValueOf(suite), reflect.ValueOf(t)})
8255
})
8356
}
8457
}

0 commit comments

Comments
 (0)
0