Class: CemAcpt::RunHandler
- Inherits:
-
Object
- Object
- CemAcpt::RunHandler
- Includes:
- Logging
- Defined in:
- lib/cem_acpt/runner.rb
Overview
RunHandler orchestrates the acceptance test suites, including creating Runner objects, handling input and output, and exception handling.
Instance Attribute Summary collapse
-
#config_file ⇒ Object
Returns the value of attribute config_file.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(params) ⇒ RunHandler
constructor
A new instance of RunHandler.
-
#run ⇒ Object
Runs the acceptance test suites.
Methods included from Logging
current_log_config, #current_log_config, current_log_format, current_log_level, #current_log_level, included, #logger, new_log_config, #new_log_config, new_log_formatter, new_log_level, #new_log_level
Constructor Details
#initialize(params) ⇒ RunHandler
Returns a new instance of RunHandler.
24 25 26 27 28 29 30 31 |
# File 'lib/cem_acpt/runner.rb', line 24 def initialize(params) @params = params @config_file = params[:config_file] || File.('./cem_acpt_config.yaml') @module_pkg_path = Concurrent::IVar.new @start_time = nil @runners = Concurrent::Array.new @results = Concurrent::Map.new end |
Instance Attribute Details
#config_file ⇒ Object
Returns the value of attribute config_file.
21 22 23 |
# File 'lib/cem_acpt/runner.rb', line 21 def config_file @config_file end |
#params ⇒ Object
Returns the value of attribute params.
21 22 23 |
# File 'lib/cem_acpt/runner.rb', line 21 def params @params end |
Instance Method Details
#run ⇒ Object
Runs the acceptance test suites.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cem_acpt/runner.rb', line 34 def run @start_time = Time.now logger.info("Running acceptance test suite at #{@start_time}") logger.debug("Params: #{@params}") logger.debug("Config file: #{@config_file}") logger.info("Using module directory: #{@params[:module_dir]}") context_opts = { config_opts: @params, config_file: @config_file, } build_module_package begin keep_terminal_alive if params[:CI] || ENV['CI'] || ENV['GITHUB_ACTION'] create_and_start_runners(context_opts) rescue StandardError, SignalException, SystemExit => e handle_fatal_error(e) ensure @keep_terminal_alive&.exit end handle_test_results exit_code = @runners.map(&:spec_exit_code).any? { |rc| rc != 0 } ? 1 : 0 exit exit_code end |