From 089ec6652223acdde9c594aadfc104237e1cfbf8 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 14 Mar 2016 22:02:25 -0400 Subject: [PATCH 1/2] Include network settings as part of the service config hash. Signed-off-by: Daniel Nephin --- compose/service.py | 2 +- tests/unit/service_test.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compose/service.py b/compose/service.py index 30d28e4c6..3f77ce4e7 100644 --- a/compose/service.py +++ b/compose/service.py @@ -498,7 +498,7 @@ class Service(object): 'image_id': self.image()['Id'], 'links': self.get_link_names(), 'net': self.network_mode.id, - 'networks': list(self.networks.keys()), + 'networks': self.networks, 'volumes_from': [ (v.source.name, v.mode) for v in self.volumes_from if isinstance(v.source, Service) diff --git a/tests/unit/service_test.py b/tests/unit/service_test.py index 199aeeb43..45836e01c 100644 --- a/tests/unit/service_test.py +++ b/tests/unit/service_test.py @@ -285,7 +285,7 @@ class ServiceTest(unittest.TestCase): self.assertEqual( opts['labels'][LABEL_CONFIG_HASH], - 'f8bfa1058ad1f4231372a0b1639f0dfdb574dafff4e8d7938049ae993f7cf1fc') + '2524a06fcb3d781aa2c981fc40bcfa08013bb318e4273bfa388df22023e6f2aa') assert opts['environment'] == ['also=real'] def test_get_container_create_options_sets_affinity_with_binds(self): @@ -501,6 +501,7 @@ class ServiceTest(unittest.TestCase): image='example.com/foo', client=self.mock_client, network_mode=ServiceNetworkMode(Service('other')), + networks={'default': None}, links=[(Service('one'), 'one')], volumes_from=[VolumeFromSpec(Service('two'), 'rw', 'service')]) @@ -510,7 +511,7 @@ class ServiceTest(unittest.TestCase): 'options': {'image': 'example.com/foo'}, 'links': [('one', 'one')], 'net': 'other', - 'networks': [], + 'networks': {'default': None}, 'volumes_from': [('two', 'rw')], } assert config_dict == expected @@ -531,7 +532,7 @@ class ServiceTest(unittest.TestCase): 'image_id': 'abcd', 'options': {'image': 'example.com/foo'}, 'links': [], - 'networks': [], + 'networks': {}, 'net': 'aaabbb', 'volumes_from': [], } From dfac48f3f58fb777ae8d5e577f1fb1c6fc000e4c Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 16 Mar 2016 22:37:28 -0400 Subject: [PATCH 2/2] Make a new flaky test less flaky. Signed-off-by: Daniel Nephin --- tests/acceptance/cli_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index f06b32801..ee1eed539 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -1226,6 +1226,10 @@ class CLITestCase(DockerClientTestCase): 'logscomposefile_another_1', 'exited')) + # sleep for a short period to allow the tailing thread to receive the + # event. This is not great, but there isn't an easy way to do this + # without being able to stream stdout from the process. + time.sleep(0.5) os.kill(proc.pid, signal.SIGINT) result = wait_on_process(proc, returncode=1) assert 'test' in result.stdout