Class: CemAcpt::Context::Ctx

Inherits:
Object
  • Object
show all
Defined in:
lib/cem_acpt/context.rb

Overview

Ctx holds the context objects for the RunHandler to create and start Runners.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts: nil, config_file: nil, module_package_path: nil) ⇒ Ctx

Returns a new instance of Ctx.



116
117
118
119
120
121
122
123
# File 'lib/cem_acpt/context.rb', line 116

def initialize(opts: nil, config_file: nil, module_package_path: nil)
  @config = CemAcpt::Config.new.load(opts: opts, config_file: config_file)
  @test_data = CemAcpt::TestData.acceptance_test_data(@config)
  @module_package_path = module_package_path
  @node_inventory = CemAcpt::NodeInventory.new
  @local_port_allocator = CemAcpt::LocalPortAllocator.new
  prep_environment
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



114
115
116
# File 'lib/cem_acpt/context.rb', line 114

def config
  @config
end

#local_port_allocatorObject (readonly)

Returns the value of attribute local_port_allocator.



114
115
116
# File 'lib/cem_acpt/context.rb', line 114

def local_port_allocator
  @local_port_allocator
end

#module_package_pathObject (readonly)

Returns the value of attribute module_package_path.



114
115
116
# File 'lib/cem_acpt/context.rb', line 114

def module_package_path
  @module_package_path
end

#node_inventoryObject (readonly)

Returns the value of attribute node_inventory.



114
115
116
# File 'lib/cem_acpt/context.rb', line 114

def node_inventory
  @node_inventory
end

#test_dataObject (readonly)

Returns the value of attribute test_data.



114
115
116
# File 'lib/cem_acpt/context.rb', line 114

def test_data
  @test_data
end

Instance Method Details

#nodesObject

Raises:

  • (CemAcpt::Error)


125
126
127
128
129
130
131
132
# File 'lib/cem_acpt/context.rb', line 125

def nodes
  return @nodes if defined?(@nodes)

  raise CemAcpt::Error, 'No platform(s) specified' unless @config.has?('platform') || @config.has?('platforms')

  @nodes = nodes_from_platforms
  @nodes
end