mirror of
https://github.com/docker/compose.git
synced 2025-07-24 06:04:57 +02:00
Merge pull request #279 from orchardup/fix-run-with-no-links
Stop `fig run` starting everything when a service has no links
This commit is contained in:
commit
9a825c5c35
@ -220,11 +220,14 @@ class TopLevelCommand(Command):
|
|||||||
service = self.project.get_service(options['SERVICE'])
|
service = self.project.get_service(options['SERVICE'])
|
||||||
|
|
||||||
if not options['--no-deps']:
|
if not options['--no-deps']:
|
||||||
self.project.up(
|
deps = service.get_linked_names()
|
||||||
service_names=service.get_linked_names(),
|
|
||||||
start_links=True,
|
if len(deps) > 0:
|
||||||
recreate=False
|
self.project.up(
|
||||||
)
|
service_names=deps,
|
||||||
|
start_links=True,
|
||||||
|
recreate=False,
|
||||||
|
)
|
||||||
|
|
||||||
tty = True
|
tty = True
|
||||||
if options['-d'] or options['-T'] or not sys.stdin.isatty():
|
if options['-d'] or options['-T'] or not sys.stdin.isatty():
|
||||||
|
@ -103,9 +103,13 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
|
|
||||||
|
|
||||||
@patch('dockerpty.start')
|
@patch('dockerpty.start')
|
||||||
def test_run_with_links(self, mock_stdout):
|
def test_run_service_without_links(self, mock_stdout):
|
||||||
mock_stdout.fileno = lambda: 1
|
self.command.base_dir = 'tests/fixtures/links-figfile'
|
||||||
|
self.command.dispatch(['run', 'console', '/bin/true'], None)
|
||||||
|
self.assertEqual(len(self.command.project.containers()), 0)
|
||||||
|
|
||||||
|
@patch('dockerpty.start')
|
||||||
|
def test_run_service_with_links(self, mock_stdout):
|
||||||
self.command.base_dir = 'tests/fixtures/links-figfile'
|
self.command.base_dir = 'tests/fixtures/links-figfile'
|
||||||
self.command.dispatch(['run', 'web', '/bin/true'], None)
|
self.command.dispatch(['run', 'web', '/bin/true'], None)
|
||||||
db = self.command.project.get_service('db')
|
db = self.command.project.get_service('db')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user