From 2cc4e9e5e902fb324ee1f23bf08d31773abf8903 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Fri, 26 Jan 2018 16:32:20 -0800 Subject: [PATCH 1/2] Add e2e container kill test Signed-off-by: Vincent Demeester Upstream-commit: 42edad2fc73bb83af21bd0cad92df496a44e76ea Component: cli --- components/cli/e2e/container/kill_test.go | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 components/cli/e2e/container/kill_test.go diff --git a/components/cli/e2e/container/kill_test.go b/components/cli/e2e/container/kill_test.go new file mode 100644 index 0000000000..25a158c113 --- /dev/null +++ b/components/cli/e2e/container/kill_test.go @@ -0,0 +1,53 @@ +package container + +import ( + "strings" + "testing" + "time" + + "github.com/docker/cli/e2e/internal/fixtures" + "github.com/gotestyourself/gotestyourself/icmd" + "github.com/gotestyourself/gotestyourself/poll" +) + +func TestKillContainer(t *testing.T) { + containerID := runBackgroundTop(t) + + // Kill with SIGTERM should kill the process + result := icmd.RunCmd( + icmd.Command("docker", "kill", "-s", "SIGTERM", containerID), + ) + + result.Assert(t, icmd.Success) + poll.WaitOn(t, containerStatus(t, containerID, "exited"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(5*time.Second)) + + // Kill on a stop container should return an error + result = icmd.RunCmd( + icmd.Command("docker", "kill", containerID), + ) + result.Assert(t, icmd.Expected{ + ExitCode: 1, + Err: "is not running", + }) +} + +func runBackgroundTop(t *testing.T) string { + result := icmd.RunCmd(shell(t, + "docker run -d %s top", fixtures.AlpineImage)) + result.Assert(t, icmd.Success) + return strings.TrimSpace(result.Stdout()) +} + +func containerStatus(t *testing.T, containerID, status string) func(poll.LogT) poll.Result { + return func(poll.LogT) poll.Result { + result := icmd.RunCmd( + shell(t, "docker inspect -f '{{ .State.Status }}' %s", containerID), + ) + result.Assert(t, icmd.Success) + actual := strings.TrimSpace(result.Stdout()) + if actual == status { + return poll.Success() + } + return poll.Continue("expected status %s != %s", status, actual) + } +} From ffb77fa93a661c837ea4a7800d3a10f71e2a7276 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Fri, 9 Feb 2018 14:19:48 +0100 Subject: [PATCH 2/2] Update reference docs for docker stack deploy `docker stack deploy` now support multiple composefil. This updates the reference doc to take that fact into account. Signed-off-by: Vincent Demeester Upstream-commit: 4c50007496130b2e4bb59899fa94b8d2f7cbcbc2 Component: cli --- .../cli/docs/reference/commandline/stack_deploy.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/cli/docs/reference/commandline/stack_deploy.md b/components/cli/docs/reference/commandline/stack_deploy.md index 9f1ea3df60..b474d50875 100644 --- a/components/cli/docs/reference/commandline/stack_deploy.md +++ b/components/cli/docs/reference/commandline/stack_deploy.md @@ -25,7 +25,7 @@ Aliases: Options: --bundle-file string Path to a Distributed Application Bundle file - -c, --compose-file string Path to a Compose file + -c, --compose-file strings Path to a Compose file --help Print usage --prune Prune services that are no longer referenced --resolve-image string Query the registry to resolve image digest and supported platforms @@ -76,14 +76,12 @@ Creating service vossibility_ghollector Creating service vossibility_lookupd ``` -Only a single Compose file is accepted. If your configuration is split between -multiple Compose files, e.g. a base configuration and environment-specific overrides, -you can combine these by passing them to `docker-compose config` with the `-f` option -and redirecting the merged output into a new file. +If your configuration is split between multiple Compose files, e.g. a base +configuration and environment-specific overrides, you can provide multiple +`--compose-file` flags. ```bash -$ docker-compose -f docker-compose.yml -f docker-compose.prod.yml config > docker-stack.yml -$ docker stack deploy --compose-file docker-stack.yml vossibility +$ docker stack deploy --compose-file docker-compose.yml -f docker-compose.prod.yml vossibility Ignoring unsupported options: links