Class: Dockerspec::Runner::Serverspec::Compose

Inherits:
Compose
  • Object
show all
Includes:
Base
Defined in:
lib/dockerspec/runner/serverspec/compose.rb

Overview

Runs Docker Compose using Serverspec.

Constant Summary

Constants inherited from Compose

Compose::OPTIONS_DEFAULT_KEY

Constants inherited from Base

Base::OPTIONS_DEFAULT_KEY

Instance Attribute Summary

Attributes included from Base

#backend_name

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods included from Base

#finalize, #to_s

Methods inherited from Compose

#container, #container_name, #finalize, #options, #run, #select_container, #to_s

Methods included from Helper::MultipleSourcesDescription

#description

Methods inherited from Base

#container, #container_name, #finalize, #id, #image_id, #ipaddress, #restore_rspec_context, #run

Methods included from ConfigHelpers

#parse_log, #stderr, #stdout

Constructor Details

#initialize(*opts) ⇒ Dockerspec::Runner::Serverspec::Compose

Constructs a Serverspec runner class to run Docker Compose.

Examples:

From a Directory

Dockerspec::Runner::Serverspec::Compose.new('directory1')
  #=> #<Dockerspec::Runner::Serverspec::Compose:0x0124>

From a YAML File

Dockerspec::Runner::Serverspec::Compose.new('my/docker-compose.yml')
  #=> #<Dockerspec::Runner::Serverspec::Compose:0x0124>

From a Directory or File Using Hash Format

Dockerspec::Runner::Serverspec::Compose.new(file: 'file.yml')
  #=> #<Dockerspec::Runner::Serverspec::Compose:0x0124>

Parameters:

  • opts (String, Hash)

    The :file or a list of options.

Options Hash (*opts):

  • :file (String)

    The compose YAML file or a directory containing the 'docker-compose.yml' file.

  • :rm (Boolean) — default: calculated

    Whether to remove the Docker containers afterwards.

  • :family (Symbol, String) — default: 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.

  • :backend (Symbol) — default: calculated

    Docker backend to use: :docker, :lxc.



68
69
70
71
# File 'lib/dockerspec/runner/serverspec/compose.rb', line 68

def initialize(*opts)
  super
  calculate_docker_backend_name('docker_compose')
end