Class: HybridPlatformsConductor::HpcPlugins::Test::Mounts
- Inherits:
-
TestOnlyRemoteNode
- Object
- Plugin
- Test
- TestOnlyRemoteNode
- HybridPlatformsConductor::HpcPlugins::Test::Mounts
- Defined in:
- lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb
Overview
Various tests on mounts
Defined Under Namespace
Modules: ConfigDslExtension
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.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb', line 64 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)} "}mount" => proc do |stdout| mounts_info = stdout.map do |line| fields = line.split { src: fields[0], dst: fields[2], type: fields[4], options: fields[5][1..-2].split(',') } end # Check all mount rules @nodes_handler.select_confs_for_node(@node, @config.mount_rules_that_should_be_present).each do |mount_rules_info| mount_rules_info[:mount_rules].each do |rule_src, rule_dst| error "Missing mount matching #{rule_src} => #{rule_dst}", "Mounts: #{JSON.pretty_generate(mounts_info)}" unless mounts_info.any? { |mount_info| mount_matches?(mount_info, rule_src, rule_dst) } end end @nodes_handler.select_confs_for_node(@node, @config.mount_rules_that_should_be_absent).each do |mount_rules_info| mount_rules_info[:mount_rules].each do |rule_src, rule_dst| extra_mounts = mounts_info.select { |mount_info| mount_matches?(mount_info, rule_src, rule_dst) } error "The following mounts should not be present: #{extra_mounts.map { |mount_info| "#{mount_info[:src]} => #{mount_info[:dst]}" }.join(', ')} as forbidden by the rule #{rule_src} => #{rule_dst}", "Mounts: #{JSON.pretty_generate(mounts_info)}" unless extra_mounts.empty? end end end } end |