Module: BeakerRSpec::BeakerShim
- Includes:
- Beaker::DSL
- Defined in:
- lib/beaker-rspec/beaker_shim.rb
Overview
BeakerShim Module
This module provides the connection between rspec and the Beaker DSL. Additional wrappers are provided around commonly executed sets of Beaker commands.
Instance Method Summary collapse
-
#cleanup ⇒ Object
Cleanup the testing framework, shut down test boxen and tidy up.
-
#configure ⇒ Object
Run configuration steps to have hosts ready to test on (such as ensuring that hosts are correctly time synched, adding keys, etc).
-
#default_node ⇒ Beaker::Host
Accessor for default node.
-
#hosts ⇒ Array<Beaker::Host>
Accessor for hosts object.
-
#hosts=(v) ⇒ Object
Setter for hosts object.
-
#logger ⇒ Object
Accessor for logger.
-
#metadata ⇒ Object
Accessor for metadata.
-
#options ⇒ Object
Accessor for options hash.
-
#provision ⇒ Object
Provision the hosts to run tests on.
-
#setup(args = []) ⇒ Object
Setup the testing environment See ‘beaker –help’ for full list of supported command line options.
-
#validate ⇒ Object
Validate that the SUTs are up and correctly configured.
Instance Method Details
#cleanup ⇒ Object
Cleanup the testing framework, shut down test boxen and tidy up
86 87 88 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 86 def cleanup @network_manager.cleanup end |
#configure ⇒ Object
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.
51 52 53 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 51 def configure @network_manager.configure end |
#default_node ⇒ Beaker::Host
Accessor for default node
81 82 83 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 81 def default_node RSpec.configuration.default_node ||= find_only_one :default end |
#hosts ⇒ Array<Beaker::Host>
Accessor for hosts object
70 71 72 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 70 def hosts RSpec.configuration.hosts end |
#hosts=(v) ⇒ Object
Setter for hosts object
75 76 77 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 75 def hosts=(v) RSpec.configuration.hosts = v end |
#logger ⇒ Object
Accessor for logger
16 17 18 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 16 def logger RSpec.configuration.logger end |
#metadata ⇒ Object
Accessor for metadata
22 23 24 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 22 def RSpec.configuration. end |
#options ⇒ Object
Accessor for options hash
28 29 30 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 28 def RSpec.configuration. end |
#provision ⇒ Object
Provision the hosts to run tests on. Assumes #setup has already been called.
35 36 37 38 39 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 35 def provision @network_manager = Beaker::NetworkManager.new(, @logger) RSpec.configuration.hosts = @network_manager.provision @network_manager.proxy_package_manager end |
#setup(args = []) ⇒ Object
Setup the testing environment See ‘beaker –help’ for full list of supported command line options
58 59 60 61 62 63 64 65 66 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 58 def setup(args = []) = Beaker::Options::Parser.new = .parse_args(args) [:debug] = true RSpec.configuration.logger = Beaker::Logger.new() [:logger] = logger RSpec.configuration.hosts = [] RSpec.configuration. = end |
#validate ⇒ Object
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.
44 45 46 |
# File 'lib/beaker-rspec/beaker_shim.rb', line 44 def validate @network_manager.validate end |