Class: Dockerspec::Engine::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dockerspec/engine/base.rb

Overview

A basic class with the minimal skeleton to create a Testing Engine.

Direct Known Subclasses

Infrataster, Specinfra

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ Dockerspec::Engine::Base

Constructs the engine.

Saves the runner and the options.

Parameters:



43
44
45
# File 'lib/dockerspec/engine/base.rb', line 43

def initialize(runner)
  @runner = runner
end

Instance Method Details

#before_running(*args) ⇒ Object

Runs the engine setup just before running docker.

Also run when there is a change in the testing target like changing the container you want to run the tests into with Docker Compose.

Usually this is implemented to clean configurations from previous tests.

Does nothing by default.

Parameters:

  • args (Mixed)

    The passed arguments.

Returns:

  • void



63
# File 'lib/dockerspec/engine/base.rb', line 63

def before_running(*args); end

#restore(*args) ⇒ Object

Restores the engine internal status after running tests on other containers.

This is used to avoid the engine running against the last started container if you are testing multiple containers at the same time.

Does nothing by default.

Parameters:

  • args (Mixed)

    The passed arguments.

Returns:

  • void



112
# File 'lib/dockerspec/engine/base.rb', line 112

def restore(*args); end

#when_container_ready(*args) ⇒ Object

Runs when the container to test is ready.

This is mainly used with Docker Compose to know when the container to test is selected.

Without Docker Compose this is called just after calling #when_running.

Does nothing by default.

Parameters:

  • args (Mixed)

    The passed arguments.

Returns:

  • void



95
# File 'lib/dockerspec/engine/base.rb', line 95

def when_container_ready(*args); end

#when_running(*args) ⇒ Object

Saves the engine status internally after starting the docker container.

Does nothing by default.

Parameters:

  • args (Mixed)

    The passed arguments.

Returns:

  • void



76
# File 'lib/dockerspec/engine/base.rb', line 76

def when_running(*args); end