class Dockerspec::Engine::Infrataster

The Infrataster testing engine implementation.

Public Class Methods

new(runner) click to toggle source

Constructs a testing engine to use Infrataster.

@param runner [Dockerspec::Runner::Base] The class that is being used

to run the Docker Containers.

@return [Dockerspec::Engine::Specinfra] The engine.

@api public

Calls superclass method Dockerspec::Engine::Base::new
# File lib/dockerspec/engine/infrataster.rb, line 42
def initialize(runner)
  super
  @definitions = {}
end

Public Instance Methods

when_container_ready() click to toggle source

Sets up Infrataster.

@return void

@raise [Dockerspec::RunnerError] When the `#container` method is no

implemented in the subclass or cannot select the container to test.

@api public

# File lib/dockerspec/engine/infrataster.rb, line 57
def when_container_ready
  define_server
end

Protected Instance Methods

define_server() click to toggle source

Defines the Infrataster server to test.

It calls {Infrataster::Server.define} reading the internal IP address from the Docker metadata.

@return void

@raise [Dockerspec::RunnerError] When the `#container` method is no

implemented in the subclass or cannot select the container to test.

@api private

# File lib/dockerspec/engine/infrataster.rb, line 76
def define_server
  return if @definitions.key?(container_name)
  ::Infrataster::Server.define(
    container_name.to_sym,
    ipaddress,
    options
  )
  @definitions[container_name] = ipaddress
end