Commands able to use this parallelisation are `stop`, `kill` and `rm`.
We're using a backported function from python 3, to allow us to make
the most of a pool of threads without having to write the low level
code for managing this ourselves.
A default value for number of threads is a low enough number so it
shouldn't cause performance problems but if someone knows the
capability of their system and wants to increase it, they can via
an environment variable DEFAULT_MAX_WORKERS
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
Rather than creating a docker client within each test, create one
at setup and make it accessible to the whole class.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
Change in behaviour, `file` key is optional and if not set the
default is to look within the same file as `extends` is defined.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
When specifying a log_driver you want to specify some options for
the logger as per the docker run --log-opt option. The logger
options are key value pairs.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
By allowing the memswap_limit option to be defined we also need to
check that mem_limit is set, you can't have swap without a limit.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
Also warn the user about the one-off containers in the standard error
message about legacy containers.
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This top level function is a test helper, so I've moved it into the
config_test file and updated accordingly.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
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>
If you have an alternate YAML file with different services defined,
containers for those services will be shown in `docker-compose ps` even
if you don't pass that file in.
Furthermore, `docker-compose rm` will claim that it's going to remove
them, but actually won't.
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
When specifying the 'file' key to a value of it's own name, test
that this works and does not cause a false positive circular reference
error.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
In our circular reference check the stack was previously off by one,
by not including the current service name that was calling another.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
A circular reference bug occurs when there is a difference in the paths
of the file specified in the extends. So one time it is relative, second
time is absolute thus allowing a further circular reference to occur.
By using absolute paths we can be sure that the service filename check
is correct.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This refactoring allows us to raise an error when there is no
'file' key specified in the .yml and no self.filename set. This
error was specific to the tests, as the tests are
the only place that constructs service dicts without sometimes
setting a filename.
Moving the function within the class as well as it is code that
is exclusively for the use of validating properties for the
ServiceLoader class.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
Split them out into individual validation tests so it is clearer
to see what is going on and to enable adding further validation
tests.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
If we're using self.filename, then it's already a full path and we
don't need to splice off the filename.yml just so we can .join it
back together again.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
If the 'file' key is not set in the extends_options dict then we
look for the 'service' from within the same file.
Fixes this issue: https://github.com/docker/compose/issues/1237
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
The process function contained purely validation checks, so re-named
the function to aid intent clarity.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>