mirror of https://github.com/docker/compose.git
working_dir is no longer optional
When building test data using make_service_dict, we need to include working_dir as it is core to some of the functionality of ServiceLoader. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
c6e03d739d
commit
6e6dbdad95
|
@ -134,7 +134,7 @@ def load(config_details):
|
|||
return service_dicts
|
||||
|
||||
|
||||
def make_service_dict(name, service_dict, working_dir=None):
|
||||
def make_service_dict(name, service_dict, working_dir):
|
||||
return ServiceLoader(working_dir=working_dir).make_service_dict(name, service_dict)
|
||||
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ class ConfigTest(unittest.TestCase):
|
|||
def test_config_validation(self):
|
||||
self.assertRaises(
|
||||
config.ConfigurationError,
|
||||
lambda: config.make_service_dict('foo', {'port': ['8000']})
|
||||
lambda: config.make_service_dict('foo', {'port': ['8000']}, 'tests/')
|
||||
)
|
||||
config.make_service_dict('foo', {'ports': ['8000']})
|
||||
config.make_service_dict('foo', {'ports': ['8000']}, 'tests/')
|
||||
|
||||
|
||||
class VolumePathTest(unittest.TestCase):
|
||||
|
@ -219,36 +219,36 @@ class MergeLabelsTest(unittest.TestCase):
|
|||
|
||||
def test_no_override(self):
|
||||
service_dict = config.merge_service_dicts(
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar']}),
|
||||
config.make_service_dict('foo', {}),
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar']}, 'tests/'),
|
||||
config.make_service_dict('foo', {}, 'tests/'),
|
||||
)
|
||||
self.assertEqual(service_dict['labels'], {'foo': '1', 'bar': ''})
|
||||
|
||||
def test_no_base(self):
|
||||
service_dict = config.merge_service_dicts(
|
||||
config.make_service_dict('foo', {}),
|
||||
config.make_service_dict('foo', {'labels': ['foo=2']}),
|
||||
config.make_service_dict('foo', {}, 'tests/'),
|
||||
config.make_service_dict('foo', {'labels': ['foo=2']}, 'tests/'),
|
||||
)
|
||||
self.assertEqual(service_dict['labels'], {'foo': '2'})
|
||||
|
||||
def test_override_explicit_value(self):
|
||||
service_dict = config.merge_service_dicts(
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar']}),
|
||||
config.make_service_dict('foo', {'labels': ['foo=2']}),
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar']}, 'tests/'),
|
||||
config.make_service_dict('foo', {'labels': ['foo=2']}, 'tests/'),
|
||||
)
|
||||
self.assertEqual(service_dict['labels'], {'foo': '2', 'bar': ''})
|
||||
|
||||
def test_add_explicit_value(self):
|
||||
service_dict = config.merge_service_dicts(
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar']}),
|
||||
config.make_service_dict('foo', {'labels': ['bar=2']}),
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar']}, 'tests/'),
|
||||
config.make_service_dict('foo', {'labels': ['bar=2']}, 'tests/'),
|
||||
)
|
||||
self.assertEqual(service_dict['labels'], {'foo': '1', 'bar': '2'})
|
||||
|
||||
def test_remove_explicit_value(self):
|
||||
service_dict = config.merge_service_dicts(
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar=2']}),
|
||||
config.make_service_dict('foo', {'labels': ['bar']}),
|
||||
config.make_service_dict('foo', {'labels': ['foo=1', 'bar=2']}, 'tests/'),
|
||||
config.make_service_dict('foo', {'labels': ['bar']}, 'tests/'),
|
||||
)
|
||||
self.assertEqual(service_dict['labels'], {'foo': '1', 'bar': ''})
|
||||
|
||||
|
@ -295,6 +295,7 @@ class EnvTest(unittest.TestCase):
|
|||
'NO_DEF': None
|
||||
},
|
||||
},
|
||||
'tests/'
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
|
|
Loading…
Reference in New Issue