Commit graph

5402 commits

Author SHA1 Message Date
Tibor Vass
10208e4d60 rm-gocheck: Not(Matches) -> !cmp.Regexp
sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Matches\), (.*)\)#assert.Assert(c, !is.Regexp("^"+\2+"$", \1)().Success())#g' \
-- "integration-cli/docker_cli_images_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:56 +00:00
Tibor Vass
0fa116fa8f rm-gocheck: Not(Equals) -> a != b
sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Equals\), (.*)#assert.Assert(c, \1 != \2#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:56 +00:00
Tibor Vass
74747b35e1 rm-gocheck: Not(IsNil) -> != nil
sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Not\(checker\.IsNil\)#assert.Assert(c, \1 != nil#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_volume_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:56 +00:00
Tibor Vass
230f7bcc02 rm-gocheck: normalize to use checker
sed -E -i 's#\bcheck\.(Equals|DeepEquals|HasLen|IsNil|Matches|Not|NotNil)\b#checker.\1#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:56 +00:00
Tibor Vass
1d92789b4f rm-gocheck: check.C -> testing.T
sed -E -i 's#\bcheck\.C\b#testing.T#g' \
-- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
Tibor Vass
6ecff64d03 rm-gocheck: check.C -> testing.B for BenchmarkXXX
sed -E -i 's#( Benchmark[^\(]+\([^ ]+ \*)check\.C\b#\1testing.B#g' \
-- "integration-cli/benchmark_test.go" "integration-cli/docker_cli_logs_bench_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
Tibor Vass
1f69c62540 rm-gocheck: c.Assert(...) -> assert.Assert(c, ...)
sed -E -i 's#\bc\.Assert\(#assert.Assert(c, #g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
Tibor Vass
36e7001b99 rm-gocheck: redress multiline c.Assert calls
go run rm-gocheck.go redress '\bc\.Assert\b.*(,|\()\s*$' \
 "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:54 +00:00
Tibor Vass
5879446de9 rm-gocheck: normalize c.Check to c.Assert
sed -E -i 's#\bc\.Check\(#c.Assert(#g' \
-- "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_run_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:53 +00:00
Tibor Vass
931edfe5e9 prepare for rm-gocheck script
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 20:49:53 +00:00
Tibor Vass
e07a3f2917 integration-cli: fix tests that are silently succeeding when they should not compile
Tests fixed in this patch used to compile and pass successfully,
despite checking if non-nullable types are not nil.

These would have become compile errors once go-check is removed.

About TestContainerAPIPsOmitFields:
Basically what happened is that this test got refactored to start using the API types
and API client library instead of custom types and stdlib's http functions.
This test used to test an API regression which could possibly be a unit test.
However because PublicPort and IP are not nullable types, this test became useless.

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 20:49:53 +00:00
Brian Goff
e6c5563ae9 Fix Service TTY test so signal handlers work
Noticed this test container not exiting correctly while debugging
another issue. Before this change, signals were being eaten by bash, now
they are hanlded by top. This cuts the test time in half since it
doesn't have to wait for docker to SIGKILL it.

Old:
PASS: docker_cli_swarm_test.go:840: DockerSwarmSuite.TestSwarmServiceTTY	18.997s

New:
PASS: docker_cli_swarm_test.go:840: DockerSwarmSuite.TestSwarmServiceTTY	6.293s

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-09-09 10:44:11 -07:00
Sebastiaan van Stijn
02c9b0674f
integration-cli: getContainerCount() fix trimming prefix
caught by staticcheck:

```
integration-cli/docker_utils_test.go:66:29: SA1024: cutset contains duplicate characters (staticcheck)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-03 10:37:23 +02:00
Jintao Zhang
e6fce00ec8 TestCase: use icmd.RunCmd instead icmd.StartCmd
Use `cli.Docker` instead `dockerCmdWithResult`.

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2019-09-03 07:12:58 +08:00
Stefan Scherer
ca3e230b77
Use new windows labels
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2019-08-21 13:12:52 +02:00
Vitaly Ostrosablin
c266d8fe56 Fix testcase name
TestBuildMulitStageResetScratch testcase was actually meant to be
TestBuildMulitStageResetScratch

Signed-off-by: Vitaly Ostrosablin <tmp6154@yandex.ru>
2019-08-20 09:14:42 +03:00
SataQiu
f6226a2a56 fix some spelling mistakes
Signed-off-by: SataQiu <qiushida@beyondcent.com>
2019-08-13 22:57:55 +08:00
Sebastiaan van Stijn
0595c01718
switch kr/pty to creack/pty v1.1.7
kr/pty was moved to creak/pty and the old location was
archived.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-29 16:59:08 -07:00
Brian Goff
582591d56b
Merge pull request #39569 from thaJeztah/remove_redundant_checks
integration-cli: remove redundant "testrequires"
2019-07-29 10:36:09 -07:00
Drew Erny
b79adac339 Fix TestSwarmClusterRotateUnlockKey
TestSwarmClusterRotateUnlockKey had been identified as a flaky test. It
turns out that the test code was wrong: where we should have been
checking the string output of a command, we were instead checking the
value of the error. This means that the error case we were expecting was
not being matched, and the test was failing when it should have just
retried.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2019-07-26 15:51:56 -05:00
Sebastiaan van Stijn
7f37d99ef5
integration-cli: remove redundant "testrequires"
The `DockerDaemonSuite.SetUpTest` already checks for Linux and a local daemon;

```
func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
	s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
}
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-19 10:53:42 +02:00
Sebastiaan van Stijn
b4058a6c91
Merge pull request #39258 from thaJeztah/revert_remove_TestSearchCmdOptions
Revert "Remove TestSearchCmdOptions test"
2019-07-19 01:30:22 +02:00
Drew Erny
1de914695b Retry service updates on out of sequence errors
Code retrying service update operations when receiving "update out of
sequence" errors was removed because of a misunderstanding, which has
made tests flaky. This re-adds the "CmdRetryOutOfSequence" method, and
uses it in TestSwarmPublishAdd to avoid flaky behavior.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2019-07-18 12:58:21 -05:00
Michael Crosby
fd6f0b1cab
Merge pull request #39531 from tonistiigi/swarm-ci-check
integration-cli: fix swarm tests flakiness
2019-07-18 10:09:34 -04:00
Tonis Tiigi
8c9362857f integration-cli: increase healthcheck timeout
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-07-17 18:28:34 -07:00
Tonis Tiigi
52e0dfef90 integration-cli: allow temporary no-leader error
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-07-17 11:52:58 -07:00
Tonis Tiigi
3df1095bbd integration-cli: allow temporary errors on leader switch
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-07-17 11:52:58 -07:00
Sebastiaan van Stijn
3d1850d10d
integration-cli: also run Docker Hub search tests on Windows
The API does not filter images on platform, so searching on
Windows should work as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 13:10:27 +02:00
Sebastiaan van Stijn
2ac55d5c9a
TestSearchWithLimit: slight refactor and improve boundary checks
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 13:09:17 +02:00
Sebastiaan van Stijn
85d6fb888c
TestSearchStarsOptionWithWrongParameter: remove checks for deprecated flags
The `--stars` flag was deprecated, and was replaced by `--filter stars=xx`

Integration tests run with a fixed version of the CLI, and the new
(`--filter`) option is already tested in this test, so there's no need
to verify the old flags.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 13:07:17 +02:00
Sebastiaan van Stijn
b38c71bfe0
TestSearchCmdOptions: remove checks for deprecated flags
The `--stars` and `--automated` flags have been deprecated, and were
replaced by `--filter stars=xx` and `--filter is-automated=true`.

Integration tests run with a fixed version of the CLI, and the new
(`--filter`) option is already tested in this test, so there's no need
to verify the old flags.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 12:47:57 +02:00
Sebastiaan van Stijn
a78b9a3726
TestSearchCmdOptions: remove cli-only checks
Both `--help` and `--no-trunc` are implemented in the CLI. There's
no need to verify them here because the integration tests use a
fixed version of the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 12:41:30 +02:00
Sebastiaan van Stijn
1be7065e99
Revert "Remove TestSearchCmdOptions test"
This reverts commit 21e662c774.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 12:26:35 +02:00
Sebastiaan van Stijn
c096225e8e
DockerSwarmSuite lock portIndex to work around race
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-13 13:20:00 +02:00
Brian Goff
24ad2f486d Add (hidden) flags to set containerd namespaces
This allows our tests, which all share a containerd instance, to be a
bit more isolated by setting the containerd namespaces to the generated
daemon ID's rather than the default namespaces.

This came about because I found in some cases we had test daemons
failing to start (really very slow to start) because it was (seemingly)
processing events from other tests.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-07-11 17:27:48 -07:00
Sebastiaan van Stijn
aa8249ae1b
Merge pull request #39470 from thaJeztah/remove_unused_requirements
integration-cli: remove unused requirements utils
2019-07-10 17:35:59 +02:00
Yong Tang
026fae5d7d
Merge pull request #39469 from thaJeztah/remove_default_sleep_image
integration-cli: remove defaultSleepImage constant
2019-07-10 07:29:08 -07:00
Sebastiaan van Stijn
c887b09abc
integration-cli: remove unused requirements utils
Removes some test functions that were unused:

- bridgeNfIP6tables
- ambientCapabilities (added to support #26979, which was reverted in #27737)
- overlay2Supported

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-08 18:58:46 +02:00
Sebastiaan van Stijn
27f432ca57
integration-cli: remove defaultSleepImage constant
Both Linux and Windows now use busybox, so no need to keep a
constant for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-08 18:42:08 +02:00
Sebastiaan van Stijn
7204341950
integration-cli: remove ExecSupport check
All current versions of Docker support exec, so no need
to check for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-08 18:31:34 +02:00
Michael Crosby
b5f28865ef Handle blocked I/O of exec'd processes
This is the second part to
https://github.com/containerd/containerd/pull/3361 and will help process
delete not block forever when the process exists but the I/O was
inherited by a subprocess that lives on.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-21 12:02:15 -04:00
Tibor Vass
f695e98cb7 Revert "Remove the rest of v1 manifest support"
This reverts commit 98fc09128b in order to
keep registry v2 schema1 handling and libtrust-key-based engine ID.

Because registry v2 schema1 was not officially deprecated and
registries are still relying on it, this patch puts its logic back.

However, registry v1 relics are not added back since v1 logic has been
removed a while ago.

This also fixes an engine upgrade issue in a swarm cluster. It was relying
on the Engine ID to be the same upon upgrade, but the mentioned commit
modified the logic to use UUID and from a different file.

Since the libtrust key is always needed to support v2 schema1 pushes,
that the old engine ID is based on the libtrust key, and that the engine ID
needs to be conserved across upgrades, adding a UUID-based engine ID logic
seems to add more complexity than it solves the problems.

Hence reverting the engine ID changes as well.

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-18 00:36:01 +00:00
Tibor Vass
0811297608 use gotest.tools assertions in docker_cli_push_test.go
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-18 00:36:00 +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
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
Sebastiaan van Stijn
915acffdb4
Harden TestPsListContainersFilterExited
This test runs on a daemon also used by other tests
so make sure we don't get failures if another test
doesn't cleanup or is running in parallel.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-05 17:02:44 +02:00
Brian Goff
dbd06522bd
Merge pull request #39254 from thaJeztah/update_seccomp_test_for_aarch64
Update TestRunWithDaemonDefaultSeccompProfile for ARM64
2019-05-23 11:23:14 -07:00
Sebastiaan van Stijn
21e662c774
Remove TestSearchCmdOptions test
This test is dependent on the search results returned by Docker Hub, which
can change at any moment, and causes this test to be unpredictable.

Removing this test instead of trying to catch up with Docker Hub any time
the results change, because it's effectively testing Docker Hub, and not
the daemon.

Unit tests are already in place to test the core functionality of the daemon,
so it should be safe to remove this test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-22 14:51:53 +02:00
Sebastiaan van Stijn
4bd8964b23
Update TestRunWithDaemonDefaultSeccompProfile for ARM64
`chmod` is a legacy syscall, and not present on arm64, which
caused this test to fail.

Add `fchmodat` to the profile so that this test can run both
on x64 and arm64.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-22 13:18:10 +02:00
Kir Kolyshkin
4f80a1953d int-cli/TestSearchCmdOptions: fail earlier
Sometimes this test fails (allegedly due to problems with Docker Hub),
but it fails later than it should, for example:

> 01:20:34.845 assertion failed: expression is false: strings.Count(outSearchCmdStars, "[OK]") <= strings.Count(outSearchCmd, "[OK]"): The quantity of images with stars should be less than that of all images: <...>

This, with non-empty list of images following, means that the initial
`docker search busybox` command returned not enough results. So, add
a check that `docker search busybox` returns something.

While at it,
 * raise the number of stars to 10;
 * simplify check for number of lines (no need to count [OK]'s);
 * improve error message.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-05-21 01:55:18 -07:00
Sebastiaan van Stijn
19008faf03
Merge pull request #38992 from kolyshkin/mnt
pkg/mount: optimizations
2019-05-20 14:12:42 +02:00
Jim Ehrismann
d7de1a8b9f explicitly set filesystem type for mount to avoid 'invalid argument' error on arm
Signed-off-by: Jim Ehrismann <jim.ehrismann@docker.com>
2019-05-16 14:46:41 -04:00
Sebastiaan van Stijn
2b5880c2eb
Remove TestContainerAPICreateWithHostName
TestNISDomainname in the integration suite covers this

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-24 17:52:00 -07:00
Stefan Scherer
aad7e9797b
Use current windows servercore image
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2019-04-17 15:24:23 +02:00
Kir Kolyshkin
1cfdb2ffb8 TestContainersAPICreateMountsCreate: minor optimization
Don't use two-stage mount in TestContainersAPICreateMountsCreate();
apparently it was written before mount.Mount() could accept propagation
flags.

While at it, remove rw as this is the default.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-04-09 13:00:20 -07:00
Sebastiaan van Stijn
6345208b9b
Replace some checkers and assertions with gotest.tools
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-05 16:45:37 +02:00
Sebastiaan van Stijn
86f2ac4a6b
Remove some checkers to discourage usage
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-05 15:22:10 +02:00
Vincent Demeester
da823cf3a5
Merge pull request #38853 from cyphar/integration-cli-ensureImage
integration-cli: don't build -test images if they already exist
2019-03-27 07:32:23 +01:00
Yong Tang
269cba2428 Small gofmt fix
This PR is a small gofmt fix of https://goreportcard.com/report/github.com/moby/moby#gofmt
```
gofmt99%
Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command
moby/integration-cli/docker_cli_run_test.go
Line 1: warning: file is not gofmted with -s (gofmt)
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-03-26 01:54:31 +00:00
Sebastiaan van Stijn
6dfd5bd74f
Merge pull request #38908 from Microsoft/jjh/testrunbindmounts
Windows (pre RS5) disableTestRunBindMounts
2019-03-20 08:31:53 +01:00
John Howard
a3eda72f71
Merge pull request #38541 from Microsoft/jjh/containerd
Windows: Experimental: ContainerD runtime
2019-03-19 21:09:19 -07:00
John Howard
9d2e97ac6e Windows (pre RS5) disableTestRunBindMounts
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-03-20 01:43:38 +00:00
John Howard
80fce6d747 Windows:Fix TestRunUserDefaults
Signed-off-by: John Howard <jhoward@microsoft.com>
2019-03-19 13:06:27 -07:00
Sebastiaan van Stijn
2925eb7a2a
Merge pull request #38777 from wk8/wk8/raw_cred_specs
Making it possible to pass Windows credential specs directly to the engine
2019-03-16 16:42:39 +01:00
Jean Rouge
7fdac7eb0f Making it possible to pass Windows credential specs directly to the engine
Instead of having to go through files or registry values as is currently the
case.

While adding GMSA support to Kubernetes (https://github.com/kubernetes/kubernetes/pull/73726)
I stumbled upon the fact that Docker currently only allows passing Windows
credential specs through files or registry values, forcing the Kubelet
to perform a rather awkward dance of writing-then-deleting to either the
disk or the registry to be able to create a Windows container with cred
specs.

This patch solves this problem by making it possible to directly pass
whole base64-encoded cred specs to the engine's API. I took the opportunity
to slightly refactor the method responsible for Windows cred spec as it
seemed hard to read to me.

Added some unit tests on Windows credential specs handling, as there were
previously none.

Added/amended the relevant integration tests.

I have also tested it manually: given a Windows container using a cred spec
that you would normally start with e.g.
```powershell
docker run --rm --security-opt "credentialspec=file://win.json" mcr.microsoft.com/windows/servercore:ltsc2019 nltest /parentdomain
# output:
# my.ad.domain.com. (1)
# The command completed successfully
```
can now equivalently be started with
```powershell
$rawCredSpec = & cat 'C:\ProgramData\docker\credentialspecs\win.json'
$escaped = $rawCredSpec.Replace('"', '\"')
docker run --rm --security-opt "credentialspec=raw://$escaped" mcr.microsoft.com/windows/servercore:ltsc2019 nltest /parentdomain
# same output!
```

I'll do another PR on Swarmkit after this is merged to allow services to use
the same option.

(It's worth noting that @dperny faced the same problem adding GMSA support
to Swarmkit, to which he came up with an interesting solution - see
https://github.com/moby/moby/pull/38632 - but alas these tricks are not
available to the Kubelet.)

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
2019-03-15 19:20:19 -07:00
John Howard
20833b06a0 Windows: (WCOW) Generate OCI spec that remote runtime can escape
Signed-off-by: John Howard <jhoward@microsoft.com>

Also fixes https://github.com/moby/moby/issues/22874

This commit is a pre-requisite to moving moby/moby on Windows to using
Containerd for its runtime.

The reason for this is that the interface between moby and containerd
for the runtime is an OCI spec which must be unambigious.

It is the responsibility of the runtime (runhcs in the case of
containerd on Windows) to ensure that arguments are escaped prior
to calling into HCS and onwards to the Win32 CreateProcess call.

Previously, the builder was always escaping arguments which has
led to several bugs in moby. Because the local runtime in
libcontainerd had context of whether or not arguments were escaped,
it was possible to hack around in daemon/oci_windows.go with
knowledge of the context of the call (from builder or not).

With a remote runtime, this is not possible as there's rightly
no context of the caller passed across in the OCI spec. Put another
way, as I put above, the OCI spec must be unambigious.

The other previous limitation (which leads to various subtle bugs)
is that moby is coded entirely from a Linux-centric point of view.

Unfortunately, Windows != Linux. Windows CreateProcess uses a
command line, not an array of arguments. And it has very specific
rules about how to escape a command line. Some interesting reading
links about this are:

https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
https://stackoverflow.com/questions/31838469/how-do-i-convert-argv-to-lpcommandline-parameter-of-createprocess
https://docs.microsoft.com/en-us/cpp/cpp/parsing-cpp-command-line-arguments?view=vs-2017

For this reason, the OCI spec has recently been updated to cater
for more natural syntax by including a CommandLine option in
Process.

What does this commit do?

Primary objective is to ensure that the built OCI spec is unambigious.

It changes the builder so that `ArgsEscaped` as commited in a
layer is only controlled by the use of CMD or ENTRYPOINT.

Subsequently, when calling in to create a container from the builder,
if follows a different path to both `docker run` and `docker create`
using the added `ContainerCreateIgnoreImagesArgsEscaped`. This allows
a RUN from the builder to control how to escape in the OCI spec.

It changes the builder so that when shell form is used for RUN,
CMD or ENTRYPOINT, it builds (for WCOW) a more natural command line
using the original as put by the user in the dockerfile, not
the parsed version as a set of args which loses fidelity.
This command line is put into args[0] and `ArgsEscaped` is set
to true for CMD or ENTRYPOINT. A RUN statement does not commit
`ArgsEscaped` to the commited layer regardless or whether shell
or exec form were used.
2019-03-12 18:41:55 -07:00
Aleksa Sarai
175b1d7830
integration-cli: don't build -test images if they already exist
There's no need to try to re-build the test images if they already
exist. This change makes basically no difference to the upstream
integration test-suite running, but for users who want to run the
integration-cli suite on a host machine (such as distributions doing
tests) this change allows images to be pre-loaded such that compilers
aren't needed on the test machine.

However, this does remove the accidental re-compilation of nnp-test, as
well as handling errors far more cleanly (previously if an error
occurred during a test build, further tests won't attempt to rebuild
it).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2019-03-13 11:48:40 +11: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
Brian Goff
13b7d11be1 Remove Schema1 integration test suite
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-03-02 10:46:37 -08:00
Justin Cormack
98fc09128b Remove the rest of v1 manifest support
As people are using the UUID in `docker info` that was based on the v1 manifest signing key, replace
with a UUID instead.

Remove deprecated `--disable-legacy-registry` option that was scheduled to be removed in 18.03.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2019-03-02 10:46:37 -08:00
John Howard
faaffd5d6d Windows:Disable 2 restart test when Hyper-V
Signed-off-by: John Howard <jhoward@microsoft.com>
2019-02-22 11:15:51 -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
Deng Guangxing
8e293be4ba fix unless-stopped unexpected behavior
fix https://github.com/moby/moby/issues/35304.

Signed-off-by: dengguangxing <dengguangxing@huawei.com>
2019-02-01 15:03:17 -08:00
Sebastiaan van Stijn
3a4bb96ab7
Remove use of deprecated client.NewClient()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-28 17:08:54 +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
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
Sebastiaan van Stijn
3105ca26dc
integration-cli: remove deprecated daemonHost() utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-21 12:07:36 +01:00
Brian Goff
64fd09bd29
Merge pull request #38553 from thaJeztah/faster_api_node_drain_pause
Slightly speed up TestAPISwarmNodeDrainPause
2019-01-15 13:49:28 -08:00
Brian Goff
0dc531243d
Merge pull request #38554 from thaJeztah/check_for_errors
Add missing error-check in TestAPISwarmManagerRestore
2019-01-15 09:25:44 -08:00
Vincent Demeester
a827f17306
Merge pull request #38552 from thaJeztah/improve_test_events_filter_labels
Make TestEventsFilterLabels less flaky
2019-01-15 09:01:38 +01:00
Sebastiaan van Stijn
0e15c02465
Make TestEventsFilterLabels less flaky
This test sometimes failed because the number of events received did not
match the expected number:

    FAIL: docker_cli_events_test.go:316: DockerSuite.TestEventsFilterLabels

    docker_cli_events_test.go:334:
        c.Assert(len(events), checker.Equals, 3)
    ... obtained int = 2
    ... expected int = 3

This patch makes the test more stable, by:

- use a wider range between `--since` and `--until`. These options were set
  so that the client detaches after events were received, but the actual
  range should not matter. Changing the range will cause more events to be
  returned, but we're specifically looking for the container ID's, so this
  should not make a difference for the actual test.
- use `docker create` instead of `docker run` for the containers. the
  containers don't have to be running to trigger an event; using `create`
  speeds up the test.
- check the exit code of the `docker create` to verify the containers were
  succesfully created.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-14 00:29:13 +01:00
Sebastiaan van Stijn
2e326eba70
Add missing error-check in TestAPISwarmManagerRestore
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-13 21:11:50 +01:00
Sebastiaan van Stijn
ebdc9a3afc
Slightly speed up TestAPISwarmNodeDrainPause
Looks like we don't need that many replicas, to test the
behavior, so let's start a few less.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-13 21:08:20 +01:00
Sebastiaan van Stijn
973ca00d60
reduce flakiness of TestSwarmLockUnlockCluster and TestSwarmJoinPromoteLocked
I noticed that this test failed, because the node was in status "pending".

The test checks for the node's status immediately after it was restarted, so
possibly it needs some time to unlock.

    14:07:10 FAIL: docker_cli_swarm_test.go:1128: DockerSwarmSuite.TestSwarmLockUnlockCluster
    ...
    14:07:10 docker_cli_swarm_test.go:1168:
    14:07:10     checkSwarmLockedToUnlocked(c, d)
    14:07:10 docker_cli_swarm_test.go:1017:
    14:07:10     c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive)
    14:07:10 ... obtained swarm.LocalNodeState = "pending"
    14:07:10 ... expected swarm.LocalNodeState = "active"

This patch adds a `waitAndAssert` for the node's status, with a 1 second timeout.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-12 20:42:18 +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
Sebastiaan van Stijn
926edd68a5
Merge pull request #38493 from thaJeztah/skip_kmem_tests_on_rhel
Skip kernel-memory tests on RHEL/CentOS daemons
2019-01-05 09:51:53 +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
1e1156cf67
Skip kernel-memory tests on RHEL/CentOS daemons
RHEL/CentOS 3.10 kernels report that kernel-memory accounting is supported,
but it actually does not work.

Runc (when compiled for those kernels) will be compiled without kernel-memory
support, so even though the daemon may be reporting that it's supported,
it actually is not.

This cause tests to fail when testing against a daemon that's using a runc
version without kmem support.

For now, skip these tests based on the kernel version reported by the daemon.

This should fix failures such as:

```
FAIL: /go/src/github.com/docker/docker/integration-cli/docker_cli_run_unix_test.go:499: DockerSuite.TestRunWithKernelMemory

assertion failed:
Command:  /usr/bin/docker run --kernel-memory 50M --name test1 busybox cat /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes
ExitCode: 0
Error:    <nil>
Stdout:   9223372036854771712

Stderr:   WARNING: You specified a kernel memory limit on a kernel older than 4.0. Kernel memory limits are experimental on older kernels, it won't work as expected and can cause your system to be unstable.

Failures:
Expected stdout to contain "52428800"

FAIL: /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:125: DockerSuite.TestUpdateKernelMemory

/go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:136:
    ...open /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go: no such file or directory
... obtained string = "9223372036854771712"
... expected string = "104857600"

----------------------------------------------------------------------
FAIL: /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:139: DockerSuite.TestUpdateKernelMemoryUninitialized

/go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:149:
    ...open /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go: no such file or directory
... value = nil
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-04 13:27:46 +01:00
Vincent Demeester
74ad4f2d2c
Merge pull request #38423 from olljanat/disable-integration-tests-on-z-and-powerpc
Disabled Flaky tests on powerpc and z
2019-01-04 09:35:56 +01: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
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
Akihiro Suda
5ddb1d410a
Merge pull request #38426 from thaJeztah/remove_unused_experimental_check
Remove old ExperimentalDaemon, NotS390X, NotPausable, SameHostDaemon checks
2018-12-25 18:30:23 +09: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
43b15e924f
Remove SameHostDaemon, use testEnv.IsLocalDaemon instead
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-24 13:25:53 +01:00
Sebastiaan van Stijn
362f737e1c
Remove unused ExperimentalDaemon, NotS390X, NotPausable requirement checks
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-24 13:16:05 +01:00
Olli Janatuinen
02157c638b Disabled these tests on s390x and ppc64le:
- TestAPISwarmLeaderElection
- TestAPISwarmRaftQuorum
- TestSwarmClusterRotateUnlockKey

because they are known to be flaky.

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-12-24 13:51:09 +02:00
Sebastiaan van Stijn
11b88be247
Remove validationError type, and use errdefs.InvalidParameter
Using `errors.Errorf()` passes the error with the stack trace for
debugging purposes.

Also using `errdefs.InvalidParameter` for Windows, so that the API
will return a 4xx status, instead of a 5xx, and added tests for
both validations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-22 16:04:52 +01:00
Vincent Demeester
d5b271c155
add check for local volume option
Description:
When using local volume option such as size=10G, type=tmpfs, if we provide wrong options, we could create volume successfully.
But when we are ready to use it, it will fail to start container by failing to mount the local volume(invalid option).

We should check the options at when we create it.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-22 16:02:50 +01: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
Kir Kolyshkin
7e7ff2a033 integration-cli/build: don't panic
A lack of check in the test code can lead to a panic due to
`len(ids)` being `0`.

Avoid the panic by adding appropriate checks. Note `Assert()` should be
used rather than `Check()` as if it fails we should not proceed with the
test.

Originally found in https://github.com/moby/moby/pull/38404.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-12-20 18:51:57 -08:00
Sebastiaan van Stijn
a8d2b29e8d
Use errors.Wrap() in daemon/config
using `errors.Wrap()` preserves the original error

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-30 01:27:47 +01:00
John Howard
561e0f6b7f Windows: Bump busybox to v1.1
Signed-off-by: John Howard <jhoward@microsoft.com>

This is a follow-on from https://github.com/moby/moby/pull/38277
but had to be done in a couple of stages to ensure that CI didn't
break. v1.1 of the busybox image is now based on a CMD of "sh"
rather than using an entrypoint. And it also uses the bin directory
rather than `c:\busybox`. This makes it look a lot closer to the
Linux busybox image, and means that a couple of Windows-isms in
CI tests can be reverted back to be identical to their Linux
equivalents.
2018-11-26 14:50:47 -08:00
Kir Kolyshkin
2ed512c7fa integration-cli/Test*Swarm*: use same args on restart
When starting docker daemons for swarm testing, we disable iptables
and use lo for communication (in order to avoid network conflicts).

The problem is, these options are lost on restart, that can lead
to any sorts of network conflicts and thus connectivity issues
between swarm nodes.

Fix this. This does not fix issues with swarm test failures, but
it seems they appear are less often after this one.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:25:12 -07:00
Kir Kolyshkin
06afc2d1e6 TestAPISwarmLeaderElection: add some debug
......

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:24:39 -07:00
Kir Kolyshkin
24cbb98971 docker_cli_swarm_test: factor out common code
This is repeated 6 times in different tests, with slight
minor variations. Let's factor it out, for clarity.

While at it, simplify the code: instead of more complex
parsing of "docker swarm init|update --autolock" output (1)
and checking if the key is also present in
"docker swarm unlock-key" output (2), get the key
from (2) and check it is present in (1).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:23:47 -07:00
Kir Kolyshkin
66cb1222d6 docker_cli_swarm_test.go: rm unused arg
Since commit 17173efbe0 checkSwarmLockedToUnlocked() no longer
require its third argument, so remove it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-11-01 13:23:47 -07:00
16yuki0702
a28843150a Fix typo
Signed-off-by: Hiroyuki Sasagawa <hs19870702@gmail.com>
2018-10-06 10:22:11 +09:00
Kir Kolyshkin
1921753b4b TestSwarmContainerEndpointOptions: fix debug
In case of failure, stale out was printed.

Fixes: 6212ea669b

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-02 23:39:14 -07:00
Sebastiaan van Stijn
574db7a537
Tweak bind mount errors
These messages were enhanced to include the path that was
missing (in df6af282b9), but
also changed the first part of the message.

This change complicates running e2e tests with mixed versions
of the engine.

Looking at the full error message, "mount" is a bit redundant
as well, because the error message already indicates this is
about a "mount";

    docker run --rm --mount type=bind,source=/no-such-thing,target=/foo busybox
    docker: Error response from daemon: invalid mount config for type "bind": bind mount source path does not exist: /no-such-thing.

Removing the "mount" part from the error message, because
it was redundant, and makes cross-version testing easier :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-09-28 12:18:58 +02:00
Yong Tang
c76cbede57
Merge pull request #37927 from adshmh/remove-redundant-config-secret-integration-cli-tests
Remove redundant config & secret integration tests
2018-09-27 20:01:53 -07:00
Arash Deshmeh
ef490e0368 Remove redundant config & secret integration tests
The tests performed by integration tests TestConfigCreateWithFile and
TestSecretCreateWithFile are already covered by integration tests under
integration/config and integration/secret, respectively, except for the
use of an input file. The latter is also covered by unit tests for
config and secret commands under docker/cli, making the above
integration tests redundant.

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-09-27 13:41:46 -04:00
rongzhang
88329c104c Fix typo
Signed-off-by: rongzhang <rongzhang@alauda.io>
2018-09-27 23:54:13 +08:00
Tibor Vass
52b60f705c fix daemon tests that were using wrong containerd socket
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-25 17:57:35 +00:00
Tibor Vass
34eede0296 Remove 'docker-' prefix for containerd and runc binaries
This allows to run the daemon in environments that have upstream containerd installed.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-24 21:49:03 +00:00
Yong Tang
30b5eb19d4
Merge pull request #37851 from adshmh/migrate-ipc-integration-tests-to-integration-container
migrated ipc integration tests to integration/container
2018-09-22 09:58:56 -07:00
Arash Deshmeh
9ad4ef7848 remove the redundant integration test TestExportContainerWithOutputAndImportImage
This test is the same as TestExportContainerAndImportImage, except for the output file option.
A unit test has been added to docker/cli to cover the output file option. Therefore this test can be removed.

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-09-19 16:21:22 -04:00
Yong Tang
ed392603ac
Merge pull request #37486 from adshmh/migrate-docker_cli_secret_create_test-integration-tests-to-integration-secret
migrate create secret integration tests from integration-cli to integration/secret
2018-09-15 06:20:27 -07:00
Yong Tang
3c5317ed39
Merge pull request #37444 from adshmh/migrate-docker_api_create_test-integration-tests-to-integration_container
Refactor and migrate integration tests from integration-cli/docker_api_create_test to integration/container
2018-09-15 06:19:09 -07:00
Arash Deshmeh
febefb850d migrated ipc integration tests to integration/container
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-09-14 17:19:34 -04:00
Tibor Vass
d6ac319aaa
Merge pull request #37820 from kolyshkin/TestStartReturnCorrectExitCode
TestStartReturnCorrectExitCode: show error
2018-09-12 15:42:25 -07:00
Akihiro Suda
112b7dfd57
Merge pull request #37516 from adshmh/migrate-docker_cli_wait_test-to-integration-container
migrate container wait integration tests from integration-cli to integration/container package
2018-09-13 01:55:13 +09:00
Kir Kolyshkin
0d59f4305c TestStartReturnCorrectExitCode: show error
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-11 12:43:30 -07:00
Sebastiaan van Stijn
caca40c8ec
Merge pull request #37799 from scf0920/branch-1
fix typo: transtions->transitions
2018-09-08 11:20:41 +02:00
cfshang
5750e14052 fix typo: transtions->transitions
Signed-off-by: Chengfei Shang <cfshang@alauda.io>
2018-09-08 10:06:46 +08:00
Sebastiaan van Stijn
f3c4ec8c0e
Merge pull request #37788 from max8899/patch-1
fix typos
2018-09-07 16:48:48 +02:00
max8899
aa05e0e30f fix typos: wether -> whether
Signed-off-by: Lei Gong <lgong@alauda.io>
2018-09-07 12:27:30 +08:00
Kir Kolyshkin
9b0097a699 Format code with gofmt -s from go-1.11beta1
This should eliminate a bunch of new (go-1.11 related) validation
errors telling that the code is not formatted with `gofmt -s`.

No functional change, just whitespace (i.e.
`git show --ignore-space-change` shows nothing).

Patch generated with:

> git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:16 -07:00
John Howard
b1b9937bc7 Windows: Go1.11: Use long path names in build context (TestBuildSymlinkBreakout)
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-05 17:01:05 -07:00
Kir Kolyshkin
9f3a343a51 integration-cli: fix TestAttachDetach, rm TestAttachDetachTruncatedID
It looks like the logic of the test became wrong after commit
ae0883c ("Move TestAttachDetach to integration-cli").

The original logic was:
* (a few first steps skipped for clarity)
* send escape sequence to "attach";
* check "attach" is exiting (i.e. escape sequence works);
* check the container is still alive;
* kill the container.

Also, timeouts were big at that time, in the order of seconds.

The logic after the above mentioned commit and until now is:
* ...
* send escape sequence to "attach";
* check the container is running (why shouldn't it?);
* kill the container;
* checks that the "attach" has exited.

So, from the "let's check detach using escape sequence is working"
the test became something like "let's check that attach is gone
once we kill the container".

Let's fix the above test, also increasing the timeout waiting
for attach to exit (which fails from time to time on power CI).

Now, the second test, TestAttachDetachTruncatedID, does the exact
same thing, except it uses a truncated container ID. It does not
seem to be of much value, so let's remove it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-24 14:48:38 -07:00
Sebastiaan van Stijn
bf95fbc54f
Use errors.Wrap() in daemon errors, and cleanup messages
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-23 16:12:44 +02:00
John Howard
15a25f6eb9 Disable TestExecWindowsOpenHandles on RS5 temporarily
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-08-20 19:48:20 -07:00
Kir Kolyshkin
ac038eab29 integration-cli: error report improvements
1. After running d.Cmd(), in case an error is returned, it makes sense
to print command output, as its stderr may contain a clue about what
went wrong. This is by no means complete, just as far as I could go.

2. In case the comment in c.Assert is a constant string, it's better
to provide it as a comment which will be printed.

3. An arbitrary string should not be passed on to a function expecting
%-style formatting. Use %s to fix this.

4. Print the output string before transformation, not after.

5. Unify the output format (drop "out:" prefix").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-14 12:52:30 +03:00
Kir Kolyshkin
83363fb2d4 integration: use %s for check.Commentf()
It is wrong to pass an arbitrary string to a function expecting
%-style formatting. One solution would be to replace any % with %%,
but it's easier to just do what this patch does.

Generated with:

for f in $(git grep -l 'check.Commentf(out)'); do \
	sed -i -e 's/check\.Commentf(out)/check.Commentf("%s", out)/g' $f; \
done

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-14 10:45:39 +03:00
Yong Tang
80c92c9b69 Migrate some ipc container test from integration-cli to integration
This fix migrates some ipc container tests from integration-cli
to integration test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-08-01 21:51:45 +00:00
Sebastiaan van Stijn
27f663a253
Merge pull request #37573 from thaJeztah/windows-rs3-ci
Temporarily disable failing tests on Windows RS3
2018-08-01 12:16:12 +02:00
Vincent Demeester
9149ef67be
Merge pull request #37438 from adshmh/fix-flaky-test-TestRunContainerWithBridgeNone
fix the race condition in the integration test TestRunContainerWithBridgeNone
2018-08-01 09:57:29 +02:00
John Stephens
1b05ea4727
Temporarily disable failing tests on Windows RS3
Signed-off-by: John Stephens <johnstep@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-31 23:49:36 +02:00
Vincent Demeester
c2e3657b17
Revert "migrated service integration tests from integration-cli/docker_cli_service_update_test.go to integration/service"
This reverts commit fbaef1b0d3.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-27 17:35:52 +02:00
Arash Deshmeh
fbaef1b0d3 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>
2018-07-25 14:49:02 -04:00
Arash Deshmeh
7073aa8a3a migrated container wait integration tests from integration-cli to integration/container package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-23 17:37:21 -04:00
Arash Deshmeh
cd4d1cfc10 migrate integration tests from integration-cli/docker_api_create_test.go to integration/container
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-18 13:15:04 -04:00
Arash Deshmeh
05a9e6239a migrated integration tests from integration-cli/docker_cli_secret_create_test.go to integration/secret
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-17 16:38:37 -04:00
Vincent Demeester
a5495f289a
Merge pull request #37457 from adshmh/migrate-docker_cli_config_create_test-integration-tests-to-integration-config
moved integration tests from docker_cli_config_create_test.go to integration/config
2018-07-16 14:00:44 +02:00
Arash Deshmeh
0e57ceae0d moved integration tests from docker_cli_config_create_test.go to integration/config
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-13 17:29:02 -04:00
Flavio Crisciani
a2bb2144b3
Fix flakyness in TestDockerNetworkInternalMode
Instead of waiting for the DNS to fail, try to access
a specific external IP and verify that 100% of the pakcets
are being lost.

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-13 11:43:38 -07:00
Sebastiaan van Stijn
f9470d8189
Merge pull request #37422 from thaJeztah/fix-linting-errors
Fix some golint and ineffassign issues
2018-07-13 00:25:46 +02:00
Sandeep Bansal
76ace9bb5e Fix error string in docker CLI test
Signed-off-by: Sandeep Bansal <sabansal@microsoft.com>
2018-07-11 23:02:44 -07:00
Sebastiaan van Stijn
ddd8a6572d
Fix ineffassign linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-11 22:18:45 +02:00
Arash Deshmeh
7cda9d8e97 fixed the race condition in the integration test TestRunContainerWithBridgeNone
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-11 10:37:00 -04:00
Vincent Demeester
aba2735e3f
Merge pull request #37394 from yongtang/07052018-ipcmode
Migrate some ipcmode tests to integration
2018-07-06 10:00:03 +02:00
Yong Tang
e0403604e2 Migrate some ipcmode tests to integration
This fix migrates some ipcmode tests in integration-cli
to integration tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-07-04 16:32:18 +00:00
Chris Telfer
efb7909bef Update tests w/ new libnetwork contraints
The TestDockerNetworkIPAMMultipleNetworks test allocates several
networks simultaneously with overlapping IP addresses.  Libnetwork now
forbids this.  Adjust the test case to use distinct IP ranges for the
networks it creates.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-29 15:15:52 -04:00
Sebastiaan van Stijn
af626ba08a
Merge pull request #37293 from adshmh/migrate-TestNetworkCreateDelete-to-integration
migrate TestAPINetworkCreateDelete from integration-cli/ to integration/
2018-06-21 19:08:08 -07:00
Sebastiaan van Stijn
754aeb28fd
Fix TestDaemonNoSpaceLeftOnDeviceError
This test is testing if any "no space left on device" errors
that occur during `docker pull` will not be masked by other
errors. To test for this, a new loopback-device was created,
and used as `--data-dir` ("/var/lib/docker").

However, `/var/lib/docker` is used for storing various
other things, including a `cache.db` database, used by
BuildKit, which is created during startup of the daemon.
Creation of that file failed (due to `--data-dir` path
being on a mount with limited size), which caused daemon
start to fail before the test was able to run.

This patch changes the size-limited mount to be used for
the storage-driver directory only, so that the test is
not affected by other parts of the code attempting to
write files in it.

To have a predictable path; the daemon used in this test
is configured to use the `vfs` storage-driver.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-19 16:14:12 -07:00
Arash Deshmeh
f542621429 migrate TestAPINetworkCreateDelete from integration-cli/ to integration/
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-06-15 16:06:45 -04:00
Vincent Demeester
3845728524
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-13 09:04:30 +02:00
Tibor Vass
c752b0991e
Merge pull request #37151 from tonistiigi/experimental-buildkit
Experimental BuildKit support
2018-06-12 13:31:48 -07:00
Vincent Demeester
f929f15dd6
Upgrade imdario/mergo to v0.3.5
Mainly to get inline with `docker/cli` version of that dependency

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-11 15:30:46 +02:00
Tonis Tiigi
b1942bc015 integration-cli: fix error message for non-buildkit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-10 10:05:31 -07:00
Tonis Tiigi
1f09adbe16 integration-cli: fix health test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-10 10:05:29 -07:00
Tibor Vass
9cc49b4ab9 builder: have TestBuildDockerignoringBadExclusion pass with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-10 10:05:28 -07:00
Tibor Vass
60a911dfca builder: Add TODOBuildkit test requirement, specifically for TestBuildCancellationKillsSleep
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-10 10:05:28 -07:00
Sebastiaan van Stijn
5e11f66cb6
Merge pull request #37172 from zq-david-wang/resizefix2
Fix race condition between exec start and resize.
2018-06-08 15:43:25 -07:00
David Wang
e6783656f9 Fix race condition between exec start and resize
Signed-off-by: David Wang <00107082@163.com>
2018-06-08 11:07:48 +08:00
Sebastiaan van Stijn
ca25df3b54
Merge pull request #37194 from AntaresS/fix-test-failure
fix a failed test
2018-06-05 02:38:04 +02:00
Sebastiaan van Stijn
5037c5a8ce
Merge pull request #36688 from cpuguy83/volumes_service
Extract volume interaction to a volumes service
2018-06-05 02:16:20 +02:00
Anda Xu
1d9973c0d4 fix a failed test
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-06-04 14:29:00 -07:00
Tonis Tiigi
c9ebd2f13b vendor: use dockerfile parser from buildkit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-02 11:10:34 -07:00
Dennis Chen
386e0f36c4 Alternative failure mitigation of TestExecInteractiveStdinClose
Begin to copy the data until the command to exit and any coping to
stdin or copy from stdout/stderr has completed.
Also adding defense code to trim the possible '\x00' null value.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2018-05-28 11:25:31 +08:00
Brian Goff
e4b6adc88e Extract volume interaction to a volumes service
This cleans up some of the package API's used for interacting with
volumes, and simplifies management.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-25 14:21:07 -04:00
Sebastiaan van Stijn
f23c00d870
Various code-cleanup
remove unnescessary import aliases, brackets, and so on.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-23 17:50:54 +02:00
Kir Kolyshkin
0823ab7099 TestContainerAPITop: fix flakyness
The following failure is seen in CI from time to time:

> FAIL: docker_api_containers_test.go:435: DockerSuite.TestContainerAPITop
>
> docker_api_containers_test.go:453:
>     c.Assert(top.Processes[0][10], checker.Equals, "/bin/sh -c top")
> ... obtained string = "top"
> ... expected string = "/bin/sh -c top"

The test case expects two processes in the output:

1. /bin/sh -c top
2. top

in the given order.

Now, "ps aux" output is sorted by PID*, and so since the "top" is a child
of "/bin/sh -c top" it has a higher PID and will come second as expected
by the test... unless the PIDs on the system are exhausted and PID rollover
happens, in which case PID of "top" will be lower than that of "/bin/sh".

Fix: sort output by process name.

* - in fact it is not sorted, but is being printed in the same order as
    the kernel list PID entries in /proc directory, which appears to be
    sorted by PID (see ls -1 -U /proc).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-22 18:11:36 -07:00
Anda Xu
b9b4f88870 more fixes on integration
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-05-22 11:25:25 -07:00
Dennis Chen
476d7872ef Some slight tweaks for the integration test
`arm64` needs get more time duration for the test to finish.

`pty.Start()` opens a file, so the caller should close it explicitly,
else the file I/O can result in unexpected data synchronization issue.

All those changes will not affect the test itself.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2018-05-21 10:08:27 +08:00
Vincent Demeester
b7b6b6929c
Merge pull request #37076 from arm64b/TestExecInteractiveStdinClose
Fix flaky test case of `TestExecInteractiveStdinClose`
2018-05-16 09:51:28 +02:00
Dennis Chen
96abf9f59e Fix flaky test case of TestExecInteractiveStdinClose
This issue has been reported by issue #36877.

The purpose of this test case is for the regression test of #12546,
so we only need to make sure the essential of the testing is still
in the way to check that while not disturbed by some testing noises,
which is exactly what this PR want to do.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2018-05-16 10:01:44 +08:00
Anda Xu
e440831802 fix and skip some tests based on API version
Signed-off-by: Anda Xu <anda.xu@docker.com>

Co-authored-by: Anda Xu <anda.xu@docker.com>
Co-authored-by: Tibor Vass <tibor@docker.com>
2018-05-15 16:05:04 -07:00
Yong Tang
bd5eb6b402
Merge pull request #36612 from kolyshkin/t-attach
TestPostContainersAttach: minor improvements
2018-05-08 03:26:25 +02:00
John Stephens
72192f5052
Add tests related to hcsshim recycle bin skipping
Signed-off-by: John Stephens <johnstep@docker.com>
2018-05-03 13:37:18 -07:00
Kir Kolyshkin
ecc54889c9 TestPostContainerAttach: minor improvements
When this test fails, the error looks like this:

> FAIL: docker_api_attach_test.go:98: DockerSuite.TestPostContainersAttach
> docker_api_attach_test.go:211:
>     c.Assert(actualStdout.Bytes(), checker.DeepEquals, []byte("hello\nsuccess"), check.Commentf("Attach didn't return the expected data from stdout"))
> ... obtained []uint8 = []byte{0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73}
> ... expected []uint8 = []byte{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73}
> ... Attach didn't return the expected data from stdout

Let's use strings for comparisons to make the output more readable.

While at it,
- get the container's stderr as well, and make sure it's empty;
- check that stdcopy.StdCopy() did not return an error, except for
  the timeout which is expected;
- move/remove comments, simplify var names.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-03 10:15:48 -07:00
Dennis Chen
a95fabc70e Add --target name case sensitive test code for multi-stage build
Add testing code to cover the `--target` name case sensitive
issue reported by issue #36956.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2018-05-01 11:31:52 +08:00
Kir Kolyshkin
7d62e40f7e Switch from x/net/context -> context
Since Go 1.7, context is a standard package. Since Go 1.9, everything
that is provided by "x/net/context" is a couple of type aliases to
types in "context".

Many vendored packages still use x/net/context, so vendor entry remains
for now.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-23 13:52:44 -07:00
Vincent Demeester
53982e3fc1
Merge pull request #36091 from kolyshkin/mount
pkg/mount improvements
2018-04-21 11:03:54 +02:00
Vincent Demeester
7d9cbfa96f
Merge pull request #36744 from kolyshkin/t-enospc
TestDaemonNoSpaceLeftOnDeviceError: simplify
2018-04-20 15:40:39 +02:00
Brian Goff
4da83efdfb
Merge pull request #36875 from vdemeester/integration-cli-some-fixme
[test/integration-cli] small cleanups of FIXME(s)
2018-04-19 20:31:27 -04:00
Kir Kolyshkin
bb934c6aca pkg/mount: implement/use filter for mountinfo parsing
Functions `GetMounts()` and `parseMountTable()` return all the entries
as read and parsed from /proc/self/mountinfo. In many cases the caller
is only interested only one or a few entries, not all of them.

One good example is `Mounted()` function, which looks for a specific
entry only. Another example is `RecursiveUnmount()` which is only
interested in mount under a specific path.

This commit adds `filter` argument to `GetMounts()` to implement
two things:
 1. filter out entries a caller is not interested in
 2. stop processing if a caller is found what it wanted

`nil` can be passed to get a backward-compatible behavior, i.e. return
all the entries.

A few filters are implemented:
 - `PrefixFilter`: filters out all entries not under `prefix`
 - `SingleEntryFilter`: looks for a specific entry

Finally, `Mounted()` is modified to use `SingleEntryFilter()`, and
`RecursiveUnmount()` is using `PrefixFilter()`.

Unit tests are added to check filters are working.

[v2: ditch NoFilter, use nil]
[v3: ditch GetMountsFiltered()]
[v4: add unit test for filters]
[v5: switch to gotestyourself]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-19 14:48:09 -07:00
Vincent Demeester
69bab3832c
Migrate test-integration-cli experimental plugin tests to integration
All `plugins` tests that require an `ExperimentalDaemon` are migrated
to `integration/plugin/*` and start an experimental daemon to test on
it.

The end goal being to remove the `experimental` build.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-19 11:57:28 +02:00
Sebastiaan van Stijn
f1783da736
Merge pull request #36865 from vdemeester/integration-move-swarm-plugin-test
Migrate TestAPISwarmServicesPlugin to integration
2018-04-18 21:15:59 -07:00
Brian Goff
6cd806aa53
Merge pull request #36637 from cpuguy83/no_global_driver_store
No global volume driver store
2018-04-18 16:32:23 -04:00
Vincent Demeester
5d2afe4f51
Remove daemon.BuildImageWithOut and use cli helpers function
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-18 16:45:55 +02:00
Vincent Demeester
aa0db6f9e1
Migrate TestAPISwarmServicesPlugin to integration
Also starts to create more "poll/check" function to `internal/test/daemon`.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-18 16:18:53 +02:00
Vincent Demeester
3b01e92c9a
Add a Cleanup function that cleans exec root and swarm files
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-18 16:14:50 +02:00
Brian Goff
0023abbad3 Remove old/uneeded volume migration from vers 1.7
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-04-17 14:06:53 -04:00
Vincent Demeester
42f6fdf059
Move integration-cli/request to internal/test/request…
… and change a bit the method signature

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-17 16:25:59 +02:00
Vincent Demeester
9722214c8a
Add api helpers to internal/test/daemon.Daemon
Porting helpers from `integration-cli/daemon.Daemon` to this struct
and use the API instead of the cli.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-17 16:24:31 +02:00
Vincent Demeester
062564084a
Move fakecontext, fakegit and fakestorage to internal/test
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-17 09:53:09 +02:00
Anusha Ragunathan
abb1661907
Merge pull request #36841 from yongtang/02222018-tag-test
Migrate image tag tests from integration-cli to api tests
2018-04-16 17:53:48 -07:00
Anusha Ragunathan
f9c4e63026
Merge pull request #36838 from vdemeester/integration-fixtures-refactoring
Clean some integration-cli/fixtures package/files
2018-04-16 17:49:29 -07:00
Vincent Demeester
5f56503f58
Clean some integration-cli/fixtures package/files
- Move go package used by both `integration-cli` and `integration` to
  `internal/test/fixtures`.
- Remove fixtures that are not used anymore (moved to `docker/cli` a
  while ago) : deploy, notary, secrets.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-16 10:48:58 +02:00
Vincent Demeester
239a8a5189
Small daemon refactoring and add swarm init/join helpers
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-16 10:20:10 +02:00