Skip to content

Commit 7cd028f

Browse files
author
Tibor Vass
committed
hack: update scripts
- remove -check.* flags - use (per-test) -timeout flag - allow user to override TEST_SKIP_* regardless of TESTFLAGS - remove test-imports validation Signed-off-by: Tibor Vass <[email protected]>
1 parent 7491db3 commit 7cd028f

6 files changed

Lines changed: 20 additions & 77 deletions

File tree

docs/contributing/test.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ flag's value is passed as arguments to the `go test` command. For example, from
174174
your local host you can run the `TestBuild` test with this command:
175175

176176
```bash
177-
$ TESTFLAGS='-check.f DockerSuite.TestBuild*' make test-integration
177+
$ TESTFLAGS='-test.run /DockerSuite/TestBuild*' make test-integration
178178
```
179179

180180
To run the same test inside your Docker development container, you do this:
181181

182182
```bash
183-
# TESTFLAGS='-check.f TestBuild*' hack/make.sh binary test-integration
183+
# TESTFLAGS='-test.run /DockerSuite/TestBuild*' hack/make.sh binary test-integration
184184
```
185185

186186
## Test the Windows binary against a Linux daemon
@@ -228,11 +228,11 @@ run a Bash terminal on Windows.
228228
```
229229

230230
Should you wish to run a single test such as one with the name
231-
'TestExample', you can pass in `TESTFLAGS='-check.f TestExample'`. For
231+
'TestExample', you can pass in `TESTFLAGS='-test.run //TestExample'`. For
232232
example
233233

234234
```bash
235-
$ TESTFLAGS='-check.f TestExample' hack/make.sh binary test-integration
235+
$ TESTFLAGS='-test.run //TestExample' hack/make.sh binary test-integration
236236
```
237237

238238
You can now choose to make changes to the Moby source or the tests. If you

hack/ci/windows.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -797,14 +797,14 @@ Try {
797797

798798
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising
799799
$c = "go test "
800-
$c += "`"-check.v`" "
800+
$c += "`"-test.v`" "
801801
if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
802-
$c += "`"-check.f`" "
802+
$c += "`"-test.run`" "
803803
$c += "`"$env:INTEGRATION_TEST_NAME`" "
804804
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME"
805805
}
806806
$c += "`"-tags`" " + "`"autogen`" "
807-
$c += "`"-check.timeout`" " + "`"10m`" "
807+
$c += "`"-timeout`" " + "`"10m`" "
808808
$c += "`"-test.timeout`" " + "`"200m`" "
809809

810810
if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
@@ -892,14 +892,14 @@ Try {
892892
} else {
893893
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising
894894
$c = "go test "
895-
$c += "`"-check.v`" "
895+
$c += "`"-test.v`" "
896896
if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
897-
$c += "`"-check.f`" "
897+
$c += "`"-test.run`" "
898898
$c += "`"$env:INTEGRATION_TEST_NAME`" "
899899
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME"
900900
}
901901
$c += "`"-tags`" " + "`"autogen`" "
902-
$c += "`"-check.timeout`" " + "`"10m`" "
902+
$c += "`"-timeout`" " + "`"10m`" "
903903
$c += "`"-test.timeout`" " + "`"200m`" "
904904

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

hack/make/.integration-test-helpers

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,9 @@
33
# For integration-cli test, we use [gocheck](https://labix.org/gocheck), if you want
44
# to run certain tests on your local host, you should run with command:
55
#
6-
# TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration
6+
# TESTFLAGS='-test.run /DockerSuite/TestBuild*' ./hack/make.sh binary test-integration
77
#
88

9-
if [[ "${TESTFLAGS}" = *-check.f* ]]; then
10-
echo Skipping integration tests since TESTFLAGS includes integration-cli only flags
11-
TEST_SKIP_INTEGRATION=1
12-
fi
13-
14-
if [[ "${TESTFLAGS}" = *-test.run* ]]; then
15-
echo Skipping integration-cli tests since TESTFLAGS includes integration only flags
16-
TEST_SKIP_INTEGRATION_CLI=1
17-
fi
18-
19-
209
if [ -z "${MAKEDIR}" ]; then
2110
MAKEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2211
export MAKEDIR
@@ -32,24 +21,21 @@ setup_integration_test_filter() {
3221
if [ -z "${TEST_FILTER}" ]; then
3322
return
3423
fi
24+
TESTFLAGS+="-test.run ${TEST_FILTER}"
3525

26+
local dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
3627
if [ -z "${TEST_SKIP_INTEGRATION}" ]; then
37-
: "${TEST_INTEGRATION_DIR:=$(grep -rl "func\ .*${TEST_FILTER}.*\(t\ \*testing\.T\)" ./integration | grep '_test\.go' | xargs -I file dirname file | uniq)}"
28+
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')"
3829
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
3930
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
4031
TEST_SKIP_INTEGRATION=1
41-
else
42-
TESTFLAGS_INTEGRATION+="-test.run ${TEST_FILTER}"
4332
fi
4433
fi
4534
4635
if [ -z "${TEST_SKIP_INTEGRATION_CLI}" ]; then
47-
# ease up on the filtering here since CLI suites are namespaced by an object
48-
if grep -r "${TEST_FILTER}.*\(c\ \*check\.C\)" ./integration-cli | grep -q '_test\.go$'; then
36+
if echo "$dirs" | grep -vq '^./integration-cli$'; then
4937
TEST_SKIP_INTEGRATION_CLI=1
5038
echo "Skipping integration-cli tests since the supplied filter \"${TEST_FILTER}\" omits all integration-cli tests"
51-
else
52-
TESTFLAGS_INTEGRATION_CLI+="-check.f ${TEST_FILTER}"
5339
fi
5440
fi
5541
}
@@ -68,7 +54,7 @@ run_test_integration() {
6854
}
6955
7056
run_test_integration_suites() {
71-
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS ${TESTFLAGS_INTEGRATION}"
57+
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
7258
for dir in ${integration_api_dirs}; do
7359
if ! (
7460
cd "$dir"
@@ -81,7 +67,7 @@ run_test_integration_suites() {
8167
8268
run_test_integration_legacy_suites() {
8369
(
84-
flags="-check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS ${TESTFLAGS_INTEGRATION_CLI}"
70+
flags="-test.v -timeout=${TIMEOUT} $TESTFLAGS"
8571
cd integration-cli
8672
echo "Running $PWD flags=${flags}"
8773
# shellcheck disable=SC2086

hack/test/e2e-run.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
1818

1919
run_test_integration() {
2020
set_platform_timeout
21-
if [[ "$TESTFLAGS" != *-check.f* ]]; then
22-
run_test_integration_suites
23-
fi
24-
if [[ "$TESTFLAGS" != *-test.run* ]]; then
25-
run_test_integration_legacy_suites
26-
fi
21+
run_test_integration_suites
22+
run_test_integration_legacy_suites
2723
}
2824

2925
run_test_integration_suites() {
@@ -39,7 +35,7 @@ run_test_integration_suites() {
3935

4036
run_test_integration_legacy_suites() {
4137
(
42-
flags="-check.v -check.timeout=${TIMEOUT:-200m} -test.timeout=360m $TESTFLAGS"
38+
flags="-test.v -timeout=${TIMEOUT:-10m} -test.timeout=360m $TESTFLAGS"
4339
cd /tests/integration-cli
4440
echo "Running $PWD"
4541
test_env ./test.main $flags

hack/validate/default

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1010
. ${SCRIPTDIR}/pkg-imports
1111
. ${SCRIPTDIR}/swagger
1212
. ${SCRIPTDIR}/swagger-gen
13-
. ${SCRIPTDIR}/test-imports
1413
. ${SCRIPTDIR}/toml
1514
. ${SCRIPTDIR}/changelog-well-formed
1615
. ${SCRIPTDIR}/changelog-date-descending

hack/validate/test-imports

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)