Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
dc4884a
pkg/mount: MakeMount: minor optimization
kolyshkin Apr 9, 2019
8b328aa
pkg/mount: Mount: minor optimization
kolyshkin Apr 3, 2019
d2b4701
daemon/mountVolumes: no need to specify fstype
kolyshkin Apr 9, 2019
32685e9
daemon/mountVolumes(): eliminate MakeRPrivate call
kolyshkin Apr 3, 2019
9f03b73
pkg/mount/Make*: optimize
kolyshkin Apr 9, 2019
99799a9
TestContainersAPICreateMountsCreate: minor optimization
kolyshkin Apr 9, 2019
e71e7d8
integration-cli: fix tests that are silently succeeding when they sho…
Aug 24, 2019
02545bf
prepare for rm-gocheck script
Aug 9, 2019
6abf32f
add rm-gocheck.go script and eg templates
Aug 24, 2019
59a9eda
rm-gocheck: normalize c.Check to c.Assert
Sep 9, 2019
e44c6dc
rm-gocheck: redress multiline c.Assert calls
Sep 9, 2019
a11079a
rm-gocheck: c.Assert(...) -> assert.Assert(c, ...)
Sep 9, 2019
4a358d0
rm-gocheck: check.C -> testing.B for BenchmarkXXX
Sep 9, 2019
64a928a
rm-gocheck: check.C -> testing.T
Sep 9, 2019
99deded
rm-gocheck: ErrorMatches -> assert.ErrorContains
Sep 9, 2019
c8da7fb
rm-gocheck: normalize to use checker
Sep 9, 2019
fa8d702
rm-gocheck: Not(IsNil) -> != nil
Sep 9, 2019
819baeb
rm-gocheck: Not(Equals) -> a != b
Sep 9, 2019
b3d02e7
rm-gocheck: Not(Matches) -> !cmp.Regexp
Sep 9, 2019
6dc7846
rm-gocheck: Equals -> assert.Equal
Sep 9, 2019
17e04aa
rm-gocheck: DeepEquals -> assert.DeepEqual
Sep 9, 2019
7b91af8
rm-gocheck: HasLen -> assert.Equal + len()
Sep 9, 2019
ef4c63a
rm-gocheck: IsNil
Sep 9, 2019
e49237d
rm-gocheck: NotNil
Sep 9, 2019
cfd0c55
rm-gocheck: False
Sep 9, 2019
7696045
rm-gocheck: True
Sep 9, 2019
1da0c05
rm-gocheck: redress check.Suite calls
Sep 9, 2019
bbcad73
rm-gocheck: comment out check.Suite calls
Sep 9, 2019
d523748
rm-gocheck: comment out check.TestingT
Sep 9, 2019
e25352a
rm-gocheck: run goimports to compile successfully
Sep 9, 2019
99c1b63
rm-gocheck: Matches -> cmp.Regexp
Sep 9, 2019
07b2436
rm-gocheck: Not(Contains) -> !strings.Contains
Sep 9, 2019
ed9449a
rm-gocheck: Contains -> strings.Contains
Sep 9, 2019
673cf75
rm-gocheck: convert check.Commentf to string - with multiple args
Sep 9, 2019
2f069fa
rm-gocheck: convert check.Commentf to string - with just one string
Sep 9, 2019
be28c05
rm-gocheck: convert check.Commentf to string - other
Sep 9, 2019
1b1fe4c
rm-gocheck: check.CommentInterface -> string
Sep 9, 2019
dc044f2
rm-gocheck: goimports
Sep 9, 2019
be66788
rm-gocheck: fix compile errors from converting check.CommentInterface…
Sep 9, 2019
c30d52b
fix remaining compile issues
Aug 26, 2019
d766dac
prepare for eg on waitAndAssert
Aug 9, 2019
9266ff7
waitAndAssert -> poll.WaitOn
Aug 26, 2019
be42af8
fix remaining issues with checker.Not
Aug 16, 2019
37555cd
remove waitAndAssert and type casts
Aug 26, 2019
5f7621b
remove rm-gocheck.go and templates
Aug 26, 2019
c3d8cb9
vendor: remove vdemeester/shakers and go-check/check
Aug 26, 2019
fce03f9
internal/test/suite
Aug 8, 2019
da96e5c
Setup tests
Aug 9, 2019
a5282fa
cleanup
Aug 26, 2019
0fa81e5
Update Jenkinsfile
Aug 26, 2019
df569fd
hack: update scripts
Aug 26, 2019
15aa73e
remove per-test -timeout logic because it does not work
Aug 30, 2019
05933ab
integration-cli: have helper functions use testing.Helper()
Sep 5, 2019
cf50c5b
integration-cli: fix pollCheck
Sep 9, 2019
d98c74d
intgration-cli: fix formatting
Sep 9, 2019
4c3e2dc
suite: put suite setup inside test run
Sep 9, 2019
7ae6aa4
integration-cli: remove TestingT
Sep 9, 2019
4199956
integration-cli/requirements: Skip windows specific isolation require…
Snorch Aug 7, 2019
4cf69b9
integration-cli: remove unneeded fmt.Sprintf() in asserts
thaJeztah Sep 11, 2019
e1c5cdf
hack: have integration-cli use gotestsum codepath
Sep 11, 2019
682a461
integration-cli: move each test suite to its own TestX testing function
Sep 12, 2019
50cee7c
hack/test/unit: fix custom TESTFLAGS not working
thaJeztah Sep 13, 2019
9464d3c
Disable TestPsListContainersFilterExited (Windows)
Sep 17, 2019
da8cd68
integration-cli: run goimports
Sep 19, 2019
06f11ab
integration-cli: fix golint issues
thaJeztah Sep 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ pipeline {
TEST_INTEGRATION_DEST=1 CONTAINER_NAME=${CONTAINER_NAME}-1 TEST_SKIP_INTEGRATION_CLI=1 run_tests test-integration-flaky &

# integration-cli first set
TEST_INTEGRATION_DEST=2 CONTAINER_NAME=${CONTAINER_NAME}-2 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-check.f ^(DockerSuite|DockerNetworkSuite|DockerHubPullSuite|DockerRegistrySuite|DockerSchema1RegistrySuite|DockerRegistryAuthTokenSuite|DockerRegistryAuthHtpasswdSuite)" run_tests &
TEST_INTEGRATION_DEST=2 CONTAINER_NAME=${CONTAINER_NAME}-2 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-test.run Test(DockerSuite|DockerNetworkSuite|DockerHubPullSuite|DockerRegistrySuite|DockerSchema1RegistrySuite|DockerRegistryAuthTokenSuite|DockerRegistryAuthHtpasswdSuite)/" run_tests &

# integration-cli second set
TEST_INTEGRATION_DEST=3 CONTAINER_NAME=${CONTAINER_NAME}-3 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-check.f ^(DockerSwarmSuite|DockerDaemonSuite|DockerExternalVolumeSuite)" run_tests &
TEST_INTEGRATION_DEST=3 CONTAINER_NAME=${CONTAINER_NAME}-3 TEST_SKIP_INTEGRATION=1 TESTFLAGS="-test.run Test(DockerSwarmSuite|DockerDaemonSuite|DockerExternalVolumeSuite)/" run_tests &

set +x
c=0
Expand Down
5 changes: 0 additions & 5 deletions daemon/bindmount_unix.go

This file was deleted.

9 changes: 3 additions & 6 deletions daemon/volumes_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error {
if m.Writable {
writeMode = "rw"
}
opts := strings.Join([]string{bindMode, writeMode}, ",")
if err := mount.Mount(m.Source, dest, bindMountType, opts); err != nil {
return err
}

// mountVolumes() seems to be called for temporary mounts
// outside the container. Soon these will be unmounted with
Expand All @@ -154,8 +150,9 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error {
// then these unmounts will propagate and unmount original
// mount as well. So make all these mounts rprivate.
// Do not use propagation property of volume as that should
// apply only when mounting happen inside the container.
if err := mount.MakeRPrivate(dest); err != nil {
// apply only when mounting happens inside the container.
opts := strings.Join([]string{bindMode, writeMode, "rprivate"}, ",")
if err := mount.Mount(m.Source, dest, "", opts); err != nil {
return err
}
}
Expand Down
8 changes: 4 additions & 4 deletions docs/contributing/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ flag's value is passed as arguments to the `go test` command. For example, from
your local host you can run the `TestBuild` test with this command:

```bash
$ TESTFLAGS='-check.f DockerSuite.TestBuild*' make test-integration
$ TESTFLAGS='-test.run TestDockerSuite/TestBuild*' make test-integration
```

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

```bash
# TESTFLAGS='-check.f TestBuild*' hack/make.sh binary test-integration
# TESTFLAGS='-test.run TestDockerSuite/TestBuild*' hack/make.sh binary test-integration
```

## Test the Windows binary against a Linux daemon
Expand Down Expand Up @@ -228,11 +228,11 @@ run a Bash terminal on Windows.
```

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

```bash
$ TESTFLAGS='-check.f TestExample' hack/make.sh binary test-integration
$ TESTFLAGS='-test.run /TestExample' hack/make.sh binary test-integration
```

You can now choose to make changes to the Moby source or the tests. If you
Expand Down
10 changes: 4 additions & 6 deletions hack/ci/windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,13 @@ Try {

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

if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
Expand Down Expand Up @@ -926,14 +925,13 @@ Try {
} else {
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising
$c = "go test "
$c += "`"-check.v`" "
$c += "`"-test.v`" "
if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
$c += "`"-check.f`" "
$c += "`"-test.run`" "
$c += "`"$env:INTEGRATION_TEST_NAME`" "
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME"
}
$c += "`"-tags`" " + "`"autogen`" "
$c += "`"-check.timeout`" " + "`"10m`" "
$c += "`"-test.timeout`" " + "`"200m`" "

Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:"
Expand Down
44 changes: 11 additions & 33 deletions hack/make/.integration-test-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@
# For integration-cli test, we use [gocheck](https://labix.org/gocheck), if you want
# to run certain tests on your local host, you should run with command:
#
# TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration
# TESTFLAGS='-test.run TestDockerSuite/TestBuild*' ./hack/make.sh binary test-integration
#

if [[ "${TESTFLAGS}" = *-check.f* ]]; then
echo Skipping integration tests since TESTFLAGS includes integration-cli only flags
TEST_SKIP_INTEGRATION=1
fi

if [[ "${TESTFLAGS}" = *-test.run* ]]; then
echo Skipping integration-cli tests since TESTFLAGS includes integration only flags
TEST_SKIP_INTEGRATION_CLI=1
fi


if [ -z "${MAKEDIR}" ]; then
MAKEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export MAKEDIR
Expand All @@ -32,24 +21,22 @@ setup_integration_test_filter() {
if [ -z "${TEST_FILTER}" ]; then
return
fi
TESTFLAGS+="-test.run ${TEST_FILTER}"

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
: "${TEST_INTEGRATION_DIR:=$(grep -rl "func\ .*${TEST_FILTER}.*\(t\ \*testing\.T\)" ./integration | grep '_test\.go' | xargs -I file dirname file | uniq)}"
: "${TEST_INTEGRATION_DIR:=$(echo "$dirs" | grep -v '^\./integration-cli$')}"
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
TEST_SKIP_INTEGRATION=1
else
TESTFLAGS_INTEGRATION+="-test.run ${TEST_FILTER}"
fi
fi

if [ -z "${TEST_SKIP_INTEGRATION_CLI}" ]; then
# ease up on the filtering here since CLI suites are namespaced by an object
if grep -r "${TEST_FILTER}.*\(c\ \*check\.C\)" ./integration-cli | grep -q '_test\.go$'; then
if echo "$dirs" | grep -vq '^./integration-cli$'; then
TEST_SKIP_INTEGRATION_CLI=1
echo "Skipping integration-cli tests since the supplied filter \"${TEST_FILTER}\" omits all integration-cli tests"
else
TESTFLAGS_INTEGRATION_CLI+="-check.f ${TEST_FILTER}"
fi
fi
}
Expand All @@ -60,16 +47,17 @@ integration_api_dirs="${TEST_INTEGRATION_DIR:-$(go list -test -f '{{- if ne .Fo
run_test_integration() {
set_platform_timeout
if [ -z "${TEST_SKIP_INTEGRATION}" ]; then
run_test_integration_suites
run_test_integration_suites "${integration_api_dirs}"
fi
if [ -z "${TEST_SKIP_INTEGRATION_CLI}" ]; then
run_test_integration_legacy_suites
TIMEOUT=360m run_test_integration_suites integration-cli
fi
}

run_test_integration_suites() {
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS ${TESTFLAGS_INTEGRATION}"
for dir in ${integration_api_dirs}; do
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
local dirs="$1"
for dir in ${dirs}; do
if ! (
cd "$dir"
# Create a useful package name based on the tests's $dir. We need to take
Expand Down Expand Up @@ -97,16 +85,6 @@ run_test_integration_suites() {
done
}

run_test_integration_legacy_suites() {
(
flags="-check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS ${TESTFLAGS_INTEGRATION_CLI}"
cd integration-cli
echo "Running $PWD flags=${flags}"
# shellcheck disable=SC2086
test_env ./test.main $flags
)
}

build_test_suite_binaries() {
if [ -n "${DOCKER_INTEGRATION_TESTS_VERIFIED}" ]; then
echo "Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set"
Expand Down
10 changes: 3 additions & 7 deletions hack/test/e2e-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(

run_test_integration() {
set_platform_timeout
if [[ "$TESTFLAGS" != *-check.f* ]]; then
run_test_integration_suites
fi
if [[ "$TESTFLAGS" != *-test.run* ]]; then
run_test_integration_legacy_suites
fi
run_test_integration_suites
run_test_integration_legacy_suites
}

run_test_integration_suites() {
Expand All @@ -39,7 +35,7 @@ run_test_integration_suites() {

run_test_integration_legacy_suites() {
(
flags="-check.v -check.timeout=${TIMEOUT:-200m} -test.timeout=360m $TESTFLAGS"
flags="-test.v -test.timeout=360m $TESTFLAGS"
cd /tests/integration-cli
echo "Running $PWD"
test_env ./test.main $flags
Expand Down
2 changes: 1 addition & 1 deletion hack/test/unit
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
set -eu -o pipefail

BUILDFLAGS=( -tags 'netgo seccomp libdm_no_deferred_remove' )
TESTFLAGS+="-test.timeout=${TIMEOUT:-5m}"
TESTFLAGS+=" -test.timeout=${TIMEOUT:-5m}"
TESTDIRS="${TESTDIRS:-./...}"
exclude_paths='/vendor/|/integration'
pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)")
Expand Down
1 change: 0 additions & 1 deletion hack/validate/default
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${SCRIPTDIR}/pkg-imports
. ${SCRIPTDIR}/swagger
. ${SCRIPTDIR}/swagger-gen
. ${SCRIPTDIR}/test-imports
. ${SCRIPTDIR}/toml
. ${SCRIPTDIR}/changelog-well-formed
. ${SCRIPTDIR}/changelog-date-descending
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this is merged, I'll have to cherry-pick moby#39897 (Re-enable disable deprecate-integration-cli)

Expand Down
38 changes: 0 additions & 38 deletions hack/validate/test-imports

This file was deleted.

4 changes: 2 additions & 2 deletions integration-cli/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"runtime"
"strings"
"sync"
"testing"

"github.com/go-check/check"
"gotest.tools/assert"
)

func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *check.C) {
func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *testing.B) {
maxConcurrency := runtime.GOMAXPROCS(0)
numIterations := c.N
outerGroup := &sync.WaitGroup{}
Expand Down
Loading