puppet-openstack/spec/classes/openstack_cinder_storage_spec.rb
Sebastien Badia 96917bcbe0 Fix unit-test in order to prepare module for deprecation
* Update spec tests in order to match rspec 3.x syntax (and puppet-rspec 2.x)
* Remove gems over-specifications (puppetlabs_spec_helper already add
  runtime deps on rpsec, puppet-rspec and rake)
* Fix RedHat fact (cherry-pick of commit
  https://review.openstack.org/106555/)
* Pin fixtures to stable/icehouse (this module is EOL)
* Pin concat to 1.2.1

Partial-Bug: #1326034
Change-Id: If299e1f9591f21d9410f2a5744d29823f913c000
2015-04-16 16:57:09 +02:00

107 lines
2.9 KiB
Ruby

require 'spec_helper'
describe 'openstack::cinder::storage' do
let :params do
{
:sql_connection => 'mysql://cinder:pass@127.0.0.1/cinder?charset=utf8',
:rabbit_password => 'rabpass'
}
end
let :facts do
{ :osfamily => 'RedHat' }
end
it 'should configure cinder and cinder::volume using defaults and required parameters' do
is_expected.to contain_class('cinder').with(
:sql_connection => params[:sql_connection],
: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::volume').with(
:package_ensure => 'present',
:enabled => true
)
is_expected.to contain_class('cinder::volume::iscsi').with(
:iscsi_ip_address => '127.0.0.1',
:volume_group => 'cinder-volumes'
)
is_expected.to contain_class('cinder::glance').with(
:glance_api_servers => '127.0.0.1:9292'
)
is_expected.to_not contain_class('cinder::setup_test_volume')
end
describe 'with a volume driver other than iscsi' do
before do
params.merge!(
:volume_driver => 'netapp'
)
end
it { is_expected.to_not contain_class('cinder::volume::iscsi') }
end
describe 'when setting up test volumes for iscsi' do
before do
params.merge!(
:setup_test_volume => true
)
end
it { is_expected.to contain_class('cinder::setup_test_volume').with(
:volume_name => 'cinder-volumes'
)}
describe 'when volume_group is set' do
before do
params.merge!(:volume_group => 'foo')
end
it { is_expected.to contain_class('cinder::setup_test_volume').with(
:volume_name => 'foo'
)}
end
end
describe 'when setting up test volumes for rbd' do
before do
params.merge!(
:volume_driver => 'rbd',
:rbd_user => 'rbd',
:rbd_pool => 'rbd_pool',
:rbd_secret_uuid => 'secret'
)
end
it { is_expected.to contain_class('cinder::volume::rbd').with(
:rbd_user => 'rbd',
:rbd_pool => 'rbd_pool',
:rbd_secret_uuid => 'secret'
) }
end
describe 'with custom syslog parameters' do
before do
params.merge!(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
)
end
it { is_expected.to contain_class('cinder').with(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
) }
end
end