Class: CemAcpt::Platform::TestBase
- Defined in:
- lib/cem_acpt/platform/base.rb
Overview
Base class for all test node platform classes. This class provides an API for interacting with the underlying platform.
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#test_data ⇒ Object
readonly
Returns the value of attribute test_data.
Instance Method Summary collapse
-
#image_name ⇒ Object
Generates or retrieves an image name from the test data.
-
#initialize(config, single_test_data, **run_data) ⇒ TestBase
constructor
A new instance of TestBase.
- #node_name ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base
#node_data, #platform_data, #to_json
Methods included from Logging
current_log_config, #current_log_config, current_log_format, #current_log_format, #current_log_level, current_log_level, included, #logger, logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, #new_log_level, new_log_level, #new_logger, new_logger, verbose?, #verbose?
Constructor Details
#initialize(config, single_test_data, **run_data) ⇒ TestBase
Returns a new instance of TestBase.
59 60 61 62 63 64 |
# File 'lib/cem_acpt/platform/base.rb', line 59 def initialize(config, single_test_data, **run_data) super(config, **run_data) raise ArgumentError, 'single_test_data must be a Hash' unless single_test_data.is_a?(Hash) @test_data = single_test_data end |
Instance Attribute Details
#test_data ⇒ Object (readonly)
Returns the value of attribute test_data.
54 55 56 |
# File 'lib/cem_acpt/platform/base.rb', line 54 def test_data @test_data end |
Instance Method Details
#image_name ⇒ Object
Generates or retrieves an image name from the test data.
81 82 83 |
# File 'lib/cem_acpt/platform/base.rb', line 81 def image_name @image_name ||= (@config.has?('image_name_builder') ? image_name_builder(@config, test_data) : test_data[:image_name]) end |
#node_name ⇒ Object
66 67 68 |
# File 'lib/cem_acpt/platform/base.rb', line 66 def node_name @node_name ||= (@test_data[:node_name] || random_node_name) end |
#to_h ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/cem_acpt/platform/base.rb', line 70 def to_h { node_name: node_name, image_name: image_name, test_data: test_data, platform_data: platform_data, node_data: node_data, } end |