Module: ConfigurationService::Test::OrchestratorEnvironmentFactory

Defined in:
lib/configuration_service/test/orchestrator_environment_factory.rb

Overview

Builds an Orchestrator using a provider selected from the environment

Class Method Summary collapse

Class Method Details

.buildObject

Looks up the provider registered to the OrchestrationProviderRegistry with the name provided in the TEST_ORCHESTRATION_PROVIDER environment variable, and returns a new Orchestrator initialized with that provider.

Returns a new Orchestrator, or raises a RuntimeError if the TEST_ORCHESTRATION_PROVIDER environment variable does not name a provider known to the OrchestrationProviderRegistry.



20
21
22
23
24
25
# File 'lib/configuration_service/test/orchestrator_environment_factory.rb', line 20

def self.build
  identifier = ENV["TEST_ORCHESTRATION_PROVIDER"] or raise "missing environment variable: TEST_ORCHESTRATION_PROVIDER"
  registry = ConfigurationService::Test::OrchestrationProviderRegistry.instance
  provider = registry.lookup(identifier) or raise "unknown test orchestration provider: #{identifier}"
  @test = ConfigurationService::Test::Orchestrator.new(provider)
end