puppet-openstack/spec/classes/openstack_cinder_controller...

85 lines
2.4 KiB
Ruby

require 'spec_helper'
describe 'openstack::cinder::controller' do
let :params do
{
:db_password => 'db_password',
:rabbit_password => 'rabpass',
:keystone_password => 'user_pass'
}
end
let :facts do
{ :osfamily => 'RedHat' }
end
it 'should configure using the default values' do
is_expected.to contain_class('cinder').with(
:sql_connection => "mysql://cinder:#{params[:db_password]}@127.0.0.1/cinder?charset=utf8",
:sql_idle_timeout => '3600',
:rpc_backend => 'cinder.openstack.common.rpc.impl_kombu',
:rabbit_userid => 'guest',
:rabbit_password => params[:rabbit_password],
:rabbit_host => '127.0.0.1',
:rabbit_port => '5672',
:rabbit_hosts => false,
:rabbit_virtual_host => '/',
:package_ensure => 'present',
:api_paste_config => '/etc/cinder/api-paste.ini',
:use_syslog => false,
:log_facility => 'LOG_USER',
:debug => false,
:verbose => false
)
is_expected.to contain_class('cinder::api').with(
:keystone_password => params[:keystone_password],
:keystone_enabled => true,
:keystone_user => 'cinder',
:keystone_auth_host => 'localhost',
:keystone_auth_port => '35357',
:keystone_auth_protocol => 'http',
:service_port => '5000',
:package_ensure => 'present',
:bind_host => '0.0.0.0',
:enabled => true
)
is_expected.to contain_class('cinder::scheduler').with(
:scheduler_driver => 'cinder.scheduler.simple.SimpleScheduler',
:package_ensure => 'present',
:enabled => true
)
is_expected.to contain_class('cinder::glance').with(
:glance_api_servers => '127.0.0.1:9292'
)
end
describe 'with custom syslog settings' do
before do
params.merge!({
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
})
end
it do
is_expected.to contain_class('cinder').with(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
)
end
end
context 'with unsupported db type' do
before do
params.merge!({:db_type => 'sqlite'})
end
it do
expect { catalogue }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/)
end
end
end