__init__ takes service name and dict
Moving service name and dict out of the function make_service_dict and into __init__. We always call make_service_dict with those so let's put them in the initialiser. Slightly cleaner design intent. The whole purpose of the ServiceLoader is to take a service name&service dictionary then validate, process and return service dictionaries ready to be created. This is also another step towards cleaning the code up so we can interpolate and validate an extended dictionary. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
1344533b24
commit
8a6061bfb9
3 changed files with 30 additions and 20 deletions
|
|
@ -31,7 +31,7 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
if 'command' not in kwargs:
|
||||
kwargs['command'] = ["top"]
|
||||
|
||||
options = ServiceLoader(working_dir='.', filename=None).make_service_dict(name, kwargs)
|
||||
options = ServiceLoader(working_dir='.', filename=None, service_name=name, service_dict=kwargs).make_service_dict()
|
||||
|
||||
labels = options.setdefault('labels', {})
|
||||
labels['com.docker.compose.test-name'] = self.id()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ def make_service_dict(name, service_dict, working_dir, filename=None):
|
|||
"""
|
||||
Test helper function to construct a ServiceLoader
|
||||
"""
|
||||
return config.ServiceLoader(working_dir=working_dir, filename=filename).make_service_dict(name, service_dict)
|
||||
return config.ServiceLoader(
|
||||
working_dir=working_dir,
|
||||
filename=filename,
|
||||
service_name=name,
|
||||
service_dict=service_dict).make_service_dict()
|
||||
|
||||
|
||||
def service_sort(services):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue