Expand depends_on to allow different conditions (service_start, service_healthy)

Rework "up" and "start" to wait on conditional state of dependent services
Add integration tests

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-12-19 20:20:03 -08:00
commit 04394b1d0a
10 changed files with 228 additions and 18 deletions

View file

@ -920,7 +920,10 @@ class ConfigTest(unittest.TestCase):
'build': {'context': os.path.abspath('/')},
'image': 'example/web',
'volumes': [VolumeSpec.parse('/home/user/project:/code')],
'depends_on': ['db', 'other'],
'depends_on': {
'db': {'condition': 'container_start'},
'other': {'condition': 'container_start'},
},
},
{
'name': 'db',
@ -3055,7 +3058,9 @@ class ExtendsTest(unittest.TestCase):
image: example
""")
services = load_from_filename(str(tmpdir.join('docker-compose.yml')))
assert service_sort(services)[2]['depends_on'] == ['other']
assert service_sort(services)[2]['depends_on'] == {
'other': {'condition': 'container_start'}
}
@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash')

View file

@ -25,7 +25,7 @@ deps = {
def get_deps(obj):
return deps[obj]
return [(dep, None) for dep in deps[obj]]
def test_parallel_execute():