Revert -d/--timeout exclusion

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2018-01-11 12:24:38 -08:00
parent ac34a8302b
commit e174c3fd1c
3 changed files with 18 additions and 20 deletions

View File

@ -926,30 +926,29 @@ class TopLevelCommand(object):
Options:
-d Detached mode: Run containers in the background,
print new container names. Incompatible with
--abort-on-container-exit and --timeout.
--abort-on-container-exit.
--no-color Produce monochrome output.
--no-deps Don't start linked services.
--force-recreate Recreate containers even if their configuration
and image haven't changed.
--always-recreate-deps Recreate dependent containers.
Incompatible with --no-recreate.
--no-recreate If containers already exist, don't recreate them.
Incompatible with --force-recreate.
--no-recreate If containers already exist, don't recreate
them. Incompatible with --force-recreate.
--no-build Don't build an image, even if it's missing.
--no-start Don't start the services after creating them.
--build Build images before starting containers.
--abort-on-container-exit Stops all containers if any container was stopped.
Incompatible with -d.
-t, --timeout TIMEOUT Use this timeout in seconds for container shutdown
when attached or when containers are already.
Incompatible with -d.
running. (default: 10)
--abort-on-container-exit Stops all containers if any container was
stopped. Incompatible with -d.
-t, --timeout TIMEOUT Use this timeout in seconds for container
shutdown when attached or when containers are
already running. (default: 10)
--remove-orphans Remove containers for services not
defined in the Compose file
--exit-code-from SERVICE Return the exit code of the selected service container.
Implies --abort-on-container-exit.
--scale SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale`
setting in the Compose file if present.
--exit-code-from SERVICE Return the exit code of the selected service
container. Implies --abort-on-container-exit.
--scale SERVICE=NUM Scale SERVICE to NUM instances. Overrides the
`scale` setting in the Compose file if present.
"""
start_deps = not options['--no-deps']
always_recreate_deps = options['--always-recreate-deps']
@ -964,9 +963,6 @@ class TopLevelCommand(object):
if detached and (cascade_stop or exit_value_from):
raise UserError("--abort-on-container-exit and -d cannot be combined.")
if detached and timeout:
raise UserError("-d and --timeout cannot be combined.")
environment = Environment.from_env_file(self.project_dir)
ignore_orphans = environment.get_boolean('COMPOSE_IGNORE_ORPHANS')

View File

@ -1361,9 +1361,12 @@ class CLITestCase(DockerClientTestCase):
['up', '-d', '--force-recreate', '--no-recreate'],
returncode=1)
def test_up_with_timeout_detached(self):
result = self.dispatch(['up', '-d', '-t', '1'], returncode=1)
assert "-d and --timeout cannot be combined." in result.stderr
def test_up_with_timeout(self):
self.dispatch(['up', '-d', '-t', '1'])
service = self.project.get_service('simple')
another = self.project.get_service('another')
assert len(service.containers()) == 1
assert len(another.containers()) == 1
@mock.patch.dict(os.environ)
def test_up_with_ignore_remove_orphans(self):

View File

@ -1,5 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals