Common Test Docker Compose Hook
A Common Test hook for starting and stopping docker-compose services.
Hooks can be declared in rebar.config with ct_opts:
{ct_opts, [{ct_hooks, [docker_compose_cth]}]}.
Or, it can be done on a per-suite basis including the suite/0 function in the suite module:
suite() ->
[{ct_hooks, [docker_compose_cth]}].
For additional methods for installing and configuring the hook check the docs
Configuration
executable_search_paths: Path to search for thedocker-composeexecutable. If it is not set the regular path is searched as described in the docs for os:find_executable/1.check_if_running: A string that is the name of the service to check for before runningdocker-compose up. If defined the hook will check if a service is already up and not calldocker-compose upif it is. By default this is done by attemptingexec lsin the service's container, but the command can be set to anything by passing a tuple{Service, Command}skip_or_fail: The atomskiporfail(default isfail). If the hook is unable to bring up the service with docker-compose then the suite will either skip or fail, depending on this configuration.
Todo
- Support a path to the
docker-compose.ymlfile. - Support shutting down the compose services post suite.
- Support never shutting down the compose services.