Class: HybridPlatformsConductor::HpcPlugins::Test::Ip
- Inherits:
-
TestOnlyRemoteNode
- Object
- Plugin
- Test
- TestOnlyRemoteNode
- HybridPlatformsConductor::HpcPlugins::Test::Ip
- Defined in:
- lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
Overview
Test that the private IP address is correct
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_node ⇒ Object
Check my_test_plugin.rb.sample documentation for signature details.
Methods inherited from TestOnlyRemoteNode
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_node ⇒ Object
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 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb', line 13 def test_on_node { # TODO: Access the user correctly when the user notion will be moved out of the ssh connector "#{@deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user == 'root' ? '' : "#{@nodes_handler.sudo_on(@node)} "}hostname -I" => proc do |stdout| if stdout.first.nil? error 'No IP returned by "hostname -I"' else private_ips = @nodes_handler.get_private_ips_of @node if private_ips host_ips = stdout.first.split(' ').select { |ip| ip =~ /^172\.16\.\d+\.\d+$/ }.sort ref_ips = private_ips.sort assert_equal( host_ips, ref_ips, "Expected IPs to be #{ref_ips}, but got #{host_ips} instead" ) end end end } end |