Class: HybridPlatformsConductor::HpcPlugins::Test::Divergence
- Defined in:
- lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb
Overview
Test that the node has not diverged since last deployment
Constant Summary
Constants included from LoggerHelpers
LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR
Instance Attribute Summary
Attributes inherited from Test
#errors, #expected_failure, #name, #node, #platform
Instance Method Summary collapse
-
#test_on_check_node(stdout, stderr, exit_status) ⇒ Object
Check my_test_plugin.rb.sample documentation for signature details.
Methods inherited from Test
#assert_equal, #assert_match, #error, #executed, #executed?, #initialize, only_on_nodes, only_on_platforms, #to_s
Methods inherited from Plugin
extend_config_dsl_with, #initialize, valid?
Methods included from LoggerHelpers
#err, #init_loggers, #log_component=, #log_debug?, #log_level=, #out, #section, #set_loggers_format, #stderr_device, #stderr_device=, #stderr_displayed?, #stdout_device, #stdout_device=, #stdout_displayed?, #stdouts_to_s, #with_progress_bar
Constructor Details
This class inherits a constructor from HybridPlatformsConductor::Test
Instance Method Details
#test_on_check_node(stdout, stderr, exit_status) ⇒ Object
Check my_test_plugin.rb.sample documentation for signature details.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb', line 16 def test_on_check_node(stdout, stderr, exit_status) # Check that the output of the check-node returns no changes. ignored_tasks = @nodes_handler.select_confs_for_node(@node, @config.ignored_divergent_tasks).inject({}) do |merged_ignored_tasks, conf| merged_ignored_tasks.merge(conf[:ignored_tasks]) end @deployer.parse_deploy_output(@node, stdout, stderr).each do |task_info| if task_info[:status] == :changed if ignored_tasks.key?(task_info[:name]) # It was expected that this task is not idempotent log_debug "Task #{task_info[:name]} was expected to be divergent. Reason: #{ignored_tasks[task_info[:name]]}" else extra_details = task_info.slice(*(task_info.keys - %i[name status diffs])) error_details = [] error_details << "----- Changes:\n#{task_info[:diffs].strip}\n-----" if task_info[:diffs] error_details << "----- Additional details:\n#{JSON.pretty_generate(extra_details)}\n-----" unless extra_details.empty? error "Task #{task_info[:name]} has diverged", error_details.empty? ? nil : error_details.join("\n") end end end end |