Class: ConfigurationService::Test::VaultOrchestrationProvider

Inherits:
OrchestrationProvider
  • Object
show all
Defined in:
lib/configuration_service/test/vault_orchestration_provider.rb

Overview

Test orchestration provider for testing the Provider::Vault service provider

Registered to the ConfigurationService::Test::OrchestrationProviderRegistry as “vault”.

Instance Method Summary collapse

Instance Method Details

#broken_service_providerObject

A broken service provider



49
50
51
# File 'lib/configuration_service/test/vault_orchestration_provider.rb', line 49

def broken_service_provider
  ConfigurationService::Provider::Vault.new(address: "https://127.0.0.1:8201")
end

#delete_configurationObject

Delete configuration data



58
59
60
# File 'lib/configuration_service/test/vault_orchestration_provider.rb', line 58

def delete_configuration
  VaultAdminClient.new.delete_configuration(@identifier)
end

#service_providerObject

The service provider under test



40
41
42
# File 'lib/configuration_service/test/vault_orchestration_provider.rb', line 40

def service_provider
  ConfigurationService::Provider::Vault.new(service_provider_configuration)
end

#service_provider_configurationObject

The configuration for the service provider under test



31
32
33
# File 'lib/configuration_service/test/vault_orchestration_provider.rb', line 31

def service_provider_configuration
  {address: (ENV["VAULT_ADDR"] || "https://127.0.0.1:8200"), ca_cert: (ENV["VAULT_CACERT"] || "fixtures/ssl/ca-chain.cert.pem")}
end

#service_provider_idObject

The registered identifier of the service provider under test



22
23
24
# File 'lib/configuration_service/test/vault_orchestration_provider.rb', line 22

def service_provider_id
  "vault"
end

#token_for(role) ⇒ Object

Provide a token that authorizes a role

The token is supplied by ConfigurationService::Test::VaultAdminClient.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/configuration_service/test/vault_orchestration_provider.rb', line 69

def token_for(role)
  case role
  when :consumer
    VaultAdminClient.new.consumer_token(@identifier)
  when :publisher
    VaultAdminClient.new.publisher_token(@identifier)
  when :none
    VaultAdminClient.new.none_token(@identifier)
  else
    raise "unsupported role #{role}"
  end
end