Merge pull request #2893 from shin-/2833-run-dependencies

Bring up all dependencies when running a single service.
This commit is contained in:
Daniel Nephin 2016-02-12 16:33:01 -05:00
commit 74dc1b1411
3 changed files with 23 additions and 1 deletions

View File

@ -703,7 +703,7 @@ def image_type_from_opt(flag, value):
def run_one_off_container(container_options, project, service, options):
if not options['--no-deps']:
deps = service.get_linked_service_names()
deps = service.get_dependency_names()
if deps:
project.up(
service_names=deps,

View File

@ -738,6 +738,15 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(len(db.containers()), 1)
self.assertEqual(len(console.containers()), 0)
@v2_only()
def test_run_service_with_dependencies(self):
self.base_dir = 'tests/fixtures/v2-dependencies'
self.dispatch(['run', 'web', '/bin/true'], None)
db = self.project.get_service('db')
console = self.project.get_service('console')
self.assertEqual(len(db.containers()), 1)
self.assertEqual(len(console.containers()), 0)
def test_run_with_no_deps(self):
self.base_dir = 'tests/fixtures/links-composefile'
self.dispatch(['run', '--no-deps', 'web', '/bin/true'])

View File

@ -0,0 +1,13 @@
version: "2.0"
services:
db:
image: busybox:latest
command: top
web:
image: busybox:latest
command: top
depends_on:
- db
console:
image: busybox:latest
command: top