module BeakerRSpec::BeakerShim

BeakerShim Module

This module provides the connection between rspec and the Beaker DSL. Additional wrappers are provided around commonly executed sets of Beaker commands.

Public Instance Methods

cleanup() click to toggle source

Cleanup the testing framework, shut down test boxen and tidy up

# File lib/beaker-rspec/beaker_shim.rb, line 84
def cleanup
  @network_manager.cleanup
end
configure() click to toggle source

Run configuration steps to have hosts ready to test on (such as ensuring that hosts are correctly time synched, adding keys, etc). Assumes setup, provision and validate have already been called.

# File lib/beaker-rspec/beaker_shim.rb, line 49
def configure
  @network_manager.configure
end
default_node() click to toggle source

Accessor for default node @return [Beaker::Host]

# File lib/beaker-rspec/beaker_shim.rb, line 79
def default_node
  RSpec.configuration.default_node ||= find_only_one :default
end
hosts() click to toggle source

Accessor for hosts object @return [Array<Beaker::Host>]

# File lib/beaker-rspec/beaker_shim.rb, line 68
def hosts
  RSpec.configuration.hosts
end
hosts=(v) click to toggle source

Setter for hosts object

# File lib/beaker-rspec/beaker_shim.rb, line 73
def hosts=(v)
  RSpec.configuration.hosts = v
end
logger() click to toggle source

Accessor for logger @return Beaker::Logger object

# File lib/beaker-rspec/beaker_shim.rb, line 14
def logger
  RSpec.configuration.logger
end
metadata() click to toggle source

Accessor for metadata @return Hash metadata

# File lib/beaker-rspec/beaker_shim.rb, line 20
def metadata
  RSpec.configuration.metadata
end
options() click to toggle source

Accessor for options hash @return Hash options

# File lib/beaker-rspec/beaker_shim.rb, line 26
def options
  RSpec.configuration.options
end
provision() click to toggle source

Provision the hosts to run tests on. Assumes setup has already been called.

# File lib/beaker-rspec/beaker_shim.rb, line 33
def provision
  @network_manager = Beaker::NetworkManager.new(options, @logger)
  RSpec.configuration.hosts = @network_manager.provision
  @network_manager.proxy_package_manager
end
setup(args = []) click to toggle source

Setup the testing environment @param [Array<String>] args The argument array of options for configuring Beaker See ‘beaker –help’ for full list of supported command line options

# File lib/beaker-rspec/beaker_shim.rb, line 56
def setup(args = [])
  options_parser = Beaker::Options::Parser.new
  options = options_parser.parse_args(args)
  options[:debug] = true
  RSpec.configuration.logger = Beaker::Logger.new(options)
  options[:logger] = logger
  RSpec.configuration.hosts = []
  RSpec.configuration.options = options
end
validate() click to toggle source

Validate that the SUTs are up and correctly configured. Checks that required packages are installed and if they are missing attempt installation. Assumes setup and provision has already been called.

# File lib/beaker-rspec/beaker_shim.rb, line 42
def validate
  @network_manager.validate
end