Commit graph

76 commits

Author SHA1 Message Date
CrazyMax
440d051ce9
integration-cli: TestRestartContainer is flaky on GitHub Runner
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-19 21:19:10 +02:00
Sebastiaan van Stijn
1f21c4dd05
testutil/registry: remove unused WithStdout(), WithStErr() opts
These were added as part of d7ba1f85ef,
but weren't used at the time, and still aren't used, so let's remove
them.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-05-10 23:46:23 +02:00
Eng Zer Jun
7873c27cfb
all: replace strings.Replace with strings.ReplaceAll
strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-05-09 19:45:40 +08:00
Sebastiaan van Stijn
7e06add3c8
testutil/daemon: remove redundant fmt.Sprintf()'s
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-15 12:49:35 +01:00
Sebastiaan van Stijn
1a15a1a061
testutil: daemon.Cleanup(): cleanup more directories
The storage-driver directory caused Jenkins cleanup to fail. While at it, also
removing other directories that we do not include in the "bundles" that are
stored as Jenkins artifacts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-10 12:09:58 +01:00
Sebastiaan van Stijn
e7583ab859
testutil/daemon: ReadLogFile() trigger os.Sync() before reading
Make sure it's written to disk before we try reading the logs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-10-27 12:39:06 +02:00
Artem Khramov
8f1b2a0fd3
Port testutil/daemon to FreeBSD
testutil/daemon uses a generic unix implementation that assumes that
the host OS supports cgroups & network namespaces, which is not the
case for FreeBSD.

This change adds a FreeBSD-specific implementation for
`testutil/daemon`, namely for `cleanupNetworkNamespace` and
`CgroupNamespace` functions.

Signed-off-by: Artem Khramov <akhramov@pm.me>
2021-10-16 09:51:55 +03:00
Eng Zer Jun
c55a4ac779
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-27 14:56:57 +08:00
Sebastiaan van Stijn
686be57d0a
Update to Go 1.17.0, and gofmt with Go 1.17
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-24 23:33:27 +02:00
Sebastiaan van Stijn
8207c05cfc
Merge pull request #41479 from olljanat/ci-win-containerd-support
Windows CI: Add support for testing with containerd
2021-08-24 22:29:14 +02:00
Akihiro Suda
2f74fa543b
Merge pull request #42763 from thaJeztah/go_🎯
Dockerfile: update syntax, switch to bullseye, add missing libseccomp-dev, remove build pack
2021-08-22 22:37:00 +09:00
Sebastiaan van Stijn
f68260ba22
Dockerfile: frozen images: update to bullseye, remove buildpack-dep
Update the frozen images to also be based on Debian bullseye. Using the "slim"
variant (which looks to have all we're currently using),  and remove the
buildpack-dep frozen image.

The buildpack-dep image is quite large, and it looks like we only use it to
compile some C binaries, which should work fine on a regular debian image;

    docker build -t debian:bullseye-slim-gcc -<<EOF
    FROM debian:bullseye-slim
    RUN apt-get update && apt-get install -y gcc libc6-dev --no-install-recommends
    EOF

    docker image ls

    REPOSITORY        TAG                 IMAGE ID       CREATED          SIZE
    debian            bullseye-slim-gcc   1851750242af   About a minute ago   255MB
    buildpack-deps    bullseye            fe8fece98de2   2 days ago           834MB

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-20 18:23:06 +02:00
Sebastiaan van Stijn
b90dd66bdd
testutil: don't import "opts" package
It was only used for two consts, which are unlikely to change, but the
"opts" package currently also imports libnetwork/ipamutils, which has
an `init()` function that does some heavy lifting, and not needed for
this utility's purpose.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-18 14:28:00 +02:00
Olli Janatuinen
1285c6d125 Windows CI: Add support for testing with containerd
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2021-08-17 07:09:40 -07:00
Sebastiaan van Stijn
314759dc2f
Merge pull request #42393 from aiordache/daemon_config
Daemon config validation
2021-06-23 19:32:07 +02:00
Rich Horwood
8f80e55111 Add configuration validation option and tests.
Fixes #36911

If config file is invalid we'll exit anyhow, so this just prevents
the daemon from starting if the configuration is fine.

Mainly useful for making config changes and restarting the daemon
iff the config is valid.

Signed-off-by: Rich Horwood <rjhorwood@apple.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2021-06-23 09:54:55 +00:00
Sebastiaan van Stijn
6b0ecacd92
gosec: G404: Use of weak random number generator
These should be ok to ignore for the purpose they're used

    pkg/namesgenerator/names-generator.go:843:36: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
        name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))])
                                          ^
    pkg/namesgenerator/names-generator.go:849:36: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
            name = fmt.Sprintf("%s%d", name, rand.Intn(10))
                                             ^
    testutil/stringutils.go:11:18: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
            b[i] = letters[rand.Intn(len(letters))]
                           ^
    pkg/namesgenerator/names-generator.go:849:36: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
            name = fmt.Sprintf("%s%d", name, rand.Intn(10))
                                             ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 13:03:18 +02:00
Tianon Gravi
e58ca15d48
Merge pull request #42098 from thaJeztah/deprecate_quiet
API-client: remove unused ContainerListOptions.Quiet field
2021-06-02 10:41:47 -07:00
Sebastiaan van Stijn
7070df3a3e
integration: ensurePlugin: disable go modules when building plugin
=== RUN   TestServicePlugin
        plugin_test.go:42: assertion failed: error is not nil: error building basic plugin bin: no required module provides package github.com/docker/docker/testutil/fixtures/plugin/basic: go.mod file not found in current directory or any parent directory; see 'go help modules'
            : exit status 1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-05-18 09:51:33 +02:00
Sebastiaan van Stijn
4d3f64da63
API-client: remove unused ContainerListOptions.Quiet field
This option was originally added in d05aa418b0,
and moved in 8b15839ee8 (after which it temporarily
went to the docker/engine-api repository, and was brought back in this repository
in 91e197d614).

However, it looks like this field was never used; the API always returns the standard
information, and the "--quiet" option for `docker ps` is implemented on the CLI
side, which uses different formatting when setting this option;
2ec468e284/api/client/ps.go (L73-L79)

This patch removes the unused field,

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-05-04 16:01:22 +02:00
Tibor Vass
ffc4dc9aec
Merge pull request #41817 from simonferquel/desktop-startup-hang
Fix a potential hang when starting after a non-clean shutdown
2020-12-23 23:22:00 -08:00
Brian Goff
4a175fd050 Cleanup container shutdown check and add test
Adds a test case for the case where dockerd gets stuck on startup due to
hanging `daemon.shutdownContainer`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-12-23 16:59:03 +00:00
Eric Mountain
1c5806cf57
Move use of debian:buster frozen image to debian:bullseye
Signed-off-by: Eric Mountain <eric.mountain@datadoghq.com>
2020-12-19 17:59:36 +01:00
Eric Mountain
b314e901d8
Add IsUserNamespaceInKernel() test environment condition
Signed-off-by: Eric Mountain <eric.mountain@datadoghq.com>
2020-12-18 07:51:43 +01:00
Eric Mountain
58a4c03fed
Add debian:bullseye to frozen images
Signed-off-by: Eric Mountain <eric.mountain@datadoghq.com>
2020-12-18 07:51:40 +01:00
Sebastiaan van Stijn
6d243cdf27
testutil: remove remaining use of deprecated pkg/mount
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-10 14:46:59 +01:00
Sebastiaan van Stijn
182795cff6
Do not call mount.RecursiveUnmount() on Windows
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-29 23:00:16 +01:00
Sebastiaan van Stijn
48059fa5bf
Merge pull request #41533 from cpuguy83/fix_plugin_config
testing: Init plugin config when for tests
2020-10-21 22:44:32 +02:00
Sebastiaan van Stijn
561b8014c0
testutil: set -500 OOM score for test daemons
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-16 18:49:55 +02:00
Brian Goff
f6f294bd83 testing: Init plugin config when for tests
This fixes a panic when running this test for me locally.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-10-07 22:29:49 +00:00
wanghuaiqing
228d74842f Upgrading the versions of images in Dockerfile.
In order to run tests at mips64el device.
Now official-images has supported the following images for mips64el.
buildpack-deps:stretch
buildpack-deps:buster
debian:stretch
debian:buster

But official-images does not support the following images for mips64el.
debian:jessie
buildpack-deps:jessie

Signed-off-by: wanghuaiqing <wanghuaiqing@loongson.cn>
2020-06-30 12:24:06 +08:00
Tibor Vass
5c10ea6ae8
Merge pull request #40725 from cpuguy83/check_img_platform
Accept platform spec on container create
2020-05-21 11:33:27 -07:00
Sebastiaan van Stijn
0fc914de5c
Merge pull request #40595 from sfzhu93/GL_2_25
[integration] add buffer to prevent goroutine leak
2020-05-08 16:00:52 +02:00
Sebastiaan van Stijn
8312004f41
remove uses of deprecated pkg/term
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-21 16:29:27 +02:00
Akihiro Suda
ba8129b28a
Merge pull request #39946 from cpuguy83/plugins_use_containerd_dist
Replace plugin distribution code w/ containerd
2020-04-21 10:03:16 +09:00
Akihiro Suda
5ca47f5179 rootless: graduate from experimental
Close #40484

Note that the support for cgroup v2 isn't ready for production yet,
regardless to rootful or rootless.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-04-07 00:59:15 +09:00
Brian Goff
d7ba1f85ef Use containerd dist libs for plugin pull/pull
This removes the use of the old distribution code in the plugin packages
and replaces it with containerd libraries for plugin pushes and pulls.

Additionally it uses a content store from containerd which seems like
it's compatible with the old "basicBlobStore" in the plugin package.
This is being used locally isntead of through the containerd client for
now.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-04-02 15:03:06 -07:00
Sebastiaan van Stijn
af0415257e
Merge pull request #40694 from kolyshkin/moby-sys-mount-part-II
switch to moby/sys/{mount,mountinfo} part II
2020-04-02 21:52:21 +02:00
Brian Goff
7a9cb29fb9 Accept platform spec on container create
This enables image lookup when creating a container to fail when the
reference exists but it is for the wrong platform. This prevents trying
to run an image for the wrong platform, as can be the case with, for
example binfmt_misc+qemu.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-03-20 16:10:36 -07:00
Kir Kolyshkin
39048cf656 Really switch to moby/sys/mount*
Switch to moby/sys/mount and mountinfo. Keep the pkg/mount for potential
outside users.

This commit was generated by the following bash script:

```
set -e -u -o pipefail

for file in $(git grep -l 'docker/docker/pkg/mount"' | grep -v ^pkg/mount); do
	sed -i -e 's#/docker/docker/pkg/mount"#/moby/sys/mount"#' \
		-e 's#mount\.\(GetMounts\|Mounted\|Info\|[A-Za-z]*Filter\)#mountinfo.\1#g' \
		$file
	goimports -w $file
done
```

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-20 09:46:25 -07:00
Akihiro Suda
5e1b246b9a test-integration: support more rootless tests
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-16 17:37:38 +09:00
Akihiro Suda
5bf33adba2 hack: support $DOCKER_ROOTLESS for testing rootless
```
$ DOCKER_EXPERIMENTAL=1 DOCKER_ROOTLESS=1 TEST_SKIP_INTEGRATION_CLI=1 \
 make test-integration
```

test-integration-cli is unsupported currently.
Also, tests that spawn custom daemon (testutil/daemon) are skipped.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-10 05:49:45 +09:00
Ziheng Liu
c322af8019 test: add buffer to prevent goroutine leak
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
2020-02-27 21:37:26 -05:00
Sebastiaan van Stijn
9f0b3f5609
bump gotest.tools v3.0.1 for compatibility with Go 1.14
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-11 00:06:42 +01:00
Sam Whited
0c9b232bf5 Remove unused GlobalFlags
Signed-off-by: Sam Whited <sam@samwhited.com>
2019-11-06 18:30:20 -05:00
Sam Whited
b96a0c7754 Add daemon options required by buildkit tests
Signed-off-by: Sam Whited <sam@samwhited.com>
2019-11-06 17:13:24 -05:00
Tibor Vass
2cf86a03a9
Merge pull request #40112 from thaJeztah/cut_the_noise
integration-cli: don't log "Creating new daemon" logs, and print correct line numbers
2019-10-24 11:24:24 -07:00
Sebastiaan van Stijn
56230f4d37
testutil: no more "Creating a new daemon at"
Instead of logging on the "happy path", add more details when
we fail to create a daemon. Now that we base the path of the
daemon on the test-name, it should still be easy to find.

Before:

    make TEST_FILTER=TestSwarmNetworkCreateIssue27866 test-integration
    ...
    === RUN   TestDockerSwarmSuite
    === RUN   TestDockerSwarmSuite/TestSwarmNetworkCreateIssue27866
    --- PASS: TestDockerSwarmSuite (7.47s)
        --- PASS: TestDockerSwarmSuite/TestSwarmNetworkCreateIssue27866 (7.47s)
            docker_cli_swarm_test.go:1499: Creating a new daemon at: "/go/src/github.com/docker/docker/bundles/test-integration/TestDockerSwarmSuite/TestSwarmNetworkCreateIssue27866"

After:

    make TEST_FILTER=TestSwarmNetworkCreateIssue27866 test-integration
    ...
    === RUN   TestDockerSwarmSuite
    === RUN   TestDockerSwarmSuite/TestSwarmNetworkCreateIssue27866
    --- PASS: TestDockerSwarmSuite (8.67s)
        --- PASS: TestDockerSwarmSuite/TestSwarmNetworkCreateIssue27866 (8.67s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-21 12:51:27 +02:00
Sebastiaan van Stijn
bbf82b2e53
testutil: daemon.Info() close client after request
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-18 18:09:41 +02:00
Justin Cormack
f681590a25
Merge pull request #40081 from thaJeztah/http_constants
Use http constants for HTTP methods and status codes
2019-10-17 11:30:26 -07:00