Class: HybridPlatformsConductor::HpcPlugins::Test::Executables

Inherits:
Test
  • Object
show all
Defined in:
lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb

Overview

Check that all executables run correctly, from an environment/installation point of view.

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

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

#testObject

Check my_test_plugin.rb.sample documentation for signature details.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb', line 13

def test
  tests = [
    "#{CmdRunner.executables_prefix}dump_nodes_json --help",
    "#{CmdRunner.executables_prefix}free_ips",
    "#{CmdRunner.executables_prefix}free_veids",
    "#{CmdRunner.executables_prefix}setup --help",
    "#{CmdRunner.executables_prefix}ssh_config",
    "#{CmdRunner.executables_prefix}test --help"
  ]
  example_platform = PlatformsHandler.new(
    logger: @logger,
    logger_stderr: @logger_stderr,
    config: @config,
    cmd_runner: @cmd_runner
  ).known_platforms.first
  unless example_platform.nil?
    tests.concat [
      "#{CmdRunner.executables_prefix}get_impacted_nodes --platform #{example_platform.name} --show-commands",
    ]
    example_node = example_platform.known_nodes.first
    unless example_node.nil?
      tests.concat [
        "#{CmdRunner.executables_prefix}check-node --node #{example_node} --show-commands",
        "#{CmdRunner.executables_prefix}deploy --node #{example_node} --show-commands --why-run",
        "#{CmdRunner.executables_prefix}last_deploys --node #{example_node} --show-commands",
        "#{CmdRunner.executables_prefix}nodes_to_deploy --node #{example_node} --show-commands",
        "#{CmdRunner.executables_prefix}report --node #{example_node} --format stdout",
        "#{CmdRunner.executables_prefix}run --node #{example_node} --show-commands --interactive",
        "#{CmdRunner.executables_prefix}topograph --from \"--node #{example_node}\" --to \"--node #{example_node}\" --skip-run --output graphviz:graph.gv"
      ]
    end
  end
	tests.sort.each do |cmd|
    log_debug "Testing #{cmd}"
    exit_status, stdout, _stderr = @cmd_runner.run_cmd "#{cmd} 2>&1", no_exception: true, log_to_stdout: log_debug?
    assert_equal(exit_status, 0, "Command #{cmd} returned code #{exit_status}:\n#{stdout}")
  end
  # Remove the file created by Topograph if it exists
  File.unlink('graph.gv') if File.exist?('graph.gv')
end