From a75b6249f83be2e1b8fadc40b2c29aa7d09921ef Mon Sep 17 00:00:00 2001 From: aiordache Date: Mon, 14 Sep 2020 11:41:30 +0200 Subject: [PATCH 1/2] Fix depends_on serialisation on `docker-compose config` Signed-off-by: aiordache --- compose/config/serialize.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/compose/config/serialize.py b/compose/config/serialize.py index 2dd2c47f1..2d9493a03 100644 --- a/compose/config/serialize.py +++ b/compose/config/serialize.py @@ -121,11 +121,6 @@ def denormalize_service_dict(service_dict, version, image_digest=None): if version == V1 and 'network_mode' not in service_dict: service_dict['network_mode'] = 'bridge' - if 'depends_on' in service_dict: - service_dict['depends_on'] = sorted([ - svc for svc in service_dict['depends_on'].keys() - ]) - if 'healthcheck' in service_dict: if 'interval' in service_dict['healthcheck']: service_dict['healthcheck']['interval'] = serialize_ns_time_value( From fa720787d62cf833ed7648ff55dbd248267a5b74 Mon Sep 17 00:00:00 2001 From: aiordache Date: Mon, 14 Sep 2020 18:01:35 +0200 Subject: [PATCH 2/2] update depends_on tests Signed-off-by: aiordache --- tests/unit/config/config_test.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 63eece17e..b1586ae1f 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -5269,7 +5269,7 @@ def get_config_filename_for_files(filenames, subdir=None): class SerializeTest(unittest.TestCase): - def test_denormalize_depends_on_v3(self): + def test_denormalize_depends(self): service_dict = { 'image': 'busybox', 'command': 'true', @@ -5279,27 +5279,7 @@ class SerializeTest(unittest.TestCase): } } - assert denormalize_service_dict(service_dict, VERSION) == { - 'image': 'busybox', - 'command': 'true', - 'depends_on': ['service2', 'service3'] - } - - def test_denormalize_depends_on_v2_1(self): - service_dict = { - 'image': 'busybox', - 'command': 'true', - 'depends_on': { - 'service2': {'condition': 'service_started'}, - 'service3': {'condition': 'service_started'}, - } - } - - assert denormalize_service_dict(service_dict, VERSION) == { - 'image': 'busybox', - 'command': 'true', - 'depends_on': ['service2', 'service3'] - } + assert denormalize_service_dict(service_dict, VERSION) == service_dict def test_serialize_time(self): data = {