Class: CemAcpt::TestRunner::Runner
- Inherits:
-
Object
- Object
- CemAcpt::TestRunner::Runner
- Includes:
- LoggingAsync
- Defined in:
- lib/cem_acpt/test_runner/runner.rb
Overview
Runner is a class that runs a single acceptance test suite on a single node. It is responsible for managing the lifecycle of the test suite and reporting the results back to the main thread. Runner objects are created by the RunHandler and then, when started, execute their logic in a thread.
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#node_exists ⇒ Object
readonly
Returns the value of attribute node_exists.
-
#run_result ⇒ Object
readonly
Returns the value of attribute run_result.
Instance Method Summary collapse
-
#initialize(node, context, platform) ⇒ Runner
constructor
A new instance of Runner.
- #run_step(step_sym) ⇒ Object
-
#start ⇒ Object
Executes test suite steps.
-
#test_failures? ⇒ Boolean
Checks for failures in the test results.
Methods included from LoggingAsync
async_debug, #async_debug, async_error, #async_error, async_fatal, #async_fatal, async_info, #async_info, async_warn, #async_warn, included, log_write_thread, #log_write_thread
Constructor Details
#initialize(node, context, platform) ⇒ Runner
Returns a new instance of Runner.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 36 def initialize(node, context, platform) @node = node @context = context @platform = platform @debug_mode = @context.config.debug_mode? @node_inventory = @context.node_inventory @module_pkg_path = @context.module_package_path @node_exists = false @run_result = CemAcpt::TestRunner::RunnerResult.new(@node, debug: @debug_mode) @completed_steps = [] validate! end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
31 32 33 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 31 def node @node end |
#node_exists ⇒ Object (readonly)
Returns the value of attribute node_exists.
31 32 33 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 31 def node_exists @node_exists end |
#run_result ⇒ Object (readonly)
Returns the value of attribute run_result.
31 32 33 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 31 def run_result @run_result end |
Instance Method Details
#run_step(step_sym) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 49 def run_step(step_sym) send(step_sym) @completed_steps << step_sym rescue StandardError => e err = CemAcpt::TestRunner::RunnerStepError.new(step_sym, e) step_error_logging(err) @run_result.from_error(err) destroy unless step_sym == :destroy end |
#start ⇒ Object
Executes test suite steps
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 60 def start async_info("Starting test suite for #{@node.node_name}", log_prefix('RUNNER')) run_step(:provision) run_step(:bootstrap) run_step(:run_tests) run_step(:destroy) true rescue StandardError => e step_error_logging(e) @run_result.from_error(e) destroy end |
#test_failures? ⇒ Boolean
Checks for failures in the test results.
76 77 78 |
# File 'lib/cem_acpt/test_runner/runner.rb', line 76 def test_failures? @run_result.result_errors? || @run_result.result_failures? end |