Class: HybridPlatformsConductor::HpcPlugins::Test::FileSystemHdfs

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

Overview

Perform various tests on a HDFS’s file system

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

#test_on_nodeObject

Check my_test_plugin.rb.sample documentation for signature details.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb', line 15

def test_on_node
  # Flatten the paths rules so that we can spot inconsistencies in configuration
  Hash[
    @config.aggregate_files_rules(@nodes_handler, @node, file_system_type: :hdfs).map do |path, rule_info|
      [
        "if sudo#{rule_info[:context][:sudo_user] ? " -u #{rule_info[:context][:sudo_user]}" : ''} hdfs dfs -ls \"#{path}\" ; then echo 1 ; else echo 0 ; fi",
        {
          validator: proc do |stdout, stderr|
            case stdout.last
            when '1'
              error "HDFS path found that should be absent: #{path}" if rule_info[:state] == :absent
            when '0'
              error "HDFS path not found that should be present: #{path}" if rule_info[:state] == :present
            else
              error "Could not check for existence of HDFS path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
            end
          end,
          timeout: 5
        }
      ]
    end
  ]
end