Module: ConfigurationService::Test::OrchestratorEnvironmentFactory

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

Overview

A factory for building a test orchestrator using an orchestration provider selected from the environment

Examples:

cucumber features/support/env.rb

require 'configuration_service/test'

Before do
  begin
    @test = ConfigurationService::Test::OrchestratorEnvironmentFactory.build
  rescue
    Cucumber.wants_to_quit = true
    raise
  end
end

Class Method Summary collapse

Class Method Details

.buildConfigurationService::Test::Orchestrator

Build a test orchestrator

Looks up the test orchestration provider class registered to the ConfigurationService::Test::OrchestrationProviderRegistry with the name provided in the TEST_ORCHESTRATION_PROVIDER environment variable, and returns a new ConfigurationService::Test::Orchestrator initialized with an instance of that provider class.

Returns:

Raises:



33
34
35
36
37
38
# File 'lib/configuration_service/test/orchestrator_environment_factory.rb', line 33

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}"
  ConfigurationService::Test::Orchestrator.new(provider)
end