234 lines
8.8 KiB
Ruby
234 lines
8.8 KiB
Ruby
# ROLE: primary-controller
|
|
# ROLE: controller
|
|
|
|
require 'spec_helper'
|
|
require 'shared-examples'
|
|
manifest = 'murano/murano.pp'
|
|
|
|
describe manifest do
|
|
shared_examples 'catalog' do
|
|
|
|
let(:murano_user) { Noop.hiera_structure('murano/user', 'murano') }
|
|
let(:murano_password) { Noop.hiera_structure('murano/user_password') }
|
|
let(:tenant) { Noop.hiera_structure('murano/tenant', 'services') }
|
|
|
|
let(:rabbit_own_user) { Noop.hiera_structure('murano/rabbit/user', 'murano') }
|
|
let(:rabbit_own_password) { Noop.hiera_structure('murano/rabbit_password') }
|
|
let(:rabbit_own_vhost) { '/' }
|
|
let(:rabbit_own_port) { '55572' }
|
|
|
|
let(:network_scheme) do
|
|
Noop.hiera_hash 'network_scheme'
|
|
end
|
|
|
|
let(:ceilometer_hash) do
|
|
Noop.hiera_structure 'ceilometer'
|
|
end
|
|
|
|
let(:prepare) do
|
|
Noop.puppet_function 'prepare_network_config', network_scheme
|
|
end
|
|
|
|
let(:public_ip) do
|
|
Noop.hiera 'public_vip'
|
|
end
|
|
|
|
let(:management_ip) do
|
|
Noop.hiera 'management_vip'
|
|
end
|
|
|
|
let(:bind_address) do
|
|
prepare
|
|
Noop.puppet_function 'get_network_role_property', 'murano/api', 'ipaddr'
|
|
end
|
|
|
|
let(:region) { Noop.hiera('region', 'RegionOne') }
|
|
let(:service_endpoint) { Noop.hiera('service_endpoint') }
|
|
let(:syslog_log_facility_murano) { Noop.hiera('syslog_log_facility_murano') }
|
|
let(:debug) { Noop.hiera('debug', false) }
|
|
let(:use_syslog) { Noop.hiera('use_syslog', true) }
|
|
let(:rabbit_ha_queues) { Noop.hiera('rabbit_ha_queues') }
|
|
let(:transport_url) { Noop.hiera 'transport_url', 'rabbit://guest:password@127.0.0.1:5672/' }
|
|
let(:public_ssl) { Noop.hiera_structure('public_ssl/services') }
|
|
|
|
let(:db_type) { Noop.hiera_structure('murano/db_type', 'mysql+pymysql') }
|
|
let(:db_user) { Noop.hiera_structure('murano/db_user', 'murano') }
|
|
let(:db_name) { Noop.hiera_structure('murano/db_name', 'murano') }
|
|
let(:db_host) { Noop.hiera_structure('murano/db_host', service_endpoint) }
|
|
let(:db_password) { Noop.hiera_structure('murano/db_password') }
|
|
|
|
let(:memcached_servers) { Noop.hiera 'memcached_servers' }
|
|
let(:local_memcached_server) { Noop.hiera 'local_memcached_server' }
|
|
|
|
let(:predefined_networks) { Noop.hiera_structure('neutron_config/predefined_networks') }
|
|
|
|
let(:default_repository_url) { 'http://storage.apps.openstack.org' }
|
|
let(:repository_url) { Noop.hiera_structure('murano_settings/murano_repo_url', default_repository_url) }
|
|
|
|
let(:api_bind_port) { '8082' }
|
|
|
|
let(:sql_connection) do
|
|
if facts[:os_package_type] == 'debian'
|
|
extra_params = '?charset=utf8&read_timeout=60'
|
|
else
|
|
extra_params = '?charset=utf8'
|
|
end
|
|
"#{db_type}://#{db_user}:#{db_password}@#{db_host}/#{db_name}#{extra_params}"
|
|
end
|
|
|
|
let(:ssl_hash) { Noop.hiera_hash 'use_ssl', {} }
|
|
|
|
let(:admin_auth_protocol) {
|
|
Noop.puppet_function 'get_ssl_property',ssl_hash,{},'keystone','admin',
|
|
'protocol','http'
|
|
}
|
|
|
|
let(:admin_auth_address) {
|
|
Noop.puppet_function 'get_ssl_property',ssl_hash,{},'keystone','admin',
|
|
'hostname',[Noop.hiera('service_endpoint', ''), management_ip]
|
|
}
|
|
|
|
let(:admin_url) { "#{admin_auth_protocol}://#{admin_auth_address}:35357" }
|
|
|
|
let (:murano_protocol){
|
|
Noop.puppet_function 'get_ssl_property', ssl_hash, {}, 'murano',
|
|
'internal', 'protocol', 'http'
|
|
}
|
|
|
|
let (:murano_address){
|
|
Noop.puppet_function 'get_ssl_property', ssl_hash, {}, 'murano',
|
|
'internal', 'hostname',
|
|
[Noop.hiera('service_endpoint', ''), management_ip]
|
|
}
|
|
|
|
let (:murano_url){
|
|
"#{murano_protocol}://#{murano_address}:#{api_bind_port}"
|
|
}
|
|
|
|
primary_controller = Noop.hiera 'primary_controller'
|
|
if Noop.hiera_structure('use_ssl', false)
|
|
public_auth_protocol = 'https'
|
|
public_auth_address = Noop.hiera_structure('use_ssl/keystone_public_hostname')
|
|
elsif Noop.hiera_structure('public_ssl/services', false)
|
|
public_auth_protocol = 'https'
|
|
public_auth_address = Noop.hiera_structure('public_ssl/hostname')
|
|
else
|
|
public_auth_protocol = 'http'
|
|
public_auth_address = Noop.hiera('public_vip')
|
|
end
|
|
|
|
let(:external_network) do
|
|
Noop.puppet_function 'get_ext_net_name', predefined_networks
|
|
end
|
|
|
|
let(:default_dns) { Noop.hiera_structure('external_dns/dns_list') }
|
|
|
|
murano_plugins = Noop.hiera_structure('murano/plugins', {})
|
|
if murano_plugins.has_key? 'glance_artifacts_plugin'
|
|
murano_glance_artifacts_plugin = murano_plugins['glance_artifacts_plugin']
|
|
else
|
|
murano_glance_artifacts_plugin = false
|
|
end
|
|
let(:packages_service) do
|
|
if murano_glance_artifacts_plugin and murano_glance_artifacts_plugin['enabled'] and facts[:os_package_type] == 'debian'
|
|
'glare'
|
|
else
|
|
'murano'
|
|
end
|
|
end
|
|
|
|
let(:enable_glare) do
|
|
if murano_glance_artifacts_plugin and murano_glance_artifacts_plugin['enabled'] and facts[:os_package_type] == 'debian'
|
|
true
|
|
else
|
|
false
|
|
end
|
|
end
|
|
|
|
#############################################################################
|
|
|
|
enable = Noop.hiera_structure('murano/enabled')
|
|
default_log_levels_hash = Noop.hiera_hash 'default_log_levels'
|
|
default_log_levels = Noop.puppet_function 'join_keys_to_values',default_log_levels_hash,'='
|
|
|
|
context 'if murano is enabled', :if => enable do
|
|
|
|
it 'should manage murano-glance-artifacts-plugin package' do
|
|
if enable_glare
|
|
should contain_package('murano-glance-artifacts-plugin').with(:ensure => 'present')
|
|
else
|
|
should_not contain_package('murano-glance-artifacts-plugin')
|
|
end
|
|
end
|
|
|
|
it 'should declare murano class correctly' do
|
|
should contain_class('murano').with(
|
|
'debug' => debug,
|
|
'use_syslog' => use_syslog,
|
|
'use_stderr' => 'false',
|
|
'log_facility' => syslog_log_facility_murano,
|
|
'database_connection' => sql_connection,
|
|
'default_transport_url' => transport_url,
|
|
'sync_db' => primary_controller,
|
|
'auth_uri' => "#{public_auth_protocol}://#{public_auth_address}:5000/",
|
|
'admin_user' => murano_user,
|
|
'admin_password' => murano_password,
|
|
'admin_tenant_name' => tenant,
|
|
'identity_uri' => "#{admin_auth_protocol}://#{admin_auth_address}:35357/",
|
|
'notification_driver' => ceilometer_hash['notification_driver'],
|
|
'use_neutron' => 'true',
|
|
'packages_service' => packages_service,
|
|
'rabbit_ha_queues' => rabbit_ha_queues,
|
|
'rabbit_own_host' => public_ip,
|
|
'rabbit_own_port' => rabbit_own_port,
|
|
'rabbit_own_user' => rabbit_own_user,
|
|
'rabbit_own_password' => rabbit_own_password,
|
|
'rabbit_own_vhost' => rabbit_own_vhost,
|
|
'default_nameservers' => default_dns,
|
|
'service_host' => bind_address,
|
|
'service_port' => api_bind_port,
|
|
'external_network' => external_network,
|
|
'memcached_servers' => local_memcached_server,
|
|
)
|
|
end
|
|
|
|
it 'should configure default_log_levels' do
|
|
should contain_murano_config('DEFAULT/default_log_levels').with_value(default_log_levels.sort.join(','))
|
|
end
|
|
|
|
it 'should declare murano::api class correctly' do
|
|
should contain_class('murano::api').with(
|
|
'host' => bind_address,
|
|
'port' => api_bind_port,
|
|
)
|
|
end
|
|
|
|
it 'should declare murano::engine class coreclty' do
|
|
should contain_class('murano::engine')
|
|
end
|
|
|
|
it 'should declare murano::client class coreclty' do
|
|
should contain_class('murano::client')
|
|
end
|
|
|
|
it 'should declare murano::dashboard class correctly' do
|
|
should contain_class('murano::dashboard').with(
|
|
'repo_url' => repository_url,
|
|
'sync_db' => false,
|
|
'enable_glare' => enable_glare
|
|
)
|
|
end
|
|
|
|
it { should contain_concat__fragment('murano_dashboard_section').with_content(/METADATA_CACHE_DIR = '\/var\/cache\/murano-dashboard'/)}
|
|
it { should_not contain_exec('django_syncdb') }
|
|
|
|
it 'should configure kombu compression' do
|
|
kombu_compression = Noop.hiera 'kombu_compression', facts[:os_service_default]
|
|
should contain_murano_config('oslo_messaging_rabbit/kombu_compression').with(:value => kombu_compression)
|
|
end
|
|
end
|
|
end # end of shared_examples
|
|
|
|
test_ubuntu_and_centos manifest
|
|
end
|