Class: CemAcpt::TestRunner::Runner
- Inherits:
-
Object
- Object
- CemAcpt::TestRunner::Runner
- Includes:
- Logging
- Defined in:
- lib/cem_acpt/test_runner.rb
Overview
Holds all the Runner related code
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
Instance Method Summary collapse
- #clean_up(trap_context = false) ⇒ Object
-
#initialize(config) ⇒ Runner
constructor
A new instance of Runner.
- #inspect ⇒ Object
- #run ⇒ Object
- #to_s ⇒ Object
Methods included from Logging
current_log_config, #current_log_config, current_log_format, #current_log_format, current_log_level, #current_log_level, included, logger, #logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, new_log_level, #new_log_level, new_logger, #new_logger
Constructor Details
#initialize(config) ⇒ Runner
Returns a new instance of Runner.
22 23 24 25 26 27 28 29 |
# File 'lib/cem_acpt/test_runner.rb', line 22 def initialize(config) @config = config @run_data = {} @duration = 0 @exit_code = 0 @results = nil @http_statuses = [] end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
20 21 22 |
# File 'lib/cem_acpt/test_runner.rb', line 20 def duration @duration end |
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
20 21 22 |
# File 'lib/cem_acpt/test_runner.rb', line 20 def exit_code @exit_code end |
Instance Method Details
#clean_up(trap_context = false) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/cem_acpt/test_runner.rb', line 69 def clean_up(trap_context = false) unless trap_context kill_keep_terminal_alive end clean_ephemeral_ssh_keys destroy_test_nodes end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/cem_acpt/test_runner.rb', line 31 def inspect to_s end |
#run ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/cem_acpt/test_runner.rb', line 39 def run @run_data = {} @start_time = Time.now logger.info('CemAcpt') { "Starting CemAcpt v#{CemAcpt::VERSION}..." } logger.info('CemAcpt') { "Test suite started at #{@start_time}..." } logger.info('CemAcpt') { "Using module directory: #{config.get('module_dir')}..." } Dir.chdir(config.get('module_dir')) do keep_terminal_alive @run_data[:priv_key], @run_data[:pub_key], @run_data[:known_hosts] = new_ephemeral_ssh_keys logger.info('CemAcpt') { 'Created ephemeral SSH key pair...' } @run_data[:module_package_path] = build_module_package logger.info('CemAcpt') { "Created module package: #{@run_data[:module_package_path]}..." } @run_data[:test_data] = new_test_data logger.info('CemAcpt') { 'Created test data...' } logger.verbose('CemAcpt') { "Test data: #{@run_data[:test_data]}" } @run_data[:nodes] = new_node_data logger.info('CemAcpt') { 'Created node data...' } logger.verbose('CemAcpt') { "Node data: #{@run_data[:nodes]}" } @instance_names_ips = provision_test_nodes logger.info('CemAcpt') { 'Provisioned test nodes...' } logger.debug('CemAcpt') { "Instance names and IPs: #{@instance_names_ips}" } @results = run_tests(@instance_names_ips.map { |_, v| v['ip'] }, config.get('actions.only'), config.get('actions.except')) end ensure clean_up process_test_results end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/cem_acpt/test_runner.rb', line 35 def to_s "#<#{self.class.name}:0x#{object_id.to_s(16)}>" end |