Commit graph

1233 commits

Author SHA1 Message Date
Sebastiaan van Stijn
26f2eddaa3
integration/config: combine TestConfigCreateWithLabels with TestConfigsCreateAndDelete
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:29 +02:00
Sebastiaan van Stijn
3c4b258f21
integration/secret: don't string-match errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:26 +02:00
Sebastiaan van Stijn
18cae89436
integration/config: don't string-match errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:24 +02:00
Sebastiaan van Stijn
348f412d85
integration: sync minor changes between config and secret tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:22 +02:00
Sebastiaan van Stijn
a45c89ecd1
integration/secret: fix TestSecretInspect not actually checking response
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:21 +02:00
Sebastiaan van Stijn
25424cf772
integration/config: move functions to be in line with "secret" tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:19 +02:00
Sebastiaan van Stijn
3c6f018f94
integration/secret: TestTemplatedSecret: simplify task code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:17 +02:00
Sebastiaan van Stijn
de78663181
integration/secret: rename variables that collided with imported package name
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:15 +02:00
Sebastiaan van Stijn
dd67b4794e
integration/config: TestTemplatedConfig: simplify task code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:13 +02:00
Sebastiaan van Stijn
ec78112edd
integration/config: rename variables that collided with imported package name
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 18:31:11 +02:00
Brian Goff
ced91bee4b On startup, actually shutdown the container.
When a container is left running after the daemon exits (e.g. the daemon
is SIGKILL'd or crashes), it should stop any running containers when the
daemon starts back up.

What actually happens is the daemon only sends the container's
configured stop signal and does not check if it has exited.
If the container does not actually exit then it is left running.

This fixes this unexpected behavior by calling the same function to shut
down the container that the daemon shutdown process does.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-04-13 14:20:12 -07: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
Arko Dasgupta
2e0762ae44
Add TC for com.docker.network.host_ipv4 label
This PR adds a testcase for the com.docker.network.host_ipv4
label commited via https://github.com/docker/libnetwork/pull/2454

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2020-03-09 18:51:19 +01:00
Sebastiaan van Stijn
e1710b42d3
vendor: bump libnetwork bf2bd42abc0a3734f12b5ec724e571434e42c669
full diff: 264bffcb88...bf2bd42abc

relevant changes:

- docker/libnetwork#2407 Macvlan internal network should not change default gateway
    - fixes docker/libnetwork#2406 Internal macvlan network overrides default gateway
- vendor godbus/dbus v5
- Fix InhibitIPv4 nil panic
- Cleanup VFP during overlay network removal
    - fixes VFP leak in windows overlay network deletion

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-07 00:35:47 +01:00
Akihiro Suda
3fbc41fe36 TestCgroupDriverSystemdMemoryLimit: fix failure
The test was failing:

  --- FAIL: TestCgroupDriverSystemdMemoryLimit (1.76s)
      cgroupdriver_systemd_test.go:54: assertion failed: 67108864 (s.HostConfig.Memory int64) != 67108864 (mem int)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-03 11:30:55 +09:00
Brian Goff
ce1ceeb257 Add stats options to not prime the stats
Metrics collectors generally don't need the daemon to prime the stats
with something to compare since they already have something to compare
with.
Before this change, the API does 2 collection cycles (which takes
roughly 2s) in order to provide comparison for CPU usage over 1s. This
was primarily added so that `docker stats --no-stream` had something to
compare against.

Really the CLI should have just made a 2nd call and done the comparison
itself rather than forcing it on all API consumers.
That ship has long sailed, though.

With this change, clients can set an option to just pull a single stat,
which is *at least* a full second faster:

Old:
```
time curl --unix-socket
/go/src/github.com/docker/docker/bundles/test-integration-shell/docker.sock
http://./containers/test/stats?stream=false\&one-shot=false > /dev/null
2>&1

real0m1.864s
user0m0.005s
sys0m0.007s

time curl --unix-socket
/go/src/github.com/docker/docker/bundles/test-integration-shell/docker.sock
http://./containers/test/stats?stream=false\&one-shot=false > /dev/null
2>&1

real0m1.173s
user0m0.010s
sys0m0.006s
```

New:
```
time curl --unix-socket
/go/src/github.com/docker/docker/bundles/test-integration-shell/docker.sock
http://./containers/test/stats?stream=false\&one-shot=true > /dev/null
2>&1
real0m0.680s
user0m0.008s
sys0m0.004s

time curl --unix-socket
/go/src/github.com/docker/docker/bundles/test-integration-shell/docker.sock
http://./containers/test/stats?stream=false\&one-shot=true > /dev/null
2>&1

real0m0.156s
user0m0.007s
sys0m0.007s
```

This fixes issues with downstreams ability to use the stats API to
collect metrics.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-02-28 09:54:37 -08: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
39679991f4
Merge pull request #40543 from SamWhited/upstream_logging
Upstream logging changes from Enterprise Edition
2020-02-27 13:54:14 +01:00
Akihiro Suda
26e6708ccf
Merge pull request #40475 from cpuguy83/fix_client_exec_type_id
Exec inspect field should be "ID" not "ExecID"
2020-02-26 19:11:33 +09:00
Sam Whited
a6f99232f5 Always execute tests and skip in tests themselves
See issue #40193

Signed-off-by: Sam Whited <sam@samwhited.com>
2020-02-21 14:31:01 -05:00
Brian Goff
750f0d1648 Support configuration of log cacher.
Configuration over the API per container is intentionally left out for
the time being, but is supported to configure the default from the
daemon config.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit cbecf48bc352e680a5390a7ca9cff53098cd16d7)
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2020-02-19 17:02:34 -05:00
Brian Goff
e2ceb83a53 Support reads for all log drivers.
This supplements any log driver which does not support reads with a
custom read implementation that uses a local file cache.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit d675e2bf2b75865915c7a4552e00802feeb0847f)
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2020-02-19 17:01:44 -05:00
Sebastiaan van Stijn
58c2615208
Merge pull request #40497 from arkodg/fix-bip-subnet-config
Set the bip network value as the subnet
2020-02-12 12:41:29 +01:00
Sebastiaan van Stijn
562880b276
Fix more goimports
```
daemon/logger/splunk/splunk_test.go:33: File is not `goimports`-ed (goimports)
        envKey:      "a",
        envRegexKey: "^foo",
        labelsKey:   "b",
        tagKey:      "c",
integration/build/build_test.go:41: File is not `goimports`-ed (goimports)
            rm:      false,
            forceRm: false,
integration/image/remove_unix_test.go:49: File is not `goimports`-ed (goimports)
        Root: d.Root,
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-11 18:56:25 +01:00
Arko Dasgupta
f800d5f786 Set the bip network value as the subnet
Dont assign the --bip value directly to the subnet
for the default bridge. Instead use the network value
from the ParseCIDR output

Addresses: https://github.com/moby/moby/issues/40392

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2020-02-10 17:38:54 -08: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
Brian Goff
cc993a9cbf Exec inspect field should be "ID" not "ExecID"
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-02-10 14:08:54 -08:00
Sebastiaan van Stijn
e55bff541e
TestLoginFailsWithBadCredentials: prepare for Go 1.14 changes
Go 1.14 adds quotes around the url in the error returned:

    === FAIL: arm64.integration.system TestLoginFailsWithBadCredentials (0.27s)
        TestLoginFailsWithBadCredentials: login_test.go:27: assertion failed: expected error "Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password", got "Error response from daemon: Get \"https://registry-1.docker.io/v2/\": unauthorized: incorrect username or password"
            Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 19:05:12 +01:00
Brian Goff
f464c31668 Check tmpfs mounts before create anon volume
This makes sure that things like `--tmpfs` mounts over an anonymous
volume don't create volumes uneccessarily.
One method only checks mountpoints, the other checks both mountpoints
and tmpfs... the usage of these should likely be consolidated.

Ideally, processing for `--tmpfs` mounts would get merged in with the
rest of the mount parsing. I opted not to do that for this change so the
fix is minimal and can potentially be backported with fewer changes of
breaking things.
Merging the mount processing for tmpfs can be handled in a followup.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-02-04 10:12:05 -08:00
Sebastiaan van Stijn
ca20bc4214
Merge pull request #40007 from arkodg/add-host-docker-internal
Support host.docker.internal in dockerd on Linux
2020-01-27 13:42:26 +01:00
Arko Dasgupta
92e809a680 Support host.docker.internal in dockerd on Linux
Docker Desktop (on MAC and Windows hosts) allows containers
running inside a Linux VM to connect to the host using
the host.docker.internal DNS name, which is implemented by
VPNkit (DNS proxy on the host)

This PR allows containers to connect to Linux hosts
by appending a special string "host-gateway" to --add-host
e.g. "--add-host=host.docker.internal:host-gateway" which adds
host.docker.internal DNS entry in /etc/hosts and maps it to host-gateway-ip

This PR also add a daemon flag call host-gateway-ip which defaults to
the default bridge IP
Docker Desktop will need to set this field to the Host Proxy IP
so DNS requests for host.docker.internal can be routed to VPNkit

Addresses: https://github.com/docker/for-linux/issues/264

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2020-01-22 13:30:00 -08:00
Drew Erny
30d9fe30b1 Add swarm jobs
Adds support for ReplicatedJob and GlobalJob service modes. These modes
allow running service which execute tasks that exit upon success,
instead of daemon-type tasks.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2020-01-13 13:21:12 -06:00
Sebastiaan van Stijn
d64156970f
Merge pull request #40309 from dperny/bump-swarmkit
Bump swarmkit to 24fb4cfe8af56803640180c5592bf32da732ced2
2020-01-09 20:16:33 +01:00
Drew Erny
07efe6a0a7 Bump swarmkit to 24fb4cfe8af56803640180c5592bf32da732ced2
Bumps the vendoring of github.com/docker/swarmkit to the above commit,
which is the current master at commit time.

Most notably, this includes a change making the ingress network respect
the default address pool. Because of this change, a change to network
integration tests was needed.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2020-01-07 09:43:22 -06:00
Akihiro Suda
19baeaca26 cgroup2: enable cgroup namespace by default
For cgroup v1, we were unable to change the default because of
compatibility issue.

For cgroup v2, we should change the default right now because switching
to cgroup v2 is already breaking change.

See also containers/libpod#4363 containers/libpod#4374

Privileged containers also use cgroupns=private by default.
https://github.com/containers/libpod/pull/4374#issuecomment-549776387

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-01 02:58:40 +09:00
Brian Goff
5f83f15ecb
Merge pull request #40193 from vikramhh/volumes_plugins_test_failure
Volume plugin tests [integration/plugin/volumes] should always be executed - checks for OS Type should happen within the test
2019-12-19 11:29:46 -08:00
Brian Goff
f9c8717d87
Merge pull request #40268 from olljanat/garbage-collector-remove-layerdb-values
Make sure that layers are removed from layerdb after succefull layer …
2019-12-18 09:49:22 -08:00
Akihiro Suda
0a4d980d71
Merge pull request #40142 from jmartin84/unique-names-intergration-service-inspect-test
refactored integration/service/instead_test.go to ues unique resource…
2019-12-13 18:25:08 +09:00
Brian Goff
b95fad8e51
Merge pull request #40263 from thaJeztah/normalize_comments
Normalize comment formatting
2019-12-12 12:06:22 -08:00
Jintao Zhang
56c5668068 Testcase: Change time comparison logic.
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2019-12-10 20:10:28 +08:00
Olli Janatuinen
446fe7f263 Make sure that layers are removed from layerdb after succefull layer removal
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-11-28 20:06:09 +02:00
Sebastiaan van Stijn
92ad849327
integration: normalize comment formatting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-27 15:37:59 +01:00
vikrambirsingh
83783af08e Disable tests missed by PR 40155
The tests starts a new daemon, but attempts to run it with overlay2,
and using a unix:// socket, which doesn't really work on Windows.

40155 tried to disable such tests but missed two of them.
They are being disabled with this change.

Signed-off-by: vikrambirsingh <vikrambir.singh@docker.com>
2019-11-11 18:54:21 +00:00
Justen Martin
36f6cc11a4
refactored integration/service/instead_test.go to ues unique resource names
Signed-off-by: Justen Martin <jmart@the-coder.com>
2019-11-08 16:39:20 -06:00
vikrambirsingh
25c5a55261 Check for OS Type and skip within the test
Premature check for OS type means that the test
will never even get to run on other OS types. This
will cause it to be always flagged as a failure on
such OS types.

Signed-off-by: vikrambirsingh <vikrambir.singh@docker.com>
2019-11-07 22:42:20 +00:00
Kirill Kolyshkin
154cf042fd
Merge pull request #40144 from lzhfromustc/GL_outputDone
integration/internal/container: fix a goroutine leak bug
2019-11-07 12:02:47 -08:00
Sebastiaan van Stijn
a0a5ec4c6d
Integration: skip TestInfoDebug on Windows
The test starts a new daemon, but attempts to run it with overlay2,
and using a unix:// socket, which doesn't really work on Windows.

```
00:14:14.623  --- FAIL: TestInfoDebug (0.01s)
00:14:14.623      info_test.go:75: [dbe75bf7729f3] failed to start daemon with arguments [--containerd /var/run/docker/containerd/containerd.sock --data-root D:\gopath\src\github.com\docker\docker\bundles\tmp\TestInfoDebug\dbe75bf7729f3\root --exec-root C:\windows\TEMP\dxr\dbe75bf7729f3 --pidfile D:\gopath\src\github.com\docker\docker\bundles\tmp\TestInfoDebug\dbe75bf7729f3\docker.pid --userland-proxy=true --containerd-namespace dbe75bf7729f3 --containerd-plugins-namespace dbe75bf7729f3p --host unix://C:\windows\TEMP\docker-integration\dbe75bf7729f3.sock --storage-driver overlay2 --debug] : protocol not available
00:14:14.623  === RUN   TestInfoInsecureRegistries
00:14:14.623  --- FAIL: TestInfoInsecureRegistries (0.00s)
00:14:14.623      info_test.go💯 [d3c745c16a39c] failed to start daemon with arguments [--containerd /var/run/docker/containerd/containerd.sock --data-root D:\gopath\src\github.com\docker\docker\bundles\tmp\TestInfoInsecureRegistries\d3c745c16a39c\root --exec-root C:\windows\TEMP\dxr\d3c745c16a39c --pidfile D:\gopath\src\github.com\docker\docker\bundles\tmp\TestInfoInsecureRegistries\d3c745c16a39c\docker.pid --userland-proxy=true --containerd-namespace d3c745c16a39c --containerd-plugins-namespace d3c745c16a39cp --host unix://C:\windows\TEMP\docker-integration\d3c745c16a39c.sock --debug --storage-driver overlay2 --insecure-registry=192.168.1.0/24 --insecure-registry=insecurehost.com:5000] : protocol not available
00:14:14.623  === RUN   TestInfoRegistryMirrors
00:14:14.623  --- FAIL: TestInfoRegistryMirrors (0.01s)
00:14:14.623      info_test.go:124: [d277126ad0515] failed to start daemon with arguments [--containerd /var/run/docker/containerd/containerd.sock --data-root D:\gopath\src\github.com\docker\docker\bundles\tmp\TestInfoRegistryMirrors\d277126ad0515\root --exec-root C:\windows\TEMP\dxr\d277126ad0515 --pidfile D:\gopath\src\github.com\docker\docker\bundles\tmp\TestInfoRegistryMirrors\d277126ad0515\docker.pid --userland-proxy=true --containerd-namespace d277126ad0515 --containerd-plugins-namespace d277126ad0515p --host unix://C:\windows\TEMP\docker-integration\d277126ad0515.sock --debug --storage-driver overlay2 --registry-mirror=https://192.168.1.2 --registry-mirror=http://registry.mirror.com:5000] : protocol not available
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-30 17:42:52 +01:00
Ziheng Liu
6233217a31 integration/internal/container: fix a goroutine leak bug by adding 1 buffer
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
2019-10-27 20:22:52 -04:00
Sebastiaan van Stijn
ec4a34ae2f
integration-cli: migrate some "info" tests to integration
- Updated TestInfoSecurityOptions to not rely on CLI output. Note that this
  test should be migrated to the integration suite, but that suite does not yet
  have checks for "Seccomp" and "AppArmor"
- TestInfoAPIWarnings: don't start with busybox because we're not running containers in this test
- Migrate TestInfoDebug to integration suite
- Migrate TestInsecureRegistries to integration suite (renamed to TestInfoInsecureRegistries)
- Migrate TestRegistryMirrors to integration suite (renamed to TestInfoRegistryMirrors)
- Migrate TestInfoDiscoveryBackend to integration suite
- Migrate TestInfoDiscoveryInvalidAdvertise to integration suite
- Migrate TestInfoDiscoveryAdvertiseInterfaceName to integration suite
- Remove TestInfoFormat, which is testing the CLI functionality, and there is an
  existing test in docker/cli (TestFormatInfo) covering this

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-22 00:11:52 +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
Drew Erny
f36042d259 Add support for sending down service Running and Desired task counts
Adds a new ServiceStatus field to the Service object, which includes the
running and desired task counts. This new field is gated behind a
"status" query parameter.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2019-10-14 10:43:00 -05:00
Sebastiaan van Stijn
9ed58987ce
integration: use constants for http methods
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-13 17:30:13 +02:00
Tibor Vass
6ca3ec88ae builder: remove legacy build's session handling
This feature was used by docker build --stream and it was kept experimental.

Users of this endpoint should enable BuildKit anyway by setting Version to BuilderBuildKit.

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-10-02 20:29:15 +00:00
Sebastiaan van Stijn
f60d6ee4bc
testutil: update WithInitsignature to be a daemon.Option
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-30 17:38:26 +02:00
Sebastiaan van Stijn
554d9cec25
testutil: update WithExperimental signature to be a daemon.Option
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-30 17:38:24 +02:00
Sam Whited
ae0a878b86 testutil, integration: untangle image dependency
Signed-off-by: Sam Whited <sam@samwhited.com>
2019-09-24 14:50:59 -05:00
Sebastiaan van Stijn
41ee87c681
Merge pull request #39942 from SamWhited/daemon_ops_type
testutil/daemon: group options under type
2019-09-19 17:44:49 +02:00
Sam Whited
41adef29f5 testutil/daemon: group options under type
Signed-off-by: Sam Whited <sam@samwhited.com>
2019-09-18 09:14:50 -05:00
Sebastiaan van Stijn
5358c95a76
TestGraphdriverPluginV2: SA5001: should check returned error before deferring (staticcheck)
```
integration/plugin/graphdriver/external_test.go:427:2: SA5001: should check returned error before deferring responseReader.Close() (staticcheck)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:55 +02:00
Sebastiaan van Stijn
101ff26eb5
misspell: fix some spelling issues
```
internal/test/environment/environment.go:37:23: `useing` is a misspelling of `using`(misspell)
integration/container/wait_test.go:49:9: `waitres` is a misspelling of `waiters`(misspell)
integration/container/wait_test.go:95:9: `waitres` is a misspelling of `waiters`(misspell)
integration-cli/docker_api_containers_test.go:1042:7: `waitres` is a misspelling of `waiters`(misspell)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:48 +02:00
Sebastiaan van Stijn
d948306255
integration: remove unused constants and fields (unused)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:10 +02:00
Sebastiaan van Stijn
4b13f69882
integration/network: remove unuset setupTest()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:08 +02:00
Sebastiaan van Stijn
4a37dcab48
Fix and re-enable TestDockerNetworkMacvlan/MultiSubnet
The linter marked an issue because testMacvlanMultiSubnet was not used.
Re-enabling the test showed that there was a typo in the assert, causing the
test to fail:

```
--- FAIL: TestDockerNetworkMacvlan/MultiSubnet (4.74s)
    macvlan_test.go:243: assertion failed: 2001:db8:abc4::254 (c3.NetworkSettings.Networks["dualstackbridge"].IPv6Gateway string) != 2001:db8.abc4::254 (string)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:07 +02:00
Michael Crosby
9f08135e02
Merge pull request #39844 from thaJeztah/fix_test_bashisms
Fix some bashisms/non-standard comparisons in integration tests
2019-09-12 14:49:56 -04:00
Justen Martin
548623b758 Use unique names in integration/service/plugin_test.go
Signed-off-by: Justen Martin <jmart@the-coder.com>
2019-09-11 19:09:54 -05:00
Sebastiaan van Stijn
32f1c65162
TestBuildSquashParent: fix non-standard comparisson
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-12 00:53:59 +02:00
Sam Whited
b37c214e3c testutil: make testing packages public
This was done with something along the lines of:

```
mv internal/test testutil
pushd testutil/; grep -IRl "package test" | xargs -I '{}' sed -i -e 's|package test|package testutil|g' {}; popd
mv internal/testutil/*.go testutil/ && rm -rf internal/
grep -IRl "github.com\/docker\/docker\/internal\/test" | xargs -I '{}' sed -i -e 's|github.com/docker/docker/internal/test|github.com/docker/docker/test|g' {}
goimports .
```

I also modified the basic plugin path in testutil/fixtures/plugin.

Signed-off-by: Sam Whited <sam@samwhited.com>
2019-09-11 07:47:23 -05:00
Sebastiaan van Stijn
cd9e4ec240
Merge pull request #39852 from thaJeztah/detect_invalid_linked_container
Return "invalid parameter" when linking to non-existing container
2019-09-11 09:51:10 +02:00
Tibor Vass
15c25714e8
Merge pull request #39881 from thaJeztah/inspect_test_use_RunningTasksCount
integration: TestInspect(): use swarm.RunningTasksCount
2019-09-10 14:18:33 -07:00
Sebastiaan van Stijn
422067ba7b
Return "invalid parameter" when linking to non-existing container
Trying to link to a non-existing container is not valid, and should return an
"invalid parameter" (400) error. Returning a "not found" error in this situation
would make the client report the container's image could not be found.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-10 23:06:56 +02:00
Tibor Vass
000b563006
Merge pull request #39671 from arkodg/fix-flaky-addr-pool-init-test
Fix flaky TestServiceWithDefaultAddressPoolInit
2019-09-09 15:01:11 -07:00
Sebastiaan van Stijn
f874f8b6fd
integration: TestInspect(): use swarm.RunningTasksCount
Instead of using the locally crafted `serviceContainerCount()` utility

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-09 17:48:12 +02:00
Rob Gulewich
96f6c81ab7 Change TestCgroupNamespacesRunPrivileged requirement
This test requires cgroup namespaces to be enabled, not the other way
around.

Signed-off-by: Rob Gulewich <rgulewich@netflix.com>
2019-08-23 11:27:27 -07:00
Vikram bir Singh
b146b2382c Fixups for 39695 - edit comments, redundant lines
1. Modify comments added in 5858a99267
Windows Volume GUID path format is: \\?\Volume{<GUID Value>}\<path>
Rewrote the example given in comments to conform to the format..

2. Remove two redundant asserts[assert.NilError]. They are redundant
because the last statement will not change the value of err.

Signed-off-by: Vikram bir Singh <vikrambir.singh@docker.com>
2019-08-15 21:13:46 +00:00
Arko Dasgupta
a65dee30fc Move defer method to the top right after New is called
Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-08-15 14:09:47 -07:00
Arko Dasgupta
f3a3ea0d3c Fix flaky TestServiceWithDefaultAddressPoolInit
1.This commit replaces serviceRunningCount with
swarm.RunningTasksCount to accurately check if the
service is running with the accurate number of instances
or not. serviceRunningCount was only checking the ServiceList
and was not checking if the tasks were running or not

This adds a safe barrier to execute docker network inspect
commands for overlay networks which get created
asynchronously via Swarm

2. Make sure client connections are closed

3. Make sure every service and network name is unique

4. Make sure services and networks are cleaned up

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-08-14 08:02:15 -07:00
Sebastiaan van Stijn
5858a99267
Builder: fix "COPY --from" to non-existing directory on Windows
This fixes a regression introduced in 6d87f19142,
causing `COPY --from` to fail if the target directory does not exist:

```
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as s1
RUN echo "Hello World" > /hello

FROM mcr.microsoft.com/windows/servercore:ltsc2019
COPY --from=s1 /hello /hello/another/world
```

Would produce an error:

```
Step 4/4 : COPY --from=s1 /hello /hello/another/world
failed to copy files: mkdir \\?: The filename, directory name, or volume label syntax is incorrect.
```

The cause for this was that Go's `os.MkdirAll()` does not support/detect volume GUID paths
(`\\?\Volume{dae8d3ac-b9a1-11e9-88eb-e8554b2ba1db}\hello\another}`), and as a result
attempted to create the volume as a directory (`\\?`), causing it to fail.

This patch replaces `os.MkdirAll()` with our own `system.MkdirAll()` function, which
is capable of detecting GUID volumes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-08 16:45:10 +02:00
Brian Goff
abece9b562 Improvements to the test runners
1. Use `go list` to get list of integration dirs to build. This means we
   do not need to have a valid `.go` in every subdirectory and also
   filters out other dirs like "bundles" which may have been created.
2. Add option to specify custom flags for integration and
   integration-cli. This is needed so both suites can be run AND set
   custom flags... since the cli suite does not support standard go
   flags.
3. Add options to skip an entire integration suite.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-07-31 16:37:17 -07:00
Michael Crosby
d6cbeee470 Add extra permission check in removal test
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-22 20:39:22 +00:00
Sebastiaan van Stijn
eeaa0b30d4
Skip TestHealthKillContainer on Windows
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in https://github.com/moby/moby/pull/39454, but
rewritten in a commit in the same PR:
f8aef6a92f

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: 8e610b2b55/pkg/signal/signal.go (L29-L44)
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; f1b5612f20/daemon/kill.go (L40-L48)
- Windows only looks to support 2 signals currently 8e610b2b55/pkg/signal/signal_windows.go (L17-L26)
- Upstream Golang looks to define `SIGINT` as well; 77f9b2728e/src/runtime/defs_windows.go (L44)
- This looks like the current list of Signals upstream in Go; 3b58ed4ad3/windows/types_windows.go (L52-L67)

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-19 16:09:50 +02:00
Sebastiaan van Stijn
becd29c665
integration: run build session tests on non-experimental
The session endpoint is no longer experimental since
01c9e7082e, so we don't
need to start an experimental daemon.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 23:56:04 +02:00
Sebastiaan van Stijn
9d1b4f5fc3
Add regression tests for invalid platform status codes
Before we handled containerd errors, using an invalid platform produced a 500 status:

```bash
curl -v \
  -X POST \
  --unix-socket /var/run/docker.sock \
  "http://localhost:2375/v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest" \
  -H "Content-Type: application/json"
```

```
* Connected to localhost (docker.sock) port 80 (#0)
> POST /v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest HTTP/1.1
> Host: localhost:2375
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 500 Internal Server Error
< Api-Version: 1.40
< Content-Length: 85
< Content-Type: application/json
< Date: Mon, 15 Jul 2019 15:25:44 GMT
< Docker-Experimental: true
< Ostype: linux
< Server: Docker/19.03.0-rc2 (linux)
<
{"message":"\"foobar\": unknown operating system or architecture: invalid argument"}
```

That problem is now fixed, and the API correctly returns a 4xx status:

```bash
curl -v \
  -X POST \
  --unix-socket /var/run/docker.sock \
  "http://localhost:2375/v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest" \
  -H "Content-Type: application/json"
```

```
* Connected to localhost (/var/run/docker.sock) port 80 (#0)
> POST /v1.40/images/create?fromImage=hello-world&platform=foobar&tag=latest HTTP/1.1
> Host: localhost:2375
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 400 Bad Request
< Api-Version: 1.41
< Content-Type: application/json
< Docker-Experimental: true
< Ostype: linux
< Server: Docker/dev (linux)
< Date: Mon, 15 Jul 2019 15:13:42 GMT
< Content-Length: 85
<
{"message":"\"foobar\": unknown operating system or architecture: invalid argument"}
* Curl_http_done: called premature == 0
```

This patch adds tests to validate the behaviour

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-15 20:37:00 +02:00
Sebastiaan van Stijn
6359da4afa
Merge pull request #39431 from thaJeztah/macvlan_redundant_checks
Integration: remove redundant kernel version check for MACVlan
2019-07-15 11:33:15 +02:00
Sebastiaan van Stijn
5ce4394486
Merge pull request #37836 from selansen/test_initpool
TestServiceWithDefaultAddressPoolInit
2019-07-15 11:25:01 +02:00
selansen
88578aa9e9
TestServiceWithDefaultAddressPoolInit
Looks like TestServiceWithDefaultAddressPoolInit is failing
randomly in CI. I am not able to reproduce the issue locally
but this has been reported few times.  So I tried to modify
code and see if I can fix the random failure.

Signed-off-by: selansen <elango.siva@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-14 20:02:46 +02:00
Brian Goff
f8aef6a92f
Move kill health test to integration
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-07-14 11:53:21 +02:00
Sebastiaan van Stijn
316e16618f
Integration: MACVlan add missing import comment and build-tag
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-13 13:35:21 +02:00
Sebastiaan van Stijn
691eb14256
Integration: remove redundant kernel version check for MACVlan
The daemon requires kernel 3.10 or up to start, so there's no need
to check if the daemon is kernel 3.8 or up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-13 13:35:18 +02:00
Sebastiaan van Stijn
4060a7026c
Integration: exclude IPVlan test-suite on Windows
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-11 10:39:04 +02:00
Sebastiaan van Stijn
93b28677bf
Integration: IPVlan add missing import comment
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-11 10:09:52 +02:00
Sebastiaan van Stijn
dae9bac675
Integration: remove "experimental" option for IPVLAN test-daemons
IPVLAN no longer is experimental since 3ab093d567,
so there's no need to set this option.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-11 10:04:04 +02:00
Sebastiaan van Stijn
1e4bd2623a
Integration: remove unneeded platform check for IPVLAN tests
These tests require a local daemon, and are not built on Windows

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-11 10:04:00 +02:00
Michael Crosby
fb459f6671
Merge pull request #38441 from sirlatrom/swarm_plugin_env
Allow specifying environment variables when installing an engine plugin as a Swarm service
2019-07-08 15:26:55 -04:00
Michael Crosby
b94218560e Skip TestServiceRemoveKeepsIngressNetwork
Ref: #39426

This is a common flaky test that I have seen on multiple PRs.  It is not
consistent and should be skipped until it is fixed to be robust.  A
simple fix for the swarm tests is not easy as they all poll and have 1
billion timeouts in all the tests so a skip is valid here.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-02 16:33:25 -04:00
Kirill Kolyshkin
67be90dcec
Merge pull request #39358 from jim-docker/testForIpvlan
For ipvlan tests, check that the ipvlan module is there, rather than just testing the kernel version.
2019-06-24 15:33:19 -07:00
Tibor Vass
f923321aae Add test for keeping same daemon ID on upgrade
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-18 01:40:25 +00:00
Tibor Vass
f23a51a860 Revert "Remove Schema1 integration test suite"
This reverts commit 13b7d11be1.

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-18 00:23:04 +00:00
Kir Kolyshkin
a77e147d32 For ipvlan tests check that the ipvlan module is enabled (instead of just ensuring the kernel version is greater than 4.2)
Co-Authored-By: Jim Ehrismann <jim-docker@users.noreply.github.com>
Co-Authored-By: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
Signed-off-by: Jim Ehrismann <jim.ehrismann@docker.com>
2019-06-14 10:49:25 -04:00
Tibor Vass
02f1eb89a4 add more tests
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-13 06:31:05 +00:00
Brian Goff
6db9f1c3d6 Add test for copying entire container rootfs
CID=$(docker create alpine)
docker cp $CID:/ out

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-12 22:17:18 +00:00
Tibor Vass
a281289515 integration: get tests to compile again
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-12 20:41:36 +00:00
Sebastiaan van Stijn
04ff4a2ba4
Merge pull request #39137 from arkodg/attach-to-existing-network-error
Handle the error case when a container reattaches to the same network
2019-06-12 19:58:04 +02:00
Brian Goff
02dceeaa7b
Merge pull request #39240 from olljanat/enable-new-integration-tests-for-win
Enable integrations API tests for Windows CI
2019-06-11 14:24:03 -07:00
Sebastiaan van Stijn
e511b3be89
Merge pull request #39336 from justincormack/entropy-cannot-be-saved
Entropy cannot be saved
2019-06-11 18:40:19 +02:00
Olli Janatuinen
2f22247cad Enable integrations API tests for Windows CI
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-06-10 21:32:36 +03:00
Yong Tang
b10cd5c0e6
Merge pull request #39332 from thaJeztah/fix_golint_again
Integration: change signatures to fix golint warnings
2019-06-07 06:46:58 -07:00
Sebastiaan van Stijn
66f8f2b87c
Merge pull request #39193 from olljanat/38488-layer-garbage-collector
Added garbage collector for image layers
2019-06-07 14:08:04 +02:00
Sebastiaan van Stijn
dac5710b68
integration: change testGraphDriver signature to fix linting
Line 441: warning: context.Context should be the first parameter of a function (golint)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 13:05:51 +02:00
Sebastiaan van Stijn
123e29f44a
integration: change createAmbiguousNetworks signature to fix linting
Line 30: warning: context.Context should be the first parameter of a function (golint)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 13:05:43 +02:00
Sebastiaan van Stijn
9f9b4290b9
integration: change container.Run signature to fix linting
Line 59: warning: context.Context should be the first parameter of a function (golint)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 13:05:26 +02:00
Sebastiaan van Stijn
b4c46b0dac
integration: change container.Create signature to fix linting
```
Line 25: warning: context.Context should be the first parameter of a function (golint)
Line 44: warning: context.Context should be the first parameter of a function (golint)
Line 52: warning: context.Context should be the first parameter of a function (golint)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 13:04:44 +02:00
Sebastiaan van Stijn
caec45a37f
integration: change network.CreateNoError signature to fix linting
Line 30: warning: context.Context should be the first parameter of a function (golint)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 13:03:24 +02:00
Justin Cormack
2df693e533
Entropy cannot be saved
Remove non cryptographic randomness.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2019-06-07 11:54:45 +01:00
Kirill Kolyshkin
1d5748d975
Merge pull request #39173 from olljanat/25885-capabilities-swarm
Add support for capabilities options in services
2019-06-06 15:03:46 -07:00
Olli Janatuinen
213681b66a First step to implement full garbage collector for image layers
Refactored exiting logic on way that layers are first marked to be under
removal so if actual removal fails they can be found from disk and
cleaned up.

Full garbage collector will be implemented as part of containerd
migration.

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-06-05 22:02:42 +03:00
Tibor Vass
54043d2f6f
Merge pull request #39281 from dperny/vendor-swarmkit
Revert docker/swarmkit#2804
2019-06-04 10:28:42 -07:00
Drew Erny
c7d9599e3d Revert docker/swarmkit#2804
Reverts the change to swarmkit that made all updates set UpdateStatus to
Completed

Signed-off-by: Drew Erny <drew.erny@docker.com>
2019-05-29 12:54:39 -05:00
Olli Janatuinen
f787b235de Add support capabilities list on services
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-05-28 19:52:36 +03:00
Olli Janatuinen
a3fcd4b82a Add alias for hostname if hostname != container
name which happens if user manually specify hostname

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-05-22 20:20:43 +03:00
Yong Tang
3042254a87
Merge pull request #38377 from rgulewich/38332-cgroup-ns
Start containers in their own cgroup namespaces
2019-05-11 20:18:31 -07:00
Rob Gulewich
072400fc4b Make cgroup namespaces configurable
This adds both a daemon-wide flag and a container creation property:
- Set the `CgroupnsMode: "host|private"` HostConfig property at
  container creation time to control what cgroup namespace the container
  is created in
- Set the `--default-cgroupns-mode=host|private` daemon flag to control
  what cgroup namespace containers are created in by default
- Set the default if the daemon flag is unset to "host", for backward
  compatibility
- Default to CgroupnsMode: "host" for client versions < 1.40

Signed-off-by: Rob Gulewich <rgulewich@netflix.com>
2019-05-07 10:22:16 -07:00
Rob Gulewich
256eb04d69 Start containers in their own cgroup namespaces
This is enabled for all containers that are not run with --privileged,
if the kernel supports it.

Fixes #38332

Signed-off-by: Rob Gulewich <rgulewich@netflix.com>
2019-05-07 10:22:16 -07:00
Arko Dasgupta
680d0ba4ab Remove a network during task SHUTDOWN instead of REMOVE to
make sure the LB sandbox is removed when a service is updated
with a --network-rm option

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-05-06 20:26:59 -07:00
Arko Dasgupta
871acb1c86 Gracefully take care of the error case when a container
retries to attach to a network, it is already connected to

Fixes - https://github.com/docker/for-linux/issues/632

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-04-26 15:58:58 -07:00
Kir Kolyshkin
1ada1c8391 TestIpcModeOlderClient: skip if client < 1.40
This test case requires not just daemon >= 1.40, but also
client API >= 1.40. In case older client is used, we'll
get failure from the very first check:

> ipcmode_linux_test.go:313: assertion failed: shareable (string) != private (string)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-04-25 19:19:44 -07:00
Sebastiaan van Stijn
83ac2b4c13
Skip TestImagesFilterMultiReference on API < v1.40
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:52:21 -07:00
Sebastiaan van Stijn
05bd9958f2
Skip TestUUIDGeneration on API < v1.40
Older versions did not use an UUID as ID

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:52:13 -07:00
Sebastiaan van Stijn
d080a866cc
Skip TestPingCacheHeaders on API < v1.40
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:52:10 -07:00
Sebastiaan van Stijn
0e7b46aafe
Skip TestBuildWithEmptyDockerfile on API < v1.40
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:52:07 -07:00
Sebastiaan van Stijn
566eea13e6
Fix TestVolumesCreateAndList when running against a shared daemon
The daemon may already have other volumes, so filter out those
when running the test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:52:03 -07:00
Sebastiaan van Stijn
c91c3776ea
Skip TestNISDomainname on API < 1.40
Older versions of the daemon would concatenate hostname and
domainname, so hostname "foobar" and domainname "baz.cyphar.com"
would produce `foobar.baz.cyphar.com` as hostname.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:51:57 -07:00
Sune Keller
fca5ee3bd5 Support environment vars in Swarm plugins services
Allow specifying environment variables when installing an engine plugin
as a Swarm service. Invalid environment variable entries (without an
equals (`=`) char) will be ignored.

Signed-off-by: Sune Keller <absukl@almbrand.dk>
2019-04-07 09:48:19 +02:00
Tõnis Tiigi
7a337ec3c4
Merge pull request #38990 from tiborvass/http-grpc
Add undocumented /grpc endpoint and register BuildKit's controller
2019-04-02 18:13:13 -07:00
Tibor Vass
e8382ece65 api: add undocumented /grpc endpoint to talk to GRPC services
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-04-02 19:57:59 +00:00
Sebastiaan van Stijn
23fec5025d
Temporarily disable TestCheckpoint
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-01 22:07:48 +02:00
Yong Tang
5635c248cd
Merge pull request #38871 from crosbymichael/exec-spec
Use original process spec for execs
2019-03-25 11:58:33 +08:00
Tibor Vass
29de017df7
Merge pull request #38599 from thaJeztah/builder_fix_copy_permissions
builder: fix `COPY --from` should preserve ownership
2019-03-22 09:38:13 -07:00
Kirill Kolyshkin
3764bd9e98
Merge pull request #38182 from huangqg/fix_log
integration/network: fix log message
2019-03-21 14:36:21 -07:00
Tõnis Tiigi
25661a3a04
Merge pull request #38793 from thaJeztah/pids_limit_improvements
Some refactoring on PidsLimit
2019-03-21 13:44:05 -07:00
Michael Crosby
7603c22c73 Use original process spec for execs
Fixes #38865

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-03-21 15:41:53 -04:00
Sebastiaan van Stijn
ae875d4069
Update more tests to use new errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-16 00:41:02 +01:00
Sebastiaan van Stijn
ca0b64ee3b
Merge pull request #35621 from kolyshkin/ipc-private
daemon: use 'private' ipc mode by default
2019-03-14 19:27:30 +01:00
Tibor Vass
5b6771345a
Merge pull request #38875 from thaJeztah/revert_38518-docker_info_builder_version
Revert "Adding builder version"
2019-03-14 10:55:44 -07:00
Sebastiaan van Stijn
f73dd5fdad
Revert "Adding builder version"
This reverts commit f821f002e5.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-14 00:18:46 +01:00
Justin Cormack
c435551ccc
Switch to google/uuid
pborman/uuid and google/uuid used to be different versions of
the same package, but now pborman/uuid is a compatibility wrapper
around google/uuid, maintained by the same person.

Clean up some of the usage as the functions differ slightly.

Not yet removed some uses of pborman/uuid in vendored code but
I have PRs in process for these.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2019-03-13 14:13:58 +00:00
Sebastiaan van Stijn
6d87f19142
builder: fix COPY --from should preserve ownership
When copying between stages, or copying from an image,
ownership of the copied files should not be changed, unless
the `--chown` option is set (in which case ownership of copied
files should be updated to the specified user/group).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-13 00:55:04 +01:00
Sebastiaan van Stijn
1101568fa1
Update TestUpdatePidsLimit to be more atomic
Create a new container for each subtest, so that individual
subtests are self-contained, and there's no need to execute
them in the exact order, or resetting the container in between.

This makes the test slower (6.54s vs  3.43s), but reduced the
difference by using `network=host`, which made a substantial
difference (without `network=host`, the test took more than
twice as long: 13.96s).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-13 00:27:15 +01:00
Sebastiaan van Stijn
ffa1728d4b
Normalize values for pids-limit
- Don't set `PidsLimit` when creating a container and
  no limit was set (or the limit was set to "unlimited")
- Don't set `PidsLimit` if the host does not have pids-limit
  support (previously "unlimited" was set).
- Do not generate a warning if the host does not have pids-limit
  support, but pids-limit was set to unlimited (having no
  limit set, or the limit set to "unlimited" is equivalent,
  so no warning is nescessary in that case).
- When updating a container, convert `0`, and `-1` to
  "unlimited" (`0`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-13 00:27:05 +01:00
Kir Kolyshkin
596ca142e0 daemon: use 'private' ipc mode by default
This changes the default ipc mode of daemon/engine to be private,
meaning the containers will not have their /dev/shm bind-mounted
from the host by default. The benefits of doing this are:

 1. No leaked mounts. Eliminate a possibility to leak mounts into
    other namespaces (and therefore unfortunate errors like "Unable to
    remove filesystem for <ID>: remove /var/lib/docker/containers/<ID>/shm:
    device or resource busy").

 2. Working checkpoint/restore. Make `docker checkpoint`
    not lose the contents of `/dev/shm`, but save it to
    the dump, and be restored back upon `docker start --checkpoint`
    (currently it is lost -- while CRIU handles tmpfs mounts,
    the "shareable" mount is seen as external to container,
    and thus rightfully ignored).

3. Better security. Currently any container is opened to share
   its /dev/shm with any other container.

Obviously, this change will break the following usage scenario:

 $ docker run -d --name donor busybox top
 $ docker run --rm -it --ipc container:donor busybox sh
 Error response from daemon: linux spec namespaces: can't join IPC
 of container <ID>: non-shareable IPC (hint: use IpcMode:shareable
 for the donor container)

The soution, as hinted by the (amended) error message, is to
explicitly enable donor sharing by using --ipc shareable:

 $ docker run -d --name donor --ipc shareable busybox top

Compatibility notes:

1. This only applies to containers created _after_ this change.
   Existing containers are not affected and will work fine
   as their ipc mode is stored in HostConfig.

2. Old backward compatible behavior ("shareable" containers
   by default) can be enabled by either using
   `--default-ipc-mode shareable` daemon command line option,
   or by adding a `"default-ipc-mode": "shareable"`
   line in `/etc/docker/daemon.json` configuration file.

3. If an older client (API < 1.40) is used, a "shareable" container
   is created. A test to check that is added.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-09 18:57:42 -08:00
Kir Kolyshkin
9fd765f07c TestDaemonRestartIpcMode: modernize
Move the test case from integration-cli to integration.

The test logic itself has not changed, except these
two things:

* the new test sets default-ipc-mode via command line
  rather than via daemon.json (less code);
* the new test uses current API version.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-08 10:04:43 -08:00
Kir Kolyshkin
f664df01d1 integration: add/use WithRestartPolicy
NOTE TestUpdateRestartPolicy is left as is as otherwise
it will decrease its readability.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-08 10:03:55 -08:00
Kir Kolyshkin
17022b3ad2 integration/internal/container/ops: rm unused code
Since container.Create() already initializes HostConfig
to be non-nil, there is no need for this code. Remove it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-08 10:00:14 -08:00
Kir Kolyshkin
39eaf1ef97 TestUpdateRestartWithAutoRemove: use WithAutoRemove
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-08 09:59:22 -08:00
Sebastiaan van Stijn
54dddadc7d
Merge pull request #38452 from avagin/cr-test
integration/container: add a base test for C/R
2019-03-07 01:54:17 +01:00
Brian Goff
13b7d11be1 Remove Schema1 integration test suite
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-03-02 10:46:37 -08:00
Andrei Vagin
bd4fff38cc integration/container: add a base test for C/R
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-02-28 23:04:16 -08:00
Yong Tang
ed681c5c0d
Merge pull request #38805 from thaJeztah/better_polling
Add more details to RunningTasksCount
2019-02-28 08:47:16 -08:00
Sebastiaan van Stijn
91d934b41b
Merge pull request #38791 from thaJeztah/update_api_changes
Fix container update resetting pidslimit on older API clients
2019-02-27 23:30:18 +01:00
Sebastiaan van Stijn
67d6f174ae
Add more details to RunningTasksCount
Provide slightly better information about the current state
of tasks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-27 17:08:44 +01:00
Brian Goff
95faf3582c
Merge pull request #38428 from thaJeztah/only_create_new_daemon_if_needed
Testing: create new daemon (only) if needed
2019-02-25 22:20:05 -08:00
Sebastiaan van Stijn
5861a0db22
Fix container update resetting pidslimit on older API clients
Older API clients did not use a pointer for `PidsLimit`, so
API requests would always send `0`, resulting in any previous
value to be reset after an update:

Before this patch:

(using a 17.06 Docker CLI):

```bash
docker run -dit --name test --pids-limit=16 busybox
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16

docker container update --memory=100M --memory-swap=200M test

docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
0

docker container exec test cat /sys/fs/cgroup/pids/pids.max
max
```

With this patch applied:

(using a 17.06 Docker CLI):

```bash
docker run -dit --name test --pids-limit=16 busybox
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16

docker container update --memory=100M --memory-swap=200M test

docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16

docker container exec test cat /sys/fs/cgroup/pids/pids.max
16
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-24 16:32:32 +01:00
Sebastiaan van Stijn
dd94555787
Merge pull request #32519 from darkowlzz/32443-docker-update-pids-limit
Add pids-limit support in docker update
2019-02-23 15:20:59 +01:00
Sebastiaan van Stijn
b3407d2029
Testing: create new daemon (only) if needed
Some tests were skipped if the local daemon did not have
experimental features enabled; at the same time, some tests
unconditionally created a new (experimental) daemon, even if
the local daemon already had experimental enabled.

This patch;

- Checks if the "testEnv" is an experimental Linux daemon
- If not, and the daemon is running locally; spin up a new
  experimental daemon to be used during the test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-23 13:32:59 +01:00
Sunny Gogoi
74eb258ffb Add pids-limit support in docker update
- Adds updating PidsLimit in UpdateContainer().
- Adds setting PidsLimit in toContainerResources().

Signed-off-by: Sunny Gogoi <indiasuny000@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-02-21 14:17:38 -08:00
Brian Goff
e063099f91 Completely remove d.NewClient from testing tools
Favor `d.NewClientT` instead.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-02-07 16:07:02 -08:00
Sebastiaan van Stijn
94429d4078
Remove use of serviceSpecIsUpdated
It's no longer needed with the latest swarmkit changes

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-01 01:35:41 +01:00
Yong Tang
87903f2fb5
Merge pull request #38609 from kwojcicki/enhancement/38518-docker_info_builder_version
Adding builder version
2019-02-01 07:04:11 +08:00
Sebastiaan van Stijn
7e7e100be0
Add HEAD support for /_ping endpoint
Monitoring systems and load balancers are usually configured to use HEAD
requests for health monitoring. The /_ping endpoint currently does not
support this type of request, which means that those systems have fallback
to GET requests.

This patch adds support for HEAD requests on the /_ping endpoint.

Although optional, this patch also returns `Content-Type` and `Content-Length`
headers in case of a HEAD request; Refering to RFC 7231, section 4.3.2:

    The HEAD method is identical to GET except that the server MUST NOT
    send a message body in the response (i.e., the response terminates at
    the end of the header section).  The server SHOULD send the same
    header fields in response to a HEAD request as it would have sent if
    the request had been a GET, except that the payload header fields
    (Section 3.3) MAY be omitted.  This method can be used for obtaining
    metadata about the selected representation without transferring the
    representation data and is often used for testing hypertext links for
    validity, accessibility, and recent modification.

    A payload within a HEAD request message has no defined semantics;
    sending a payload body on a HEAD request might cause some existing
    implementations to reject the request.

    The response to a HEAD request is cacheable; a cache MAY use it to
    satisfy subsequent HEAD requests unless otherwise indicated by the
    Cache-Control header field (Section 5.2 of [RFC7234]).  A HEAD
    response might also have an effect on previously cached responses to
    GET; see Section 4.3.5 of [RFC7234].

With this patch applied, either `GET` or `HEAD` requests work; the only
difference is that the body is empty in case of a `HEAD` request;

    curl -i --unix-socket /var/run/docker.sock http://localhost/_ping
    HTTP/1.1 200 OK
    Api-Version: 1.40
    Cache-Control: no-cache, no-store, must-revalidate
    Docker-Experimental: false
    Ostype: linux
    Pragma: no-cache
    Server: Docker/dev (linux)
    Date: Mon, 14 Jan 2019 12:35:16 GMT
    Content-Length: 2
    Content-Type: text/plain; charset=utf-8

    OK

    curl --head -i --unix-socket /var/run/docker.sock http://localhost/_ping
    HTTP/1.1 200 OK
    Api-Version: 1.40
    Cache-Control: no-cache, no-store, must-revalidate
    Content-Length: 0
    Content-Type: text/plain; charset=utf-8
    Docker-Experimental: false
    Ostype: linux
    Pragma: no-cache
    Server: Docker/dev (linux)
    Date: Mon, 14 Jan 2019 12:34:15 GMT

The client is also updated to use `HEAD` by default, but fallback to `GET`
if the daemon does not support this method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-31 18:18:24 +01:00
Yong Tang
393838ca5e
Merge pull request #38569 from thaJeztah/forget_about_it
Add Cache-Control headers to disable caching /_ping endpoint
2019-01-31 23:59:11 +08:00
Vincent Demeester
8b10292153
Merge pull request #38644 from yongtang/fatalf
Fatalf -> Fatal
2019-01-28 20:19:38 +01:00
Sebastiaan van Stijn
5801c04345
Merge pull request #38380 from olljanat/capabilities-support
Add support for exact list of capabilities + capAdd / capDrop refactor
2019-01-28 16:36:03 +01:00
Yong Tang
f04e8bb075 Fatalf -> Fatal
This is a small fix to replace Fatalf -> Fatal

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-27 00:43:24 +00:00
Vincent Demeester
de86ba27fb
Merge pull request #38598 from yongtang/serviceRunningTasksCount
Move serviceRunningTasksCount to integration/internal/swarm
2019-01-23 17:41:40 +01:00
Olli Janatuinen
80d7bfd54d Capabilities refactor
- Add support for exact list of capabilities, support only OCI model
- Support OCI model on CapAdd and CapDrop but remain backward compatibility
- Create variable locally instead of declaring it at the top
- Use const for magic "ALL" value
- Rename `cap` variable as it overlaps with `cap()` built-in
- Normalize and validate capabilities before use
- Move validation for conflicting options to validateHostConfig()
- TweakCapabilities: simplify logic to calculate capabilities

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-22 21:50:41 +02:00
Krystian Wojcicki
f821f002e5 Adding builder version
Signed-off-by: Krystian Wojcicki <kwojcicki@sympatico.ca>
2019-01-21 19:02:16 -05:00
Sebastiaan van Stijn
3449b12cc7
Use assert.NilError() instead of assert.Assert()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-21 13:16:02 +01:00
Yong Tang
e485a60e2b Move serviceRunningTasksCount to integration/internal/swarm
This fix moves multiple places of serviceRunningTasksCount
to one location in integration/internal/swarm, so that
code duplication could be removed.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-19 18:54:32 +00:00
Brian Goff
5ec31380a5
Merge pull request #38481 from thaJeztah/run_volume_tests_remotely
Run volume-tests again remote daemons as well
2019-01-15 14:09:18 -08:00
Sebastiaan van Stijn
bba833928c
Merge pull request #38487 from LinuxMercedes/error-on-empty-dockerfile
Error on empty dockerfile
2019-01-15 21:41:12 +01:00
Vincent Demeester
cd60e8a752
Merge pull request #38547 from yongtang/waitAndAssert
Replace waitAndAssert in config_test.go with poll.WaitOn
2019-01-15 15:27:19 +01:00
Sebastiaan van Stijn
e21f50cbf0
Merge pull request #38572 from yongtang/assert.NilError
Replace t.Fatal(err) with assert.NilError(t, err)
2019-01-15 15:16:57 +01:00
Vincent Demeester
b5be9f63eb
Merge pull request #38567 from thaJeztah/use_the_skip
TestCgroupDriverSystemdMemoryLimit: use skip.If()
2019-01-15 09:10:57 +01:00
Vincent Demeester
38015177d8
Merge pull request #38557 from thaJeztah/remove_duplicated_code
Integration tests: remove some duplicated code, and preserve context
2019-01-15 09:03:45 +01:00
Yong Tang
52475f8dd5 Replace t.Fatal(err) with assert.NilError(t, err)
So that they are consistent with integration tests style

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-15 04:58:30 +00:00
Yong Tang
68e266ee3a Replace waitAndAssert in config_test.go with poll.WaitOn
This fix replaces waitAndAssert in config_test.go with poll.WaitOn
so that the testing is consistent with all other tests in integration.

Also, config_test.go uses to wait and sleep for 2 * (1 minutes) to get the task
info. This fix combined those two sleep and wait for 1 mins. Think 1 min
is enough for config test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-15 03:54:52 +00:00
linuxmercedes
18c7e8b927 Test: dockerfiles with no instructions are detected
Signed-off-by: Natasha Jarus <linuxmercedes@gmail.com>
2019-01-14 20:01:00 -06:00
Akihiro Suda
8472e04f79
Merge pull request #38555 from yongtang/assert.NilError
Replace t.Fatal(err) with assert.NilError(err)
2019-01-15 10:51:42 +09:00
Sebastiaan van Stijn
5f788fbf56
Add Cache-Control headers to disable caching /_ping endpoint
The result of this endpoint should not be cached, so it's better to
explicitly disable caching.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-14 22:03:23 +01:00
Sebastiaan van Stijn
c11be31710
TestCgroupDriverSystemdMemoryLimit: use skip.If()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-14 17:11:36 +01:00
Brian Goff
beef00cb26
Merge pull request #38558 from thaJeztah/pass_client_instead_of_daemon
GetRunningTasks: pass client instead of daemon
2019-01-14 03:50:15 -08:00
Sebastiaan van Stijn
a3f626d101
Merge pull request #38543 from thaJeztah/save_the_environment
Fix: plugin-tests discarding current environment
2019-01-14 10:36:11 +01:00
Sebastiaan van Stijn
56a68c15f8
Integration tests: remove some duplicated code, and preserve context
This introduces `NoTasksForService` and `NoTasks` poller checks, that
can be used to check if no tasks are left in general, or for a specific
service.

Some redundant checks were also removed from some tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-14 04:53:27 +01:00
Sebastiaan van Stijn
60d93aab2e
Refactor TestInspectNetwork
Clean up and refactor this test;

- make `serviceRunningTasksCount` to use a `desired-state` filter
- use subtests, and inline the `validNetworkVerbose` checks; also use
  asserts for the individual checks, so that any failure will log exactly
  what failed
- remove helper functions that are no longer needed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-14 04:30:17 +01:00
Sebastiaan van Stijn
8172edf04c
GetRunningTasks: pass client instead of daemon
Tests generally already have a client instance, so it
probably makes more sense to just pass it, and make
this utility a bit more flexible to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-14 02:30:40 +01:00
Yong Tang
32f6aeee8a Replace t.Fatal(err) with assert.NilError(err)
so that they are consistent with other places

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-13 21:36:25 +00:00
Yong Tang
28b7824caa Remove code duplication and consolidate networkIsRemoved
This fix removes code duplication and consolidates networkIsRemoved
into one place.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-12 23:01:21 +00:00
Sebastiaan van Stijn
b84bff7f8a
Fix: plugin-tests discarding current environment
By default, exec uses the environment of the current process, however,
if `exec.Env` is not `nil`, the environment is discarded:

e73f489494/src/os/exec/exec.go (L57-L60)

> If Env is nil, the new process uses the current process's environment.

When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-12 13:06:25 +01:00
Sebastiaan van Stijn
2a5405bedd
Run volume-tests again remote daemons as well
These tests should not require a local daemon; they may fail if
the local and remote system's clocks are out of sync with more
than a minute though, but that's something we should prevent from
happening :-)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-10 10:18:22 +01:00
Sebastiaan van Stijn
3f2ecb5452
Merge pull request #38515 from yongtang/01082019-oll.WaitOn
Use poll.WaitOn in authz_plugin_test.go
2019-01-09 16:10:52 +01:00
Sebastiaan van Stijn
156b2abd0c
Merge pull request #38472 from thaJeztah/remove_debugging_code
TestBuildMultiStageParentConfig: remove unneeded sleep and ImageList call
2019-01-09 08:41:01 +01:00
Brian Goff
9dd43415ae
Merge pull request #38499 from olljanat/change_serviceIsUpdated2
Fix flaky test TestServiceUpdateSecrets
2019-01-08 20:46:28 -08:00
Yong Tang
0492b0997b Use poll.WaitOn in authz_plugin_test.go
This fix uses poll.WaitOn to replace customerized
implementation in authz_plugin_test.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-09 03:08:47 +00:00
Olli Janatuinen
b868ada474 integration: Corrected service update tests logic
Tests which will re-deploy containers uses function serviceIsUpdated() to
make sure that service update really reached state UpdateStateCompleted.

Tests which will not re-deploy container uses function
serviceSpecIsUpdated to make sure that service version is increased.

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-01-08 20:01:29 +02:00
Sebastiaan van Stijn
263e28a830
Fix some minor wording / issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-07 13:57:01 +01:00
Sebastiaan van Stijn
69c0b7e476
Simplify skip checks
These tests are run on a local Linux daemon only, so no need
to do a platform-check.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-07 13:56:57 +01:00
Sebastiaan van Stijn
84224935ea
Only build IPCmode tests on Linux
These tests can only be run on a local Linux daemon, so there's
no need to build them on Windows

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-07 13:56:52 +01:00
Sebastiaan van Stijn
a3948d17d3
Improve consistency in "skip"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-07 13:56:46 +01:00
Yong Tang
545d00e752
Merge pull request #38416 from thaJeztah/fix_build_session_test
Fix TestBuildWithSession, TestBuildSquashParent using wrong daemon during test
2019-01-06 14:29:15 -08:00
Akihiro Suda
f5238762a8
Merge pull request #38480 from thaJeztah/run_slow_test_parallel
Run TestImportExtremelyLargeImageWorks in parallel
2019-01-07 00:37:47 +09:00
Sebastiaan van Stijn
8edcd4c3cd integration: wait for service update to be completed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-05 15:07:12 +02:00
Sebastiaan van Stijn
2ee53a42db
Merge pull request #38490 from kolyshkin/test-rename-anon-ct
TestRenameAnonymousContainer: fix error msg
2019-01-05 12:50:16 +01:00
Sebastiaan van Stijn
55b5b8de79
Merge pull request #38486 from thaJeztah/dont_use_deprecated_envclient
Remove use of deprecated client.NewEnvClient()
2019-01-05 11:23:19 +01:00
Yong Tang
b958b430aa
Merge pull request #38417 from thaJeztah/replace_newclient
Test: Replace NewClient() with NewClientT()
2019-01-04 23:37:00 -08:00
Sebastiaan van Stijn
ae3ca7bb97
Run TestImportExtremelyLargeImageWorks in parallel
This is a slow test, taking over two minutes to complete,
so spin up a new daemon for this test and run it in parallel

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-04 01:51:52 +01:00
Kir Kolyshkin
2ca6896aee TestRenameAnonymousContainer: fix error msg
A recent CI run shows a (seemingly random) failure from this test:

> 00:14:37.289 --- FAIL: TestRenameAnonymousContainer (1.75s)
> 00:14:37.289 rename_test.go:169: assertion failed: 0 (int) != 1 (inspect.State.ExitCode int): container baac251d5a1cb2221ffedf6f10acbad166b90e3549601e96d908e76762675a81 exited with the wrong exitcode: {ContainerJSONBase:0xc0007a4840 Mounts:[] Config:0xc000714500 NetworkSettings:0xc000235b00}

Apparently, printing the whole `inspect` value does not make any sense.
Let's output `inspect.State.Error` instead, maybe it will help to
figure out what is going on here.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-01-03 14:01:17 -08:00
Sebastiaan van Stijn
c8ff5ecc09
Remove use of deprecated client.NewEnvClient()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-03 22:49:00 +01:00
Sebastiaan van Stijn
0de62d9bbc
Integration: use testenv.APIClient()
A client is already created in testenv.New(), so we can just
as well use that one, instead of creating a new client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-03 11:53:41 +01:00
Sebastiaan van Stijn
4d88a95d67
Don't mix t.Parallel() wth environment.ProtectAll()
`testEnv` is a package-level variable, so protecting / restoring
`testEnv` in parallel will result in "concurrent map write" errors.

This patch removes `t.Parallel()` from tests that use this
functionality (through `defer setupTest(t)()`).

Note that _subtests_ can still be run in parallel, as the defer
will be called after all subtests have completed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-03 11:53:31 +01:00
Vincent Demeester
3f7898cfcd
Merge pull request #38451 from thaJeztah/skip_test_info_warnings
Skip TestInfoAPIWarnings on remote daemons
2019-01-03 11:00:53 +01:00
Sebastiaan van Stijn
f9fedf1308
TestBuildMultiStageParentConfig: remove unneeded sleep and ImageList call
The `time.Sleep()` and `apiclient.ImageList()` were added in d3cc071bb9,
but appear to be debugging-code and not needed for the test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-02 13:50:09 +01:00
Akihiro Suda
27234ffe3e
Merge pull request #37564 from adshmh/migrate-docker_cli_service_update_test-to-integration-service-fixed-flake
migrate service update integration tests from integration-cli to integration/service package
2019-01-01 04:12:10 +09:00
Sebastiaan van Stijn
056840c2a6
Skip TestInfoAPIWarnings on remote daemons
This test starts a new daemon, which will fail when testing
against a remote daemon;

    --- FAIL: TestInfoAPIWarnings (0.00s)
        info_test.go:53: failed to start daemon with arguments [-H=0.0.0.0:23756 -H=unix:///tmp/docker-integration/d5153ebcf89ef.sock] : [d5153ebcf89ef] could not find docker binary in $PATH: exec: "dockerd": executable file not found in $PATH

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-29 20:46:33 +01:00
Sebastiaan van Stijn
53bb992c3b
Merge pull request #38445 from thaJeztah/dont_use_deprecated_withdialer
Replace deprecated client.WithDialer()
2018-12-29 10:47:22 +01:00
Sebastiaan van Stijn
8d3feccfa9
Replace deprecated client.WithDialer()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-28 16:10:32 +01:00
Arash Deshmeh
be151a73f0
migrated service integration tests from integration-cli/docker_cli_service_update_test.go to integration/service
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-24 20:28:00 +01:00
Sebastiaan van Stijn
9a3911ced8
Fix TestBuildWithSession, TestBuildSquashParent using wrong daemon during test
These tests were spinning up a new daemon, but after the daemon was spun up,
the default test-daemon was used by the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-24 13:03:54 +01:00
Olli Janatuinen
153171e9dd Added support for maximum replicas per node to services
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-12-24 02:04:15 +02:00
Sebastiaan van Stijn
2cb7b73a1b
Test: Replace NewClient() with NewClientT()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-22 15:53:02 +01:00
Brian Goff
3e44f58966
Merge pull request #38142 from thaJeztah/fix_api_return_code
API: Add test for status code on conflicting service names
2018-12-10 15:40:42 -08:00
Aleksa Sarai
f38ac72bca
oci: add integration tests for kernel.domainname configuration
This also includes a few refactors of oci_linux_test.go.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-11-30 19:44:50 +11:00
Yong Tang
ee74cd777a Skip KernelMemoryTCP if version is less than 1.40
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-11-26 21:04:27 +00:00
Yong Tang
f023816608 Add memory.kernelTCP support for linux
This fix tries to address the issue raised in 37038 where
there were no memory.kernelTCP support for linux.

This fix add MemoryKernelTCP to HostConfig, and pass
the config to runtime-spec.

Additional test case has been added.

This fix fixes 37038.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-11-26 21:03:08 +00:00
Sebastiaan van Stijn
b0de11cf30
Add test for status code on conflicting service names
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-24 11:53:08 +01:00
Sebastiaan van Stijn
0b7cb16dde
Merge pull request #38102 from selansen/master
VXLAN UDP Port configuration support
2018-11-24 11:50:10 +01:00
selansen
32180ac0c7 VXLAN UDP Port configuration support
This commit contains changes to configure DataPathPort
option. By default we use 4789 port number. But this commit
will allow user to configure port number during swarm init.
DataPathPort can't be modified after swarm init.
Signed-off-by: selansen <elango.siva@docker.com>
2018-11-22 17:35:02 -05:00
zhangyue
5007c36d71 cli: fix images filter when use multi reference filter
Signed-off-by: zhangyue <zy675793960@yeah.net>
2018-11-22 10:33:45 +08:00
maxwell
317f5e0edc Fix log
Signed-off-by: maxwell <csuhp007@gmail.com>
2018-11-11 23:07:43 +08:00
Sebastiaan van Stijn
06a4fd5009
Merge pull request #38141 from thaJeztah/handle_invalid_json
API: properly handle invalid JSON to return a 400 status
2018-11-08 12:22:02 +01:00
Sebastiaan van Stijn
c7b488fbc8
API: properly handle invalid JSON to return a 400 status
The API did not treat invalid JSON payloads as a 400 error, as a result
returning a 500 error;

Before this change, an invalid JSON body would return a 500 error;

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json" \
  -d '{invalid json'
```

```
> POST /v1.30/networks/create HTTP/1.1
> Host: localhost
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 13
>
* upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 500 Internal Server Error
< Api-Version: 1.40
< Content-Type: application/json
< Docker-Experimental: false
< Ostype: linux
< Server: Docker/dev (linux)
< Date: Mon, 05 Nov 2018 11:55:20 GMT
< Content-Length: 79
<
{"message":"invalid character 'i' looking for beginning of object key string"}
```

Empty request:

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json"
```

```
> POST /v1.30/networks/create HTTP/1.1
> Host: localhost
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 500 Internal Server Error
< Api-Version: 1.38
< Content-Length: 18
< Content-Type: application/json
< Date: Mon, 05 Nov 2018 12:00:18 GMT
< Docker-Experimental: true
< Ostype: linux
< Server: Docker/18.06.1-ce (linux)
<
{"message":"EOF"}
```

After this change, a 400 is returned;

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json" \
  -d '{invalid json'
```

```
> POST /v1.30/networks/create HTTP/1.1
> Host: localhost
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 13
>
* upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 400 Bad Request
< Api-Version: 1.40
< Content-Type: application/json
< Docker-Experimental: false
< Ostype: linux
< Server: Docker/dev (linux)
< Date: Mon, 05 Nov 2018 11:57:15 GMT
< Content-Length: 79
<
{"message":"invalid character 'i' looking for beginning of object key string"}
```

Empty request:

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json"
```

```
> POST /v1.30/networks/create HTTP/1.1
> Host: localhost
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
>
< HTTP/1.1 400 Bad Request
< Api-Version: 1.40
< Content-Type: application/json
< Docker-Experimental: false
< Ostype: linux
< Server: Docker/dev (linux)
< Date: Mon, 05 Nov 2018 11:59:22 GMT
< Content-Length: 49
<
{"message":"got EOF while reading request body"}
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-06 21:30:44 +01:00
Akihiro Suda
596cdffb9f mount: add BindOptions.NonRecursive (API v1.40)
This allows non-recursive bind-mount, i.e. mount(2) with "bind" rather than "rbind".

Swarm-mode will be supported in a separate PR because of mutual vendoring.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-11-06 17:51:58 +09:00
Sebastiaan van Stijn
b334198e65
Enable volume tests on Windows
These tests don't seem to have anything Linux-specific,
so enable them on Windows

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-02 15:18:26 +01:00
Sebastiaan van Stijn
05e18429cf
Integration test: use filepath.Join() to make path cross-platform
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-02 15:18:19 +01:00
Sebastiaan van Stijn
8e8cac8263
Some improvements to TestVolumesInspect
Some improvements in this test;

- use the volume-information that's returned by VolumeCreate as "expected"
- don't use an explict name for the volume, as it was only used to reference
  the volume for inspection
- improve the test-output on failure, so that "expected" and "actual" values
  are printed

Without this patch applied;

    === RUN   TestVolumesInspect
    --- FAIL: TestVolumesInspect (0.02s)
     	volume_test.go:108: assertion failed: false (bool) != true (true bool): Time Volume is CreatedAt not equal to current time
    FAIL

With this patch applied;

    === RUN   TestVolumesInspect
    --- FAIL: TestVolumesInspect (0.02s)
        volume_test.go:95: assertion failed: expression is false: createdAt.Truncate(time.Minute).Equal(now.Truncate(time.Minute)): CreatedAt (2018-11-01 16:15:20 +0000 UTC) not equal to creation time (2018-11-01 16:15:20.2421166 +0000 UTC m=+13.733512701)
    FAIL

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-02 15:18:11 +01:00
Sebastiaan van Stijn
1434204647
Fix double "unix://" scheme in TestInfoAPIWarnings
`d.Sock()` already returns the socket-path including the
`unix://` scheme.

Also removed `--iptables=false`, as it didn't really seem
nescessary for this test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-31 14:10:22 +01:00
Sebastiaan van Stijn
cb9d2cb71b
Move support for sysctl options in services to API v1.40
This feature was added in 14da20f5e7,
and was merged after API v1.39 shipped as part of the Docker 18.09
release candidates.

This commit moves the feature to the correct API version.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-26 15:39:36 +02:00