Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 8bffe9524daacf84815d4dc7777b1cbd58d13718)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -838,7 +838,6 @@ Try {
|
| 838 | 838 |
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME" |
| 839 | 839 |
} |
| 840 | 840 |
$c += "`"-tags`" " + "`"autogen`" " |
| 841 |
- $c += "`"-timeout`" " + "`"10m`" " |
|
| 842 | 841 |
$c += "`"-test.timeout`" " + "`"200m`" " |
| 843 | 842 |
|
| 844 | 843 |
if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
|
| ... | ... |
@@ -933,7 +932,6 @@ Try {
|
| 933 | 933 |
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME" |
| 934 | 934 |
} |
| 935 | 935 |
$c += "`"-tags`" " + "`"autogen`" " |
| 936 |
- $c += "`"-timeout`" " + "`"10m`" " |
|
| 937 | 936 |
$c += "`"-test.timeout`" " + "`"200m`" " |
| 938 | 937 |
|
| 939 | 938 |
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:" |
| ... | ... |
@@ -23,9 +23,10 @@ setup_integration_test_filter() {
|
| 23 | 23 |
fi |
| 24 | 24 |
TESTFLAGS+="-test.run ${TEST_FILTER}"
|
| 25 | 25 |
|
| 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)
|
|
| 27 | 28 |
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$')}"
|
|
| 29 | 30 |
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
|
| 30 | 31 |
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
|
| 31 | 32 |
TEST_SKIP_INTEGRATION=1 |
| ... | ... |
@@ -85,7 +86,7 @@ run_test_integration_suites() {
|
| 85 | 85 |
|
| 86 | 86 |
run_test_integration_legacy_suites() {
|
| 87 | 87 |
( |
| 88 |
- flags="-test.v -timeout=${TIMEOUT} $TESTFLAGS"
|
|
| 88 |
+ flags="-test.v -test.timeout=360m $TESTFLAGS" |
|
| 89 | 89 |
cd integration-cli |
| 90 | 90 |
echo "Running $PWD flags=${flags}"
|
| 91 | 91 |
# shellcheck disable=SC2086 |
| ... | ... |
@@ -35,7 +35,7 @@ run_test_integration_suites() {
|
| 35 | 35 |
|
| 36 | 36 |
run_test_integration_legacy_suites() {
|
| 37 | 37 |
( |
| 38 |
- flags="-test.v -timeout=${TIMEOUT:-10m} -test.timeout=360m $TESTFLAGS"
|
|
| 38 |
+ flags="-test.v -test.timeout=360m $TESTFLAGS" |
|
| 39 | 39 |
cd /tests/integration-cli |
| 40 | 40 |
echo "Running $PWD" |
| 41 | 41 |
test_env ./test.main $flags |
| ... | ... |
@@ -4,16 +4,14 @@ package suite |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 | 6 |
"flag" |
| 7 |
- "fmt" |
|
| 8 | 7 |
"reflect" |
| 9 | 8 |
"runtime/debug" |
| 10 | 9 |
"strings" |
| 11 | 10 |
"testing" |
| 12 |
- "time" |
|
| 13 | 11 |
) |
| 14 | 12 |
|
| 15 | 13 |
// 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")
|
|
| 17 | 15 |
|
| 18 | 16 |
var typTestingT = reflect.TypeOf(new(testing.T)) |
| 19 | 17 |
|
| ... | ... |
@@ -53,32 +51,7 @@ func Run(t *testing.T, suite interface{}) {
|
| 53 | 53 |
} |
| 54 | 54 |
}() |
| 55 | 55 |
|
| 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 |
- } |
|
| 56 |
+ method.Func.Call([]reflect.Value{reflect.ValueOf(suite), reflect.ValueOf(t)})
|
|
| 82 | 57 |
}) |
| 83 | 58 |
} |
| 84 | 59 |
} |