class Dockerspec::Runner::Serverspec::Compose
Runs Docker
Compose
using [Serverspec](serverspec.org/).
Public Class Methods
Constructs a Serverspec
runner class to run Docker
Compose
.
@example From a Directory
Dockerspec::Runner::Serverspec::Compose.new('directory1') #=> #<Dockerspec::Runner::Serverspec::Compose:0x0124>
@example From a YAML File
Dockerspec::Runner::Serverspec::Compose.new('my/docker-compose.yml') #=> #<Dockerspec::Runner::Serverspec::Compose:0x0124>
@example From a Directory or File Using Hash Format
Dockerspec::Runner::Serverspec::Compose.new(file: 'file.yml') #=> #<Dockerspec::Runner::Serverspec::Compose:0x0124>
@param opts [String, Hash] The `:file` or a list of options.
@option opts [String] :file The compose YAML file or a directory
containing the `'docker-compose.yml'` file.
@option opts [Boolean] :rm (calculated) Whether to remove the Docker
containers afterwards.
@option opts [Symbol, String] :family (calculated) The OS family if
is the the same for all the containers. It's automatically detected by default, but can be used to **speed up the tests**. Some possible values: `:alpine`, `:arch`, `:coreos`, `:debian`, `:gentoo`, `:nixos`, `:plamo`, `:poky`, `:redhat`, `:suse`.
@option opts [Symbol] :backend (calculated) Docker
backend to use:
`:docker`, `:lxc`.
@return [Dockerspec::Runner::Serverspec::Compose] Runner
object.
@api public
Dockerspec::Runner::Compose::new
# File lib/dockerspec/runner/serverspec/compose.rb, line 68 def initialize(*opts) super calculate_docker_backend_name('docker_compose') end
Protected Instance Methods
Sets the Specinfra configuration and the engines.
-
Sets up the testing engines.
-
Configures the compose file to use.
@return void
@api private
Dockerspec::Runner::Base#before_running
# File lib/dockerspec/runner/serverspec/compose.rb, line 99 def before_running super Specinfra.configuration.docker_compose_file(@options[:file]) end
Gets the internal {DockerCompose} object.
@return [DockerCompose] The compose object.
@api private
# File lib/dockerspec/runner/serverspec/compose.rb, line 82 def compose @cached_compose ||= begin backend = Engine::Specinfra::Backend.new(backend_name) backend.backend_instance_attribute(:compose) end end