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
36 commits
Select commit Hold shift + click to select a range
c9c8799
daemon.ContainerExport(): do not panic
kolyshkin Mar 14, 2018
46ad972
container.BaseFS: check for nil before deref
kolyshkin Mar 14, 2018
3c896e3
integration/TestExportContainerAfterDaemonRestart: add
kolyshkin Mar 15, 2018
a978050
Windows: Fix Hyper-V containers regression from 36586
Mar 15, 2018
a415a11
Cleanup some assertions
dnephin Dec 22, 2017
2ad8904
Update vendor
dnephin Dec 22, 2017
03ad49e
Automated migration using
dnephin Mar 13, 2018
cb1f624
Post migration assertion fixes
dnephin Dec 22, 2017
dc814f3
Cleanup pkg/jsonmessage progress tests
dnephin Dec 29, 2017
f03b3e5
Update testing doc
dnephin Mar 15, 2018
612f972
integration/TestContainerShmNoLeak: use --iptables=false
kolyshkin Mar 12, 2018
33df513
Update e2e script
vdemeester Feb 23, 2018
69f0e0e
integration/*: make e2e run without failure
vdemeester Mar 14, 2018
23752ad
use unique names for resources used by integration tests container/in…
adshmh Mar 21, 2018
34e1feb
Skip some tests in certain condition to run with e2e image
vdemeester Mar 27, 2018
a29f2e1
Add `busybox:latest` into the frozen images
arm64b Feb 27, 2018
2c0117e
Network testing with `busybox:glibc`
arm64b Feb 27, 2018
362aa8f
Migrate test-integration-cli experimental macvlan test to integration
vdemeester Mar 28, 2018
1776b7b
Move integration-cli daemon package to internal/test…
vdemeester Apr 10, 2018
16e1ab0
Fix for Flaky test TestServiceWithPredefinedNetwork
selansen Mar 9, 2018
176c102
Add default pollSettings adjustment routines
arm64b Mar 27, 2018
e0b31bf
Using the default PollSettings function
arm64b Mar 27, 2018
174c840
Make internal/test/daemon.Daemon swarm aware
vdemeester Apr 11, 2018
cb93f50
Migrate test-integration-cli experimental ipvlan test to integration
vdemeester Apr 11, 2018
997850a
Refactor macvlan tests a bit
vdemeester Apr 11, 2018
fa03812
Move ipvlan and macvlan tests on their own folder…
vdemeester Apr 11, 2018
f160c82
Move and refactor integration-cli/registry to internal/test
vdemeester Apr 13, 2018
b11c120
Clean some integration-cli/fixtures package/files
vdemeester Apr 16, 2018
09fa7b7
Migrate test-integration-cli experimental build tests to integration
vdemeester Mar 30, 2018
49acaa1
Small daemon refactoring and add swarm init/join helpers
vdemeester Apr 13, 2018
f70c483
Some enhancement in integration tests
yongtang Apr 14, 2018
7974841
Move fakecontext, fakegit and fakestorage to internal/test
vdemeester Apr 16, 2018
04b5ed6
Migrate image tag tests from integration-cli to api tests
yongtang Apr 11, 2018
faccf7d
remove the retries for service update
AntaresS Apr 10, 2018
608b278
Fix a misused network object name
arm64b Mar 30, 2018
72f3184
Don't make container mount unbindable
crosbymichael Apr 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion components/engine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ RUN echo "source $PWD/hack/make/.integration-test-helpers" >> /etc/bash.bashrc
COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
busybox:1.27-glibc@sha256:8c8f261a462eead45ab8e610d3e8f7a1e4fd1cd9bed5bc0a0c386784ab105d8e \
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
Expand Down
3 changes: 2 additions & 1 deletion components/engine/Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
busybox:1.27-glibc@sha256:8c8f261a462eead45ab8e610d3e8f7a1e4fd1cd9bed5bc0a0c386784ab105d8e \
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
Expand Down
3 changes: 2 additions & 1 deletion components/engine/Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
busybox:1.27-glibc@sha256:8c8f261a462eead45ab8e610d3e8f7a1e4fd1cd9bed5bc0a0c386784ab105d8e \
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
Expand Down
3 changes: 2 additions & 1 deletion components/engine/Dockerfile.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ WORKDIR /go/src/github.com/docker/docker/
COPY contrib/download-frozen-image-v2.sh contrib/download-frozen-image-v2.sh
RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
busybox:1.27-glibc@sha256:8c8f261a462eead45ab8e610d3e8f7a1e4fd1cd9bed5bc0a0c386784ab105d8e \
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c

Expand Down
3 changes: 2 additions & 1 deletion components/engine/Dockerfile.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
busybox:1.27-glibc@sha256:8c8f261a462eead45ab8e610d3e8f7a1e4fd1cd9bed5bc0a0c386784ab105d8e \
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
Expand Down
3 changes: 2 additions & 1 deletion components/engine/Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
busybox:1.27-glibc@sha256:8c8f261a462eead45ab8e610d3e8f7a1e4fd1cd9bed5bc0a0c386784ab105d8e \
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
Expand Down
4 changes: 2 additions & 2 deletions components/engine/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor.
Moby has two test suites (and one legacy test suite):

* Unit tests - use standard `go test` and
[testify](https://github.com/stretchr/testify) assertions. They are located in
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
the package they test. Unit tests should be fast and test only their own
package.
* API integration tests - use standard `go test` and
[testify](https://github.com/stretchr/testify) assertions. They are located in
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
`./integration/<component>` directories, where `component` is: container,
image, volume, etc. These tests perform HTTP requests to an API endpoint and
check the HTTP response and daemon state after the call.
Expand Down
5 changes: 3 additions & 2 deletions components/engine/api/server/middleware/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package middleware // import "github.com/docker/docker/api/server/middleware"
import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
)

func TestMaskSecretKeys(t *testing.T) {
Expand Down Expand Up @@ -53,6 +54,6 @@ func TestMaskSecretKeys(t *testing.T) {

for _, testcase := range tests {
maskSecretKeys(testcase.input, testcase.path)
assert.Equal(t, testcase.expected, testcase.input)
assert.Check(t, is.DeepEqual(testcase.expected, testcase.input))
}
}
21 changes: 11 additions & 10 deletions components/engine/api/server/middleware/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"testing"

"github.com/docker/docker/api/server/httputils"
"github.com/stretchr/testify/assert"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"golang.org/x/net/context"
)

Expand All @@ -17,7 +18,7 @@ func TestVersionMiddlewareVersion(t *testing.T) {
expectedVersion := defaultVersion
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v := httputils.VersionFromContext(ctx)
assert.Equal(t, expectedVersion, v)
assert.Check(t, is.Equal(expectedVersion, v))
return nil
}

Expand Down Expand Up @@ -56,17 +57,17 @@ func TestVersionMiddlewareVersion(t *testing.T) {
err := h(ctx, resp, req, map[string]string{"version": test.reqVersion})

if test.errString != "" {
assert.EqualError(t, err, test.errString)
assert.Check(t, is.Error(err, test.errString))
} else {
assert.NoError(t, err)
assert.Check(t, err)
}
}
}

func TestVersionMiddlewareWithErrorsReturnsHeaders(t *testing.T) {
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
v := httputils.VersionFromContext(ctx)
assert.NotEmpty(t, v)
assert.Check(t, len(v) != 0)
return nil
}

Expand All @@ -81,11 +82,11 @@ func TestVersionMiddlewareWithErrorsReturnsHeaders(t *testing.T) {

vars := map[string]string{"version": "0.1"}
err := h(ctx, resp, req, vars)
assert.Error(t, err)
assert.Check(t, is.ErrorContains(err, ""))

hdr := resp.Result().Header
assert.Contains(t, hdr.Get("Server"), "Docker/"+defaultVersion)
assert.Contains(t, hdr.Get("Server"), runtime.GOOS)
assert.Equal(t, hdr.Get("API-Version"), defaultVersion)
assert.Equal(t, hdr.Get("OSType"), runtime.GOOS)
assert.Check(t, is.Contains(hdr.Get("Server"), "Docker/"+defaultVersion))
assert.Check(t, is.Contains(hdr.Get("Server"), runtime.GOOS))
assert.Check(t, is.Equal(hdr.Get("API-Version"), defaultVersion))
assert.Check(t, is.Equal(hdr.Get("OSType"), runtime.GOOS))
}
15 changes: 7 additions & 8 deletions components/engine/api/types/filters/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
)

func TestParseArgs(t *testing.T) {
Expand All @@ -22,10 +22,10 @@ func TestParseArgs(t *testing.T) {

for i := range flagArgs {
args, err = ParseFlag(flagArgs[i], args)
require.NoError(t, err)
assert.NilError(t, err)
}
assert.Len(t, args.Get("created"), 1)
assert.Len(t, args.Get("image.name"), 2)
assert.Check(t, is.Len(args.Get("created"), 1))
assert.Check(t, is.Len(args.Get("image.name"), 2))
}

func TestParseArgsEdgeCase(t *testing.T) {
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestArgsMatch(t *testing.T) {
}

for args, field := range matches {
assert.True(t, args.Match(field, source),
assert.Check(t, args.Match(field, source),
"Expected field %s to match %s", field, source)
}

Expand All @@ -255,8 +255,7 @@ func TestArgsMatch(t *testing.T) {
}

for args, field := range differs {
assert.False(t, args.Match(field, source),
"Expected field %s to not match %s", field, source)
assert.Check(t, !args.Match(field, source), "Expected field %s to not match %s", field, source)
}
}

Expand Down
24 changes: 13 additions & 11 deletions components/engine/builder/dockerfile/buildargs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package dockerfile // import "github.com/docker/docker/builder/dockerfile"

import (
"bytes"
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
)

func strPtr(source string) *string {
Expand Down Expand Up @@ -39,7 +41,7 @@ func TestGetAllAllowed(t *testing.T) {
"ArgFromMeta": "frommeta1",
"ArgFromMetaOverridden": "fromdockerfile3",
}
assert.Equal(t, expected, all)
assert.Check(t, is.DeepEqual(expected, all))
}

func TestGetAllMeta(t *testing.T) {
Expand All @@ -61,7 +63,7 @@ func TestGetAllMeta(t *testing.T) {
"ArgOverriddenByOptions": "fromopt2",
"ArgNoDefaultInMetaFromOptions": "fromopt3",
}
assert.Equal(t, expected, all)
assert.Check(t, is.DeepEqual(expected, all))
}

func TestWarnOnUnusedBuildArgs(t *testing.T) {
Expand All @@ -77,10 +79,10 @@ func TestWarnOnUnusedBuildArgs(t *testing.T) {
buffer := new(bytes.Buffer)
buildArgs.WarnOnUnusedBuildArgs(buffer)
out := buffer.String()
assert.NotContains(t, out, "ThisArgIsUsed")
assert.NotContains(t, out, "HTTPS_PROXY")
assert.NotContains(t, out, "HTTP_PROXY")
assert.Contains(t, out, "ThisArgIsNotUsed")
assert.Assert(t, !strings.Contains(out, "ThisArgIsUsed"), out)
assert.Assert(t, !strings.Contains(out, "HTTPS_PROXY"), out)
assert.Assert(t, !strings.Contains(out, "HTTP_PROXY"), out)
assert.Check(t, is.Contains(out, "ThisArgIsNotUsed"))
}

func TestIsUnreferencedBuiltin(t *testing.T) {
Expand All @@ -93,8 +95,8 @@ func TestIsUnreferencedBuiltin(t *testing.T) {
buildArgs.AddArg("ThisArgIsUsed", nil)
buildArgs.AddArg("HTTPS_PROXY", nil)

assert.True(t, buildArgs.IsReferencedOrNotBuiltin("ThisArgIsUsed"))
assert.True(t, buildArgs.IsReferencedOrNotBuiltin("ThisArgIsNotUsed"))
assert.True(t, buildArgs.IsReferencedOrNotBuiltin("HTTPS_PROXY"))
assert.False(t, buildArgs.IsReferencedOrNotBuiltin("HTTP_PROXY"))
assert.Check(t, buildArgs.IsReferencedOrNotBuiltin("ThisArgIsUsed"))
assert.Check(t, buildArgs.IsReferencedOrNotBuiltin("ThisArgIsNotUsed"))
assert.Check(t, buildArgs.IsReferencedOrNotBuiltin("HTTPS_PROXY"))
assert.Check(t, !buildArgs.IsReferencedOrNotBuiltin("HTTP_PROXY"))
}
9 changes: 5 additions & 4 deletions components/engine/builder/dockerfile/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"testing"

"github.com/docker/docker/builder/dockerfile/parser"
"github.com/stretchr/testify/assert"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
)

func TestAddNodesForLabelOption(t *testing.T) {
dockerfile := "FROM scratch"
result, err := parser.Parse(strings.NewReader(dockerfile))
assert.NoError(t, err)
assert.Check(t, err)

labels := map[string]string{
"org.e": "cli-e",
Expand All @@ -27,8 +28,8 @@ func TestAddNodesForLabelOption(t *testing.T) {
"FROM scratch",
`LABEL "org.a"='cli-a' "org.b"='cli-b' "org.c"='cli-c' "org.d"='cli-d' "org.e"='cli-e'`,
}
assert.Len(t, nodes.Children, 2)
assert.Check(t, is.Len(nodes.Children, 2))
for i, v := range nodes.Children {
assert.Equal(t, expected[i], v.Original)
assert.Check(t, is.Equal(expected[i], v.Original))
}
}
9 changes: 5 additions & 4 deletions components/engine/builder/dockerfile/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"testing"

"github.com/docker/docker/pkg/containerfs"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/fs"
"github.com/stretchr/testify/assert"
)

func TestIsExistingDirectory(t *testing.T) {
Expand Down Expand Up @@ -39,10 +40,10 @@ func TestIsExistingDirectory(t *testing.T) {

for _, testcase := range testcases {
result, err := isExistingDirectory(&copyEndpoint{driver: containerfs.NewLocalDriver(), path: testcase.path})
if !assert.NoError(t, err) {
if !assert.Check(t, err) {
continue
}
assert.Equal(t, testcase.expected, result, testcase.doc)
assert.Check(t, is.Equal(testcase.expected, result), testcase.doc)
}
}

Expand Down Expand Up @@ -142,6 +143,6 @@ func TestGetFilenameForDownload(t *testing.T) {
resp.Header.Add("Content-Disposition", testcase.disposition)
}
filename := getFilenameForDownload(testcase.path, &resp)
assert.Equal(t, testcase.expected, filename)
assert.Check(t, is.Equal(testcase.expected, filename))
}
}
Loading