Class: HybridPlatformsConductor::HpcPlugins::Test::DeployFromScratch

Inherits:
TestByService show all
Defined in:
lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb

Overview

Test that deploy returns no error on an empty image

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 TestByService

only_on_nodes

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_for_nodeObject

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
# File 'lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb', line 13

def test_for_node
  @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_from_scratch', reuse_instance: log_debug?) do |deployer|
    deployer.nbr_retries_on_error = 3
    deployer.log_level = :debug
    result = deployer.deploy_on(@node)
    assert_equal result.size, 1, "Wrong number of nodes being tested: #{result.size}"
    tested_node, (exit_status, _stdout, _stderr) = result.first
    if exit_status.is_a?(Symbol)
      # In debug mode, the logger is the normal one, already outputting the error. No need to get it back from the logs.
      error "Deploy could not run because of error: #{exit_status}.", log_debug? ? nil : deployer.stdouts_to_s
    else
      assert_equal tested_node, @node, "Wrong node being deployed: #{tested_node} should be #{@node}"
      assert_equal exit_status, 0, "Deploy returned error code #{exit_status}"
    end
  end
end