Commit Graph

241 Commits

Author SHA1 Message Date
9210b1bdbd Introduce a cli package for test-integration
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 50c4475df6304e0cf12ea95217eb00ab5d572e34
Component: engine
2017-03-23 18:35:22 +01:00
6df9f2365c Merge pull request #29552 from dnephin/fix-build-with-log-driver
Ignore the daemon log config when building images
Upstream-commit: 1b4e2b7c878fb69c1c96755e21a571e6d7b8e4bb
Component: engine
2017-02-07 15:47:41 -05:00
ba31fcddc2 Merge pull request #29692 from yongtang/29492-daemon-shm-size
Add daemon option `--default-shm-size`
Upstream-commit: 354bd4aaddc3072dbe9ead45b22a1eaccda6a506
Component: engine
2017-02-01 16:56:10 +01:00
1c2a160811 Ignore the daemon log config when building images.
Logs created by build containers should be handled by the daemon, not by logging drivers.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 80b642ff881d21ba6d006b8e52458335462d05b6
Component: engine
2017-01-30 10:59:19 -05:00
e290b2d1c4 Remove most of the runCommandWithOutput from integration tests
There is 5 calls left, that use StdinPipe that is not yet supported by
icmd.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: ecbb0e62f66da7d698c4f4583f36b927d8cfa811
Component: engine
2017-01-30 10:54:06 +01:00
b4140d991e Add daemon option --default-shm-size
This fix fixes issue raised in 29492 where it was not
possible to specify a default `--default-shm-size` in daemon
configuration for each `docker run``.

The flag `--default-shm-size` which is reloadable, has been
added to the daemon configuation.
Related docs has been updated.

This fix fixes 29492.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: db575ef626e8b2660750cbede6b19e951a3b4341
Component: engine
2017-01-27 12:17:06 -08:00
406aff91c7 fix some ineffectual assignments
to make goreportcard a bit happier
https://goreportcard.com/report/github.com/docker/docker

also found that `TestCpToErrDstParentNotExists()` was
partially broken, because a `runDockerCp()` was inadvertently
removed in f26a31e80cfcc77daba0872ddb14bf03f4398311

`TestDaemonRestartSaveContainerExitCode()` didn't verify
the actual _Error_ message, so added that to the test,
and updated the test to take into account that the
"experimental" CI enables `--init` on containers.

`TestVolumeCLICreateOptionConflict()` only checked
for an error to occur, but didn't validate if the
error was due to conflicting options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ba0afd70e89562aa3c668c87fb9191ed9edb7260
Component: engine
2017-01-24 11:16:19 +01:00
f7b8e381ec Use testEnv methods and remove most of the global variables
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: c8016e669f9507480745a441ba4cd735150ebb85
Component: engine
2017-01-17 12:39:08 +01:00
1334440bd8 Small cleanups on integration cli
- Join a few tests in one when it makes sense (reduce the number of
  container run and thus the overall time of the suites)
- Remove some duplication on several tests
- Remove some unused methods

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 9af5d7c34039d5e9d8a7dca6ea148147dc482dee
Component: engine
2017-01-12 16:57:59 +01:00
2b1a88aa3b Handle IPv6 enabling correctly in the tests
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Upstream-commit: d5e8d8e1cfb65cab9a2a651fd30c50a06afb4e00
Component: engine
2017-01-10 16:34:23 -08:00
78d1ff88be Update trustedCmd to be compatible with testutil/cmd
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 303b1d200af65ebb165602d0137f8b24b7c54d66
Component: engine
2017-01-09 11:07:05 +01:00
424f0925a7 Clean some runCommandWithOutput accross integration-cli code
There is still ways to go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 87e3fcfe1e059780c4ee57abb097296fd29e09af
Component: engine
2017-01-05 17:44:31 +01:00
7979981cc5 Add test TestRestartPolicyWithLiveRestore
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 89f034093a771fc1d3d161d23e018c25ae4e2ee3
Component: engine
2017-01-04 14:12:49 -08:00
a520da946c Merge pull request #29773 from forever043/fix_TestDaemonStartWithoutColors
test: Fix "--raw-logs=true" option test in TestDaemonStartWithoutColors
Upstream-commit: 2fd995bc999702bba49a802f7f054f657e1041fb
Component: engine
2017-01-03 09:29:19 +01:00
2758f0996d Remove pkg/integration and move it to testutil or integration-cli
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 33968e6c7df164fff0a882c50ae7f4f7e6190e4b
Component: engine
2016-12-30 18:26:34 +01:00
31c2689d03 test: Fix "--raw-logs=true" option test in TestDaemonStartWithoutColors
Because "tty" is closed in s.d.Stop() for "--raw-logs=false" test,
we need to open another pair of pty before test "--raw-logs=true"
option.

This patch fix #29772.

Signed-off-by: Jiuyue Ma <majiuyue@huawei.com>
Upstream-commit: c9e0d923ae6d2b5558378183b79d0a85ccf16020
Component: engine
2016-12-30 17:26:01 +08:00
a767ec924e Merge pull request #29721 from coolljt0725/follow_29365
Follow up #29365, fix fail to remove container after restart
Upstream-commit: 36ed7d58bb19e46445c81b6a00a7b75a6280e654
Component: engine
2016-12-30 00:13:13 +01:00
daae214603 Merge pull request #29762 from vdemeester/integration-mini-clean
Small cleanup in `integration-cli/docker_utils.go` 👼
Upstream-commit: 79f1c9c81d43da1c5746552a0d05980ed5e6447c
Component: engine
2016-12-29 09:29:53 +01:00
2ac27c5a50 Follow up #29365, fix fail to remove container after restart
Call daemon.Mount will increase the refcount of mounted path,
for those previous running containers, `Mount` call will make
the refcount to 2. see
https://github.com/docker/docker/blob/v1.13.0-rc4/daemon/graphdriver/counter.go#L38
```
	if !m.check {
		m.check = true
		if c.checker.IsMounted(path) {
			m.count++
		}
	}
	m.count++

```
graphdrive could restore on reboot after #22541, call
daemon.Mount to resore the graphdriver is not necessary.

And call `daemon.Mount` on restorting will mount all the containers
mounted layer even if it was stop.

This fix call Mount and then Unmount to get `BaseFs`

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 77c725eac2820b3d5b4252f5c25bbf305657d72a
Component: engine
2016-12-28 20:08:03 -05:00
3e1dc2e4b8 Small cleanup in integration-cli/docker_utils.go 👼
- Move *one-shot* (one use) function where it is actually used (easier
  to know what's going on).
- Remove `pullImageIfNotExist` function as it might be an artifact
  from way back. We don't need it as we already have frozen/loaded
  image of busybox.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b2320d121ca735a3879b40d493018b2e3a1a52da
Component: engine
2016-12-28 23:00:32 +01:00
2f9b83d720 Clean integration-cli/utils.go from most of its content
Most of the code is now on pkg/integration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: def13fa23c812d367e3c61d9c39bdcee66929c17
Component: engine
2016-12-28 19:05:48 +01:00
e43da16101 remove client-side for supported logging drivers
The `docker logs` command performed a
client-side check if the container's
logging driver was supported.

Now that we allow the client to connect
to both "older" and "newer" daemon versions,
this check is best done daemon-side.

This patch remove the check on the client
side, and leaves validation to the daemon,
which should be the source of truth.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 05dc9846e1266e6a3629c26851acb633a380dd17
Component: engine
2016-12-19 14:30:01 +01:00
343586bbdc Fix volume plugin refecounting on daemon restart
Ensures all known volumes (known b/c they are persisted to disk) have
their volume drivers refcounted properly.

In testing this, I found an issue with `--live-restore` (required since
currently the provided volume plugin doesn't keep state on restart)
where restorted plugins did not have a plugin client loaded causing a
panic when trying to use the plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 6ef1060cd0acb847e06db890abb335faa837a9e2
Component: engine
2016-12-16 10:14:06 -05:00
4bd3e0fe3d Fix docker exec -u issue after docker daemon restart
This fix tries to address the issue raised in 29342 where
`docker exec -u` after docker daemon restart returns an error:
```
unable to find user test: no matching entries in passwd file
```

The reason was that `container.BaseFS` is not present after restart.

This fix adds the `daemon.Mount` during the restore to bring up the
`container.BaseFS`.

An integration test has been added to cover the changes.

This fix fixes 29342.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 7feb2a17e4b9d1a5305a8a44004e916b79cbdd97
Component: engine
2016-12-13 22:36:30 -08:00
94e0a7d0c7 Use *check.C in StartWithBusybox, Start, Stop and Restart…
… to make sure it doesn't fail. It also introduce StartWithError,
StopWithError and RestartWithError in case we care about the
error (and want the error to happen).

This removes the need to check for error and make the intent more
clear : I want a deamon with busybox loaded on it — if an error occur
it should fail the test, but it's not the test code that has the
responsability to check that.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: c502fb49dc7af89adfb2a9686354aa78c2c46002
Component: engine
2016-12-12 09:46:47 +01:00
7e5a985603 Remove check.C field from daemon and Use errors package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: f4a34a1f065e26bbf1657cf857f02e9bc9a66b47
Component: engine
2016-12-09 22:26:42 +01:00
71651385ac Extract daemon to its own package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 48de91a33f097d4c20515088af1f5bcb9a98c5c9
Component: engine
2016-12-09 22:26:42 +01:00
f7a65041fc Convert err description to lower
Convert this to lower before checking the message of the error.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 47637b49a0fbd62a25702859f0993666c63ff562
Component: engine
2016-11-08 14:42:54 -08:00
2a18c9fa95 Merge pull request #26973 from allencloud/change-code-in-container-restore
change code in container restore
Upstream-commit: a6688959b4d574994f29af43d263caa83ee89ed2
Component: engine
2016-10-21 18:53:37 -07:00
11e5249376 Add config parameter to change stop timeout during daemon shutdown
This fix tries to add a daemon config parameter `--shutdown-timeout`
that specifies the timeout value to stop containers gracefully
(before SIGKILL). The default value is 15s.

The `--shutdown-timeout` parameter is added to daemon options and
config file. It will also be updated during daemon reload.

Additional test cases have been added to cover the change.

This fix fixes #22471.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: d7be6b2debb653739a32cfcb7c333ca062f62be0
Component: engine
2016-10-18 08:07:50 -07:00
6be324c5f4 Merge pull request #26882 from runcom/proxy-path
Specify userland proxy path
Upstream-commit: 91312f71aabe4f0840060049259fc6dbfcc62cd2
Component: engine
2016-10-07 09:44:39 +02:00
b79ddee1da daemon: add --userland-proxy-path flag
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: dd2e1947dc58d6807a5ddc401f84184fc5a77c2a
Component: engine
2016-10-06 17:31:53 +02:00
6e5d016ba6 Update containerd and runc
containerd: 837e8c5e1cad013ed57f5c2090c8591c10cbbdae
runc: 02f8fa7863dd3f82909a73e2061897828460d52f

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 7e12c3bb99381f117be73e05c187be6ce44280b9
Component: engine
2016-10-05 14:47:15 -07:00
bc1c43e903 Respect --bridge=none
- Do not create the default "bridge" network
- Get rid of the docker0 bridge

Signed-off-by: Alessandro Boch <aboch@docker.com>
Upstream-commit: a0af884d3a499460bdb8b41bc7cd61b1a56e6d22
Component: engine
2016-10-03 11:08:34 -07:00
ed910442b7 [nit] integration-cli: obey Go's naming convention
No substantial code change.

 - Api         --> API
 - Cli         --> CLI
 - Http, Https --> HTTP, HTTPS
 - Id          --> ID
 - Uid,Gid,Pid --> UID,PID,PID
 - Ipam        --> IPAM
 - Tls         --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)

Didn't touch in this commit:
 - Git: because it is officially "Git": https://git-scm.com/
 - Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
 - Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 7fb7a477d79c67ab53c432977780662ccbfeec57
Component: engine
2016-09-30 01:21:05 +00:00
287c5dd8e9 change code in container restore
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 6184ff312dce3222d71ec7c2769002e2dd7595ed
Component: engine
2016-09-30 02:44:21 +08:00
015d80b443 client: don't hide context errors
Instead of reformatting error from the request action, we wrap it,
allowing the cause to be recovered. This is important for consumers that
need to be able to detect context errors, such as `Cancelled` and
`DeadlineExceeded`.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 8e5ef8af5c90a3fbc93173cb485d42e044ca56ae
Component: engine
2016-09-08 17:47:43 -07:00
0805748a2b restore migrating pre-1.7.0 volumes
This was removed in a clean-up
(060f4ae6179b10aeafa883670826159fdae8204a) but should not have been.
Fixes issues with volumes when upgrading from pre-1.7.0 daemons.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: dc712b92495d12d789f45c84d45c3de3292089a8
Component: engine
2016-09-06 17:17:47 -04:00
ab000f181d Change related test from DockerSuite to DockerDaemonSuite in docker_cli_daemon_test.go
This fix is a follow-up of 26154. I did a grep on `integration-cli` and
found out that there are several tests in `docker_cli_daemon_test.go`
that still use `NewDaemon` instread of `DockerDaemonSuite`.

This fix changes related tests from DockerSuite to DockerDaemonSuite in
`docker_cli_daemon_test.go`.

With this fix, now `NewDaemon` is only called from `SetUpTest` on
various DockerXXXSuite. That should help maintain the test code base.

This fix is related to the comments in:
26115
24533.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 5c0fd2d06e82ed56cec33702a68fbc77ac14cb6b
Component: engine
2016-08-30 18:30:27 -07:00
d7713e33ac Add integration test to check persistence of exitcode and error message
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 88bfa6ede8fd1536d8248cc56882bc4b826d090d
Component: engine
2016-08-30 14:17:09 -07:00
d5c2d4c2f5 Merge pull request #23830 from ardnaxelarak/23345_remove_name_from_volume_create
remove --name flag from volume create
Upstream-commit: 5168c93419547338b11f5d24d24a2a025ea64524
Component: engine
2016-08-26 21:52:07 +02:00
aa95624624 TestDaemonDiscoveryBackendConfigReload behavior
`TestDaemonDiscoveryBackendConfigReload` was doing some wierd things
with files, creating a file (directly in `./integration-cli`), removing
it, then creating a new file.
This is just weird, so fixed it to use a single file, file will go into
a temp dir so it doesn't pollute integration-cli.

It was also blindly sending a SIGHUP to the daemon process then sleeping
for 3 seconds.  This is racey, and slow.
Change this to look for the daemon-reload event in the event stream.
Reload logic is moved to a separate function and blocks (w/ a timeout)
waiting for the reload event to fire.

Runtime of the test is now ~0.5s on my machine, where as it was a
minimum of 3s due to the `time.Sleep` before.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 20f99a8634accf54a923982f8c9a3b6719933f74
Component: engine
2016-08-26 11:02:04 -04:00
346f8a271b Add option to specify name without --name in volume create
Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
Upstream-commit: ba3f0bf0e7d4f94eb94023278adcfad4ca8fe9d7
Component: engine
2016-08-25 14:20:06 -07:00
8ad0a6fe8f Fix tests and windows service.
Support args to RunCommand
Fix docker help text test.
Fix for ipv6 tests.
Fix TLSverify option.
Fix TestDaemonDiscoveryBackendConfigReload
Use tempfile for another test.
Restore missing flag.
Fix tests for removal of shlex.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6e7405ebd4df360bc84f651c977ece31283eb3ee
Component: engine
2016-08-25 13:09:36 -04:00
0d4234bb46 Change to use c.Assert() instead of result.Assert()
Fix delete containers and make sure it prints errors correctly.
Rename Result.Fails to Result.Assert()
Create a constant for the default expected.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 243885808f5c69143679d094d964d333c47e69bf
Component: engine
2016-08-23 15:12:36 -04:00
eaa727c6e2 Create a unified RunCommand function with Assert()
Remove some run functions and replace them with the unified run command.
Remove DockerCmdWithStdoutStderr
Remove many duplicate runCommand functions.
Also add dockerCmdWithResult()
Allow Result.Assert() to ignore the error message if an exit status is expected.
Fix race in DockerSuite.TestDockerInspectMultipleNetwork
Fix flaky test DockerSuite.TestRunInteractiveWithRestartPolicy

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: d7022f2b46589cb9d860219e1d8278351ba147c3
Component: engine
2016-08-23 15:11:46 -04:00
cb1c855c27 Merge pull request #23951 from allencloud/defer-os-file-close
add defer file.Close to avoid potential fd leak
Upstream-commit: 64605d709f9bf5677d513d6ed78d63fffadc697d
Component: engine
2016-08-10 11:07:15 -07:00
1c502571ef add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 0ead624473b6bddc232b46bc7c76ab4f9c743ff5
Component: engine
2016-08-10 08:36:09 +08:00
b27f1b6d73 Move --rm to daemon side
`--rm` is a client side flag which caused lots of problems:
1. if client lost connection to daemon, including client crash or be
killed, there's no way to clean garbage container.
2. if docker stop a `--rm` container, this container won't be
autoremoved.
3. if docker daemon restart, container is also left over.
4. bug: `docker run --rm busybox fakecmd` will exit without cleanup.

In a word, client side `--rm` flag isn't sufficient for garbage
collection. Move the `--rm` flag to daemon will be more reasonable.

What this commit do is:
1. implement a `--rm` on daemon side, adding one flag `AutoRemove` into
HostConfig.
2. Allow `run --rm -d`, no conflicting `--rm` and `-d` any more,
auto-remove can work on detach mode.
3. `docker restart` a `--rm` container will succeed, the container won't
be autoremoved.

This commit will help a lot for daemon to do garbage collection for
temporary containers.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 3c2886d8a45d8e79b00ab413d91f1af871b58d0a
Component: engine
2016-08-08 22:46:53 +08:00
9233ed872e Ignore 'not a swarm error' when inspecting a task.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: fab2a3dc826ec05e7fb0dc66748b235fb4a43df6
Component: engine
2016-08-03 12:22:07 -04:00