- 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 <tibor@docker.com>
| ... | ... |
@@ -174,13 +174,13 @@ flag's value is passed as arguments to the `go test` command. For example, from |
| 174 | 174 |
your local host you can run the `TestBuild` test with this command: |
| 175 | 175 |
|
| 176 | 176 |
```bash |
| 177 |
-$ TESTFLAGS='-check.f DockerSuite.TestBuild*' make test-integration |
|
| 177 |
+$ TESTFLAGS='-test.run /DockerSuite/TestBuild*' make test-integration |
|
| 178 | 178 |
``` |
| 179 | 179 |
|
| 180 | 180 |
To run the same test inside your Docker development container, you do this: |
| 181 | 181 |
|
| 182 | 182 |
```bash |
| 183 |
-# TESTFLAGS='-check.f TestBuild*' hack/make.sh binary test-integration |
|
| 183 |
+# TESTFLAGS='-test.run /DockerSuite/TestBuild*' hack/make.sh binary test-integration |
|
| 184 | 184 |
``` |
| 185 | 185 |
|
| 186 | 186 |
## Test the Windows binary against a Linux daemon |
| ... | ... |
@@ -228,11 +228,11 @@ run a Bash terminal on Windows. |
| 228 | 228 |
``` |
| 229 | 229 |
|
| 230 | 230 |
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 |
|
| 232 | 232 |
example |
| 233 | 233 |
|
| 234 | 234 |
```bash |
| 235 |
- $ TESTFLAGS='-check.f TestExample' hack/make.sh binary test-integration |
|
| 235 |
+ $ TESTFLAGS='-test.run //TestExample' hack/make.sh binary test-integration |
|
| 236 | 236 |
``` |
| 237 | 237 |
|
| 238 | 238 |
You can now choose to make changes to the Moby source or the tests. If you |
| ... | ... |
@@ -797,14 +797,14 @@ Try {
|
| 797 | 797 |
|
| 798 | 798 |
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising |
| 799 | 799 |
$c = "go test " |
| 800 |
- $c += "`"-check.v`" " |
|
| 800 |
+ $c += "`"-test.v`" " |
|
| 801 | 801 |
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`" " |
|
| 803 | 803 |
$c += "`"$env:INTEGRATION_TEST_NAME`" " |
| 804 | 804 |
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME" |
| 805 | 805 |
} |
| 806 | 806 |
$c += "`"-tags`" " + "`"autogen`" " |
| 807 |
- $c += "`"-check.timeout`" " + "`"10m`" " |
|
| 807 |
+ $c += "`"-timeout`" " + "`"10m`" " |
|
| 808 | 808 |
$c += "`"-test.timeout`" " + "`"200m`" " |
| 809 | 809 |
|
| 810 | 810 |
if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
|
| ... | ... |
@@ -892,14 +892,14 @@ Try {
|
| 892 | 892 |
} else {
|
| 893 | 893 |
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising |
| 894 | 894 |
$c = "go test " |
| 895 |
- $c += "`"-check.v`" " |
|
| 895 |
+ $c += "`"-test.v`" " |
|
| 896 | 896 |
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`" " |
|
| 898 | 898 |
$c += "`"$env:INTEGRATION_TEST_NAME`" " |
| 899 | 899 |
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME" |
| 900 | 900 |
} |
| 901 | 901 |
$c += "`"-tags`" " + "`"autogen`" " |
| 902 |
- $c += "`"-check.timeout`" " + "`"10m`" " |
|
| 902 |
+ $c += "`"-timeout`" " + "`"10m`" " |
|
| 903 | 903 |
$c += "`"-test.timeout`" " + "`"200m`" " |
| 904 | 904 |
|
| 905 | 905 |
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:" |
| ... | ... |
@@ -3,20 +3,9 @@ |
| 3 | 3 |
# For integration-cli test, we use [gocheck](https://labix.org/gocheck), if you want |
| 4 | 4 |
# to run certain tests on your local host, you should run with command: |
| 5 | 5 |
# |
| 6 |
-# TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration |
|
| 6 |
+# TESTFLAGS='-test.run /DockerSuite/TestBuild*' ./hack/make.sh binary test-integration |
|
| 7 | 7 |
# |
| 8 | 8 |
|
| 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 |
- |
|
| 20 | 9 |
if [ -z "${MAKEDIR}" ]; then
|
| 21 | 10 |
MAKEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
| 22 | 11 |
export MAKEDIR |
| ... | ... |
@@ -32,24 +21,21 @@ setup_integration_test_filter() {
|
| 32 | 32 |
if [ -z "${TEST_FILTER}" ]; then
|
| 33 | 33 |
return |
| 34 | 34 |
fi |
| 35 |
+ TESTFLAGS+="-test.run ${TEST_FILTER}"
|
|
| 35 | 36 |
|
| 37 |
+ local dirs=$(grep -rIlE --include '*_test.go' "func .*${TEST_FILTER}.*\(. \*testing\.T\)" ./integration*/ | xargs -I file dirname file | uniq)
|
|
| 36 | 38 |
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)}"
|
|
| 39 |
+ : "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')"
|
|
| 38 | 40 |
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
|
| 39 | 41 |
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
|
| 40 | 42 |
TEST_SKIP_INTEGRATION=1 |
| 41 |
- else |
|
| 42 |
- TESTFLAGS_INTEGRATION+="-test.run ${TEST_FILTER}"
|
|
| 43 | 43 |
fi |
| 44 | 44 |
fi |
| 45 | 45 |
|
| 46 | 46 |
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
|
|
| 47 |
+ if echo "$dirs" | grep -vq '^./integration-cli$'; then |
|
| 49 | 48 |
TEST_SKIP_INTEGRATION_CLI=1 |
| 50 | 49 |
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}"
|
|
| 53 | 50 |
fi |
| 54 | 51 |
fi |
| 55 | 52 |
} |
| ... | ... |
@@ -68,7 +54,7 @@ run_test_integration() {
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
run_test_integration_suites() {
|
| 71 |
- local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS ${TESTFLAGS_INTEGRATION}"
|
|
| 71 |
+ local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
|
|
| 72 | 72 |
for dir in ${integration_api_dirs}; do
|
| 73 | 73 |
if ! ( |
| 74 | 74 |
cd "$dir" |
| ... | ... |
@@ -81,7 +67,7 @@ run_test_integration_suites() {
|
| 81 | 81 |
|
| 82 | 82 |
run_test_integration_legacy_suites() {
|
| 83 | 83 |
( |
| 84 |
- flags="-check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS ${TESTFLAGS_INTEGRATION_CLI}"
|
|
| 84 |
+ flags="-test.v -timeout=${TIMEOUT} $TESTFLAGS"
|
|
| 85 | 85 |
cd integration-cli |
| 86 | 86 |
echo "Running $PWD flags=${flags}"
|
| 87 | 87 |
# shellcheck disable=SC2086 |
| ... | ... |
@@ -18,12 +18,8 @@ integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
|
| 18 | 18 |
|
| 19 | 19 |
run_test_integration() {
|
| 20 | 20 |
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 |
|
| 27 | 23 |
} |
| 28 | 24 |
|
| 29 | 25 |
run_test_integration_suites() {
|
| ... | ... |
@@ -39,7 +35,7 @@ run_test_integration_suites() {
|
| 39 | 39 |
|
| 40 | 40 |
run_test_integration_legacy_suites() {
|
| 41 | 41 |
( |
| 42 |
- flags="-check.v -check.timeout=${TIMEOUT:-200m} -test.timeout=360m $TESTFLAGS"
|
|
| 42 |
+ flags="-test.v -timeout=${TIMEOUT:-10m} -test.timeout=360m $TESTFLAGS"
|
|
| 43 | 43 |
cd /tests/integration-cli |
| 44 | 44 |
echo "Running $PWD" |
| 45 | 45 |
test_env ./test.main $flags |
| ... | ... |
@@ -10,7 +10,6 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
| 10 | 10 |
. ${SCRIPTDIR}/pkg-imports
|
| 11 | 11 |
. ${SCRIPTDIR}/swagger
|
| 12 | 12 |
. ${SCRIPTDIR}/swagger-gen
|
| 13 |
-. ${SCRIPTDIR}/test-imports
|
|
| 14 | 13 |
. ${SCRIPTDIR}/toml
|
| 15 | 14 |
. ${SCRIPTDIR}/changelog-well-formed
|
| 16 | 15 |
. ${SCRIPTDIR}/changelog-date-descending
|
| 17 | 16 |
deleted file mode 100755 |
| ... | ... |
@@ -1,38 +0,0 @@ |
| 1 |
-#!/usr/bin/env bash |
|
| 2 |
-# Make sure we're not using gos' Testing package any more in integration-cli |
|
| 3 |
- |
|
| 4 |
-export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
| 5 |
-source "${SCRIPTDIR}/.validate"
|
|
| 6 |
- |
|
| 7 |
-IFS=$'\n' |
|
| 8 |
-files=( $(validate_diff --diff-filter=ACMR --name-only -- 'integration-cli/*.go' || true) ) |
|
| 9 |
-unset IFS |
|
| 10 |
- |
|
| 11 |
-badFiles=() |
|
| 12 |
-for f in "${files[@]}"; do
|
|
| 13 |
- # skip check_test.go since it *does* use the testing package |
|
| 14 |
- if [ "$f" = "integration-cli/check_test.go" ]; then |
|
| 15 |
- continue |
|
| 16 |
- fi |
|
| 17 |
- |
|
| 18 |
- # we use "git show" here to validate that what's committed doesn't contain golang built-in testing |
|
| 19 |
- if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then |
|
| 20 |
- if [ "$(echo $f | grep '_test')" ]; then |
|
| 21 |
- # allow testing.T for non- _test files |
|
| 22 |
- badFiles+=( "$f" ) |
|
| 23 |
- fi |
|
| 24 |
- fi |
|
| 25 |
-done |
|
| 26 |
- |
|
| 27 |
-if [ ${#badFiles[@]} -eq 0 ]; then
|
|
| 28 |
- echo 'Congratulations! No testing.T found.' |
|
| 29 |
-else |
|
| 30 |
- {
|
|
| 31 |
- echo "These files use the wrong testing infrastructure:" |
|
| 32 |
- for f in "${badFiles[@]}"; do
|
|
| 33 |
- echo " - $f" |
|
| 34 |
- done |
|
| 35 |
- echo |
|
| 36 |
- } >&2 |
|
| 37 |
- false |
|
| 38 |
-fi |