spec: updates for rspec-puppet 2.x and rspec 3.x

This patch aim to update our specs test in order to work with the

rspec-puppet release 2.0.0, in the mean time, we update rspec syntax
in order to be prepared for rspec 3.x move.

In details:

  * Use shared_examples "a Puppet::Error" for puppet::error tests
  * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x)
  * Fix spec tests for rspec-puppet 2.0.0
  * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0
  * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper)

Change-Id: Id5b428fb518f40cf92cd27078d36f19b6d60226b
Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
This commit is contained in:
Sebastien Badia 2015-02-22 22:29:32 +01:00 committed by Gael Chamoulaud
parent ad1567ca5d
commit 4224fdd12e
48 changed files with 418 additions and 495 deletions

View File

@ -14,9 +14,8 @@ group :development, :test do
gem 'puppet-lint-variable_contains_upcase' gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable' gem 'puppet-lint-numericvariable'
gem 'rspec-puppet', '~> 1.0.1' gem 'rspec-puppet', '~> 2.0.0', :require => false
gem 'rake', '10.1.1' gem 'rake', '10.1.1'
gem 'rspec', '< 2.99'
gem 'json' gem 'json'
gem 'webmock' gem 'webmock'
end end

View File

@ -15,64 +15,64 @@ describe 'cinder::api' do
req_params req_params
end end
it { should contain_service('cinder-api').with( it { is_expected.to contain_service('cinder-api').with(
'hasstatus' => true, 'hasstatus' => true,
'ensure' => 'running' 'ensure' => 'running'
)} )}
it 'should configure cinder api correctly' do it 'should configure cinder api correctly' do
should contain_cinder_config('DEFAULT/auth_strategy').with( is_expected.to contain_cinder_config('DEFAULT/auth_strategy').with(
:value => 'keystone' :value => 'keystone'
) )
should contain_cinder_config('DEFAULT/osapi_volume_listen').with( is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen').with(
:value => '0.0.0.0' :value => '0.0.0.0'
) )
should contain_cinder_config('DEFAULT/osapi_volume_workers').with( is_expected.to contain_cinder_config('DEFAULT/osapi_volume_workers').with(
:value => '8' :value => '8'
) )
should contain_cinder_config('DEFAULT/default_volume_type').with( is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with(
:ensure => 'absent' :ensure => 'absent'
) )
should contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
:value => 'http' :value => 'http'
) )
should contain_cinder_api_paste_ini('filter:authtoken/service_host').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_host').with(
:value => 'localhost' :value => 'localhost'
) )
should contain_cinder_api_paste_ini('filter:authtoken/service_port').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_port').with(
:value => '5000' :value => '5000'
) )
should contain_cinder_api_paste_ini('filter:authtoken/identity_uri').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/identity_uri').with(
:value => 'http://localhost:35357' :value => 'http://localhost:35357'
) )
should contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with(
:ensure => 'absent' :ensure => 'absent'
) )
should contain_cinder_api_paste_ini('filter:authtoken/auth_host').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_host').with(
:ensure => 'absent' :ensure => 'absent'
) )
should contain_cinder_api_paste_ini('filter:authtoken/auth_port').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_port').with(
:ensure => 'absent' :ensure => 'absent'
) )
should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
:ensure => 'absent' :ensure => 'absent'
) )
should contain_cinder_api_paste_ini('filter:authtoken/admin_tenant_name').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/admin_tenant_name').with(
:value => 'services' :value => 'services'
) )
should contain_cinder_api_paste_ini('filter:authtoken/admin_user').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/admin_user').with(
:value => 'cinder' :value => 'cinder'
) )
should contain_cinder_api_paste_ini('filter:authtoken/admin_password').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/admin_password').with(
:value => 'foo', :value => 'foo',
:secret => true :secret => true
) )
should contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://localhost:5000/' :value => 'http://localhost:5000/'
) )
should_not contain_cinder_config('DEFAULT/os_region_name') is_expected.to_not contain_cinder_config('DEFAULT/os_region_name')
end end
end end
@ -82,7 +82,7 @@ describe 'cinder::api' do
req_params.merge({'os_region_name' => 'MyRegion'}) req_params.merge({'os_region_name' => 'MyRegion'})
end end
it 'should configure the region for nova' do it 'should configure the region for nova' do
should contain_cinder_config('DEFAULT/os_region_name').with( is_expected.to contain_cinder_config('DEFAULT/os_region_name').with(
:value => 'MyRegion' :value => 'MyRegion'
) )
end end
@ -93,7 +93,7 @@ describe 'cinder::api' do
req_params.merge({'default_volume_type' => 'foo'}) req_params.merge({'default_volume_type' => 'foo'})
end end
it 'should configure the default volume type for cinder' do it 'should configure the default volume type for cinder' do
should contain_cinder_config('DEFAULT/default_volume_type').with( is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with(
:value => 'foo' :value => 'foo'
) )
end end
@ -104,7 +104,7 @@ describe 'cinder::api' do
req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'}) req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'})
end end
it 'should configure cinder auth_uri correctly' do it 'should configure cinder auth_uri correctly' do
should contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with( is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://foo.bar:8080/v2.0/' :value => 'http://foo.bar:8080/v2.0/'
) )
end end
@ -115,7 +115,7 @@ describe 'cinder::api' do
req_params.merge({'bind_host' => '192.168.1.3'}) req_params.merge({'bind_host' => '192.168.1.3'})
end end
it 'should configure cinder api correctly' do it 'should configure cinder api correctly' do
should contain_cinder_config('DEFAULT/osapi_volume_listen').with( is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen').with(
:value => '192.168.1.3' :value => '192.168.1.3'
) )
end end
@ -130,7 +130,7 @@ describe 'cinder::api' do
} }
end end
it { should contain_cinder_api_paste_ini('filter:authtoken/identity_uri').with( it { is_expected.to contain_cinder_api_paste_ini('filter:authtoken/identity_uri').with(
:value => "http://localhost:35357#{keystone_auth_admin_prefix}" :value => "http://localhost:35357#{keystone_auth_admin_prefix}"
)} )}
end end
@ -152,7 +152,7 @@ describe 'cinder::api' do
} }
end end
it { expect { should contain_cinder_api_paste_ini('filter:authtoken/identity_uri') }.to \ it { expect { is_expected.to contain_cinder_api_paste_ini('filter:authtoken/identity_uri') }.to \
raise_error(Puppet::Error, /validate_re\(\): "#{keystone_auth_admin_prefix}" does not match/) } raise_error(Puppet::Error, /validate_re\(\): "#{keystone_auth_admin_prefix}" does not match/) }
end end
end end
@ -162,10 +162,10 @@ describe 'cinder::api' do
req_params.merge({'enabled' => false}) req_params.merge({'enabled' => false})
end end
it 'should stop the service' do it 'should stop the service' do
should contain_service('cinder-api').with_ensure('stopped') is_expected.to contain_service('cinder-api').with_ensure('stopped')
end end
it 'should contain db_sync exec' do it 'should contain db_sync exec' do
should_not contain_exec('cinder-manage db_sync') is_expected.to_not contain_exec('cinder-manage db_sync')
end end
end end
@ -174,7 +174,7 @@ describe 'cinder::api' do
req_params.merge({'manage_service' => false}) req_params.merge({'manage_service' => false})
end end
it 'should not change the state of the service' do it 'should not change the state of the service' do
should contain_service('cinder-api').without_ensure is_expected.to contain_service('cinder-api').without_ensure
end end
end end
@ -183,7 +183,7 @@ describe 'cinder::api' do
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' }) req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
end end
it { should contain_cinder_api_paste_ini('filter:ratelimit/limits').with( it { is_expected.to contain_cinder_api_paste_ini('filter:ratelimit/limits').with(
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' :value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
)} )}
end end
@ -194,7 +194,7 @@ describe 'cinder::api' do
:validate => true, :validate => true,
}) })
end end
it { should contain_exec('execute cinder-api validation').with( it { is_expected.to contain_exec('execute cinder-api validation').with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin', :path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell', :provider => 'shell',
:tries => '10', :tries => '10',
@ -202,7 +202,7 @@ describe 'cinder::api' do
:command => 'cinder --os-auth-url http://localhost:5000/ --os-tenant-name services --os-username cinder --os-password foo list', :command => 'cinder --os-auth-url http://localhost:5000/ --os-tenant-name services --os-username cinder --os-password foo list',
)} )}
it { should contain_anchor('create cinder-api anchor').with( it { is_expected.to contain_anchor('create cinder-api anchor').with(
:require => 'Exec[execute cinder-api validation]', :require => 'Exec[execute cinder-api validation]',
)} )}
end end
@ -214,7 +214,7 @@ describe 'cinder::api' do
:validation_options => { 'cinder-api' => { 'command' => 'my-script' } } :validation_options => { 'cinder-api' => { 'command' => 'my-script' } }
}) })
end end
it { should contain_exec('execute cinder-api validation').with( it { is_expected.to contain_exec('execute cinder-api validation').with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin', :path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell', :provider => 'shell',
:tries => '10', :tries => '10',
@ -222,7 +222,7 @@ describe 'cinder::api' do
:command => 'my-script', :command => 'my-script',
)} )}
it { should contain_anchor('create cinder-api anchor').with( it { is_expected.to contain_anchor('create cinder-api anchor').with(
:require => 'Exec[execute cinder-api validation]', :require => 'Exec[execute cinder-api validation]',
)} )}
end end

View File

@ -45,7 +45,7 @@ describe 'cinder::backends' do
end end
it 'configures cinder.conf with default params' do it 'configures cinder.conf with default params' do
should contain_cinder_config('DEFAULT/enabled_backends').with_value(p[:enabled_backends].join(',')) is_expected.to contain_cinder_config('DEFAULT/enabled_backends').with_value(p[:enabled_backends].join(','))
end end
end end
@ -57,9 +57,7 @@ describe 'cinder::backends' do
) )
end end
it 'should fail to configure default volume type' do it_raises 'a Puppet::Error', /The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api./
expect { subject }.to raise_error(Puppet::Error, /The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api./)
end
end end
end end

View File

@ -41,13 +41,13 @@ describe 'cinder::backup::ceph' do
end end
it 'configures cinder.conf' do it 'configures cinder.conf' do
should contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.ceph') is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.ceph')
should contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
should contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
should contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
should contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
end end
context 'when overriding default parameters' do context 'when overriding default parameters' do
@ -60,12 +60,12 @@ describe 'cinder::backup::ceph' do
params.merge!(:backup_ceph_stripe_count => '67') params.merge!(:backup_ceph_stripe_count => '67')
end end
it 'should replace default parameters with new values' do it 'should replace default parameters with new values' do
should contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
should contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
should contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
should contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count]) is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
end end
end end
end end

View File

@ -39,28 +39,28 @@ describe 'cinder::backup' do
default_params.merge(params) default_params.merge(params)
end end
it { should contain_class('cinder::params') } it { is_expected.to contain_class('cinder::params') }
it 'installs cinder backup package' do it 'installs cinder backup package' do
if platform_params.has_key?(:backup_package) if platform_params.has_key?(:backup_package)
should contain_package('cinder-backup').with( is_expected.to contain_package('cinder-backup').with(
:name => platform_params[:backup_package], :name => platform_params[:backup_package],
:ensure => 'present' :ensure => 'present'
) )
should contain_package('cinder-backup').with_before(/Cinder_config\[.+\]/) is_expected.to contain_package('cinder-backup').with_before(/Cinder_config\[.+\]/)
should contain_package('cinder-backup').with_before(/Service\[cinder-backup\]/) is_expected.to contain_package('cinder-backup').with_before(/Service\[cinder-backup\]/)
end end
end end
it 'ensure cinder backup service is running' do it 'ensure cinder backup service is running' do
should contain_service('cinder-backup').with('hasstatus' => true) is_expected.to contain_service('cinder-backup').with('hasstatus' => true)
end end
it 'configures cinder.conf' do it 'configures cinder.conf' do
should contain_cinder_config('DEFAULT/backup_topic').with_value(p[:backup_topic]) is_expected.to contain_cinder_config('DEFAULT/backup_topic').with_value(p[:backup_topic])
should contain_cinder_config('DEFAULT/backup_manager').with_value(p[:backup_manager]) is_expected.to contain_cinder_config('DEFAULT/backup_manager').with_value(p[:backup_manager])
should contain_cinder_config('DEFAULT/backup_api_class').with_value(p[:backup_api_class]) is_expected.to contain_cinder_config('DEFAULT/backup_api_class').with_value(p[:backup_api_class])
should contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template]) is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template])
end end
context 'when overriding backup_name_template' do context 'when overriding backup_name_template' do
@ -68,7 +68,7 @@ describe 'cinder::backup' do
params.merge!(:backup_name_template => 'foo-bar-%s') params.merge!(:backup_name_template => 'foo-bar-%s')
end end
it 'should replace default parameter with new value' do it 'should replace default parameter with new value' do
should contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template]) is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template])
end end
end end
end end

View File

@ -40,12 +40,12 @@ describe 'cinder::backup::swift' do
end end
it 'configures cinder.conf' do it 'configures cinder.conf' do
should contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.swift') is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.swift')
should contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
should contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
should contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
should contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
should contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
end end
context 'when overriding default parameters' do context 'when overriding default parameters' do
@ -57,11 +57,11 @@ describe 'cinder::backup::swift' do
params.merge!(:backup_swift_retry_backoff => '56') params.merge!(:backup_swift_retry_backoff => '56')
end end
it 'should replace default parameters with new values' do it 'should replace default parameters with new values' do
should contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
should contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
should contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
should contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
should contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
end end
end end
end end

View File

@ -4,7 +4,7 @@ describe 'cinder::ceilometer' do
describe 'with default parameters' do describe 'with default parameters' do
it 'contains default values' do it 'contains default values' do
should contain_cinder_config('DEFAULT/notification_driver').with( is_expected.to contain_cinder_config('DEFAULT/notification_driver').with(
:value => 'cinder.openstack.common.notifier.rpc_notifier') :value => 'cinder.openstack.common.notifier.rpc_notifier')
end end
end end

View File

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'cinder::client' do describe 'cinder::client' do
it { should contain_package('python-cinderclient').with_ensure('present') } it { is_expected.to contain_package('python-cinderclient').with_ensure('present') }
let :facts do let :facts do
{:osfamily => 'Debian'} {:osfamily => 'Debian'}
end end
@ -9,6 +9,6 @@ describe 'cinder::client' do
let :params do let :params do
{:package_ensure => 'latest'} {:package_ensure => 'latest'}
end end
it { should contain_package('python-cinderclient').with_ensure('latest') } it { is_expected.to contain_package('python-cinderclient').with_ensure('latest') }
end end
end end

View File

@ -19,7 +19,7 @@ describe 'cinder::db::mysql' do
let :params do let :params do
req_params req_params
end end
it { should contain_openstacklib__db__mysql('cinder').with( it { is_expected.to contain_openstacklib__db__mysql('cinder').with(
:user => 'cinder', :user => 'cinder',
:password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122', :password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122',
:host => '127.0.0.1', :host => '127.0.0.1',

View File

@ -24,7 +24,7 @@ describe 'cinder::db::postgresql' do
req_params req_params
end end
it { should contain_postgresql__server__db('cinder').with( it { is_expected.to contain_postgresql__server__db('cinder').with(
:user => 'cinder', :user => 'cinder',
:password => 'md506736c3030793e09882cc536063d433f' :password => 'md506736c3030793e09882cc536063d433f'
)} )}
@ -47,7 +47,7 @@ describe 'cinder::db::postgresql' do
req_params req_params
end end
it { should contain_postgresql__server__db('cinder').with( it { is_expected.to contain_postgresql__server__db('cinder').with(
:user => 'cinder', :user => 'cinder',
:password => 'md506736c3030793e09882cc536063d433f' :password => 'md506736c3030793e09882cc536063d433f'
)} )}

View File

@ -5,7 +5,7 @@ describe 'cinder::db::sync' do
let :facts do let :facts do
{:osfamily => 'Debian'} {:osfamily => 'Debian'}
end end
it { should contain_exec('cinder-manage db_sync').with( it { is_expected.to contain_exec('cinder-manage db_sync').with(
:command => 'cinder-manage db sync', :command => 'cinder-manage db sync',
:path => '/usr/bin', :path => '/usr/bin',
:user => 'cinder', :user => 'cinder',

View File

@ -39,9 +39,9 @@ describe 'cinder::glance' do
end end
it 'configures cinder.conf with default params' do it 'configures cinder.conf with default params' do
should contain_cinder_config('DEFAULT/glance_api_version').with_value(p[:glance_api_version]) is_expected.to contain_cinder_config('DEFAULT/glance_api_version').with_value(p[:glance_api_version])
should contain_cinder_config('DEFAULT/glance_num_retries').with_value(p[:glance_num_retries]) is_expected.to contain_cinder_config('DEFAULT/glance_num_retries').with_value(p[:glance_num_retries])
should contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure]) is_expected.to contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure])
end end
context 'configure cinder with one glance server' do context 'configure cinder with one glance server' do
@ -49,7 +49,7 @@ describe 'cinder::glance' do
params.merge!(:glance_api_servers => '10.0.0.1:9292') params.merge!(:glance_api_servers => '10.0.0.1:9292')
end end
it 'should configure one glance server' do it 'should configure one glance server' do
should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers]) is_expected.to contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers])
end end
end end
@ -58,7 +58,7 @@ describe 'cinder::glance' do
params.merge!(:glance_api_servers => ['10.0.0.1:9292','10.0.0.2:9292']) params.merge!(:glance_api_servers => ['10.0.0.1:9292','10.0.0.2:9292'])
end end
it 'should configure two glance servers' do it 'should configure two glance servers' do
should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers].join(',')) is_expected.to contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers].join(','))
end end
end end
end end

View File

@ -14,35 +14,35 @@ describe 'cinder::keystone::auth' do
it 'should contain auth info' do it 'should contain auth info' do
should contain_keystone_user('cinder').with( is_expected.to contain_keystone_user('cinder').with(
:ensure => 'present', :ensure => 'present',
:password => 'pw', :password => 'pw',
:email => 'cinder@localhost', :email => 'cinder@localhost',
:tenant => 'services' :tenant => 'services'
) )
should contain_keystone_user_role('cinder@services').with( is_expected.to contain_keystone_user_role('cinder@services').with(
:ensure => 'present', :ensure => 'present',
:roles => 'admin' :roles => 'admin'
) )
should contain_keystone_service('cinder').with( is_expected.to contain_keystone_service('cinder').with(
:ensure => 'present', :ensure => 'present',
:type => 'volume', :type => 'volume',
:description => 'Cinder Service' :description => 'Cinder Service'
) )
should contain_keystone_service('cinderv2').with( is_expected.to contain_keystone_service('cinderv2').with(
:ensure => 'present', :ensure => 'present',
:type => 'volumev2', :type => 'volumev2',
:description => 'Cinder Service v2' :description => 'Cinder Service v2'
) )
end end
it { should contain_keystone_endpoint('RegionOne/cinder').with( it { is_expected.to contain_keystone_endpoint('RegionOne/cinder').with(
:ensure => 'present', :ensure => 'present',
:public_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s', :public_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s', :admin_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
:internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s' :internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s'
) } ) }
it { should contain_keystone_endpoint('RegionOne/cinderv2').with( it { is_expected.to contain_keystone_endpoint('RegionOne/cinderv2').with(
:ensure => 'present', :ensure => 'present',
:public_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s', :public_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s', :admin_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
@ -66,14 +66,14 @@ describe 'cinder::keystone::auth' do
) )
end end
it { should contain_keystone_endpoint('RegionThree/cinder').with( it { is_expected.to contain_keystone_endpoint('RegionThree/cinder').with(
:ensure => 'present', :ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s', :public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s', :admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s' :internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)} )}
it { should contain_keystone_endpoint('RegionThree/cinderv2').with( it { is_expected.to contain_keystone_endpoint('RegionThree/cinderv2').with(
:ensure => 'present', :ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v2/%(tenant_id)s', :public_url => 'https://10.0.42.1:4242/v2/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v2/%(tenant_id)s', :admin_url => 'https://10.0.42.2:4242/v2/%(tenant_id)s',
@ -82,29 +82,29 @@ describe 'cinder::keystone::auth' do
end end
describe 'when endpoint should not be configured' do describe 'when endpoint is_expected.to not be configured' do
let :params do let :params do
req_params.merge( req_params.merge(
:configure_endpoint => false, :configure_endpoint => false,
:configure_endpoint_v2 => false :configure_endpoint_v2 => false
) )
end end
it { should_not contain_keystone_endpoint('RegionOne/cinder') } it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinder') }
it { should_not contain_keystone_endpoint('RegionOne/cinderv2') } it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinderv2') }
end end
describe 'when user should not be configured' do describe 'when user is_expected.to not be configured' do
let :params do let :params do
req_params.merge( req_params.merge(
:configure_user => false :configure_user => false
) )
end end
it { should_not contain_keystone_user('cinder') } it { is_expected.to_not contain_keystone_user('cinder') }
it { should contain_keystone_user_role('cinder@services') } it { is_expected.to contain_keystone_user_role('cinder@services') }
it { should contain_keystone_service('cinder').with( it { is_expected.to contain_keystone_service('cinder').with(
:ensure => 'present', :ensure => 'present',
:type => 'volume', :type => 'volume',
:description => 'Cinder Service' :description => 'Cinder Service'
@ -112,7 +112,7 @@ describe 'cinder::keystone::auth' do
end end
describe 'when user and user role should not be configured' do describe 'when user and user role is_expected.to not be configured' do
let :params do let :params do
req_params.merge( req_params.merge(
:configure_user => false, :configure_user => false,
@ -120,11 +120,11 @@ describe 'cinder::keystone::auth' do
) )
end end
it { should_not contain_keystone_user('cinder') } it { is_expected.to_not contain_keystone_user('cinder') }
it { should_not contain_keystone_user_role('cinder@services') } it { is_expected.to_not contain_keystone_user_role('cinder@services') }
it { should contain_keystone_service('cinder').with( it { is_expected.to contain_keystone_service('cinder').with(
:ensure => 'present', :ensure => 'present',
:type => 'volume', :type => 'volume',
:description => 'Cinder Service' :description => 'Cinder Service'

View File

@ -42,36 +42,36 @@ describe 'cinder::logging' do
shared_examples_for 'logging params set' do shared_examples_for 'logging params set' do
it 'enables logging params' do it 'enables logging params' do
should contain_cinder_config('DEFAULT/logging_context_format_string').with_value( is_expected.to contain_cinder_config('DEFAULT/logging_context_format_string').with_value(
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s') '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
should contain_cinder_config('DEFAULT/logging_default_format_string').with_value( is_expected.to contain_cinder_config('DEFAULT/logging_default_format_string').with_value(
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s') '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
should contain_cinder_config('DEFAULT/logging_debug_format_suffix').with_value( is_expected.to contain_cinder_config('DEFAULT/logging_debug_format_suffix').with_value(
'%(funcName)s %(pathname)s:%(lineno)d') '%(funcName)s %(pathname)s:%(lineno)d')
should contain_cinder_config('DEFAULT/logging_exception_prefix').with_value( is_expected.to contain_cinder_config('DEFAULT/logging_exception_prefix').with_value(
'%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s') '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
should contain_cinder_config('DEFAULT/log_config_append').with_value( is_expected.to contain_cinder_config('DEFAULT/log_config_append').with_value(
'/etc/cinder/logging.conf') '/etc/cinder/logging.conf')
should contain_cinder_config('DEFAULT/publish_errors').with_value( is_expected.to contain_cinder_config('DEFAULT/publish_errors').with_value(
true) true)
should contain_cinder_config('DEFAULT/default_log_levels').with_value( is_expected.to contain_cinder_config('DEFAULT/default_log_levels').with_value(
'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO') 'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
should contain_cinder_config('DEFAULT/fatal_deprecations').with_value( is_expected.to contain_cinder_config('DEFAULT/fatal_deprecations').with_value(
true) true)
should contain_cinder_config('DEFAULT/instance_format').with_value( is_expected.to contain_cinder_config('DEFAULT/instance_format').with_value(
'[instance: %(uuid)s] ') '[instance: %(uuid)s] ')
should contain_cinder_config('DEFAULT/instance_uuid_format').with_value( is_expected.to contain_cinder_config('DEFAULT/instance_uuid_format').with_value(
'[instance: %(uuid)s] ') '[instance: %(uuid)s] ')
should contain_cinder_config('DEFAULT/log_date_format').with_value( is_expected.to contain_cinder_config('DEFAULT/log_date_format').with_value(
'%Y-%m-%d %H:%M:%S') '%Y-%m-%d %H:%M:%S')
end end
end end
@ -84,7 +84,7 @@ describe 'cinder::logging' do
:default_log_levels, :fatal_deprecations, :default_log_levels, :fatal_deprecations,
:instance_format, :instance_uuid_format, :instance_format, :instance_uuid_format,
:log_date_format, ].each { |param| :log_date_format, ].each { |param|
it { should contain_cinder_config("DEFAULT/#{param}").with_ensure('absent') } it { is_expected.to contain_cinder_config("DEFAULT/#{param}").with_ensure('absent') }
} }
end end

View File

@ -16,7 +16,7 @@ describe 'cinder::policy' do
end end
it 'set up the policies' do it 'set up the policies' do
should contain_openstacklib__policy__base('context_is_admin').with({ is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin', :key => 'context_is_admin',
:value => 'foo:bar' :value => 'foo:bar'
}) })

View File

@ -11,7 +11,7 @@ describe 'cinder::qpid' do
it 'should contain all of the default resources' do it 'should contain all of the default resources' do
should contain_class('qpid::server').with( is_expected.to contain_class('qpid::server').with(
:service_ensure => 'running', :service_ensure => 'running',
:port => '5672' :port => '5672'
) )
@ -20,7 +20,7 @@ describe 'cinder::qpid' do
it 'should contain user' do it 'should contain user' do
should contain_qpid_user('guest').with( is_expected.to contain_qpid_user('guest').with(
:password => 'guest', :password => 'guest',
:file => '/var/lib/qpidd/qpidd.sasldb', :file => '/var/lib/qpidd/qpidd.sasldb',
:realm => 'OPENSTACK', :realm => 'OPENSTACK',
@ -40,8 +40,8 @@ describe 'cinder::qpid' do
it 'should be disabled' do it 'should be disabled' do
should_not contain_qpid_user('guest') is_expected.to_not contain_qpid_user('guest')
should contain_class('qpid::server').with( is_expected.to contain_class('qpid::server').with(
:service_ensure => 'stopped' :service_ensure => 'stopped'
) )

View File

@ -4,13 +4,13 @@ describe 'cinder::quota' do
describe 'with default parameters' do describe 'with default parameters' do
it 'contains default values' do it 'contains default values' do
should contain_cinder_config('DEFAULT/quota_volumes').with( is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with(
:value => 10) :value => 10)
should contain_cinder_config('DEFAULT/quota_snapshots').with( is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with(
:value => 10) :value => 10)
should contain_cinder_config('DEFAULT/quota_gigabytes').with( is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with(
:value => 1000) :value => 1000)
should contain_cinder_config('DEFAULT/quota_driver').with( is_expected.to contain_cinder_config('DEFAULT/quota_driver').with(
:value => 'cinder.quota.DbQuotaDriver') :value => 'cinder.quota.DbQuotaDriver')
end end
end end
@ -22,13 +22,13 @@ describe 'cinder::quota' do
:quota_gigabytes => 100000 } :quota_gigabytes => 100000 }
end end
it 'contains overrided values' do it 'contains overrided values' do
should contain_cinder_config('DEFAULT/quota_volumes').with( is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with(
:value => 1000) :value => 1000)
should contain_cinder_config('DEFAULT/quota_snapshots').with( is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with(
:value => 1000) :value => 1000)
should contain_cinder_config('DEFAULT/quota_gigabytes').with( is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with(
:value => 100000) :value => 100000)
should contain_cinder_config('DEFAULT/quota_driver').with( is_expected.to contain_cinder_config('DEFAULT/quota_driver').with(
:value => 'cinder.quota.DbQuotaDriver') :value => 'cinder.quota.DbQuotaDriver')
end end
end end

View File

@ -12,13 +12,13 @@ describe 'cinder::rabbitmq' do
it 'should contain all of the default resources' do it 'should contain all of the default resources' do
should contain_class('rabbitmq::server').with( is_expected.to contain_class('rabbitmq::server').with(
:service_ensure => 'running', :service_ensure => 'running',
:port => '5672', :port => '5672',
:delete_guest_user => false :delete_guest_user => false
) )
should contain_rabbitmq_vhost('/').with( is_expected.to contain_rabbitmq_vhost('/').with(
:provider => 'rabbitmqctl' :provider => 'rabbitmqctl'
) )
end end
@ -36,13 +36,13 @@ describe 'cinder::rabbitmq' do
it 'should contain user and permissions' do it 'should contain user and permissions' do
should contain_rabbitmq_user('dan').with( is_expected.to contain_rabbitmq_user('dan').with(
:admin => true, :admin => true,
:password => 'pass', :password => 'pass',
:provider => 'rabbitmqctl' :provider => 'rabbitmqctl'
) )
should contain_rabbitmq_user_permissions('dan@/').with( is_expected.to contain_rabbitmq_user_permissions('dan@/').with(
:configure_permission => '.*', :configure_permission => '.*',
:write_permission => '.*', :write_permission => '.*',
:read_permission => '.*', :read_permission => '.*',
@ -64,15 +64,15 @@ describe 'cinder::rabbitmq' do
it 'should be disabled' do it 'should be disabled' do
should_not contain_rabbitmq_user('dan') is_expected.to_not contain_rabbitmq_user('dan')
should_not contain_rabbitmq_user_permissions('dan@/') is_expected.to_not contain_rabbitmq_user_permissions('dan@/')
should contain_class('rabbitmq::server').with( is_expected.to contain_class('rabbitmq::server').with(
:service_ensure => 'stopped', :service_ensure => 'stopped',
:port => '5672', :port => '5672',
:delete_guest_user => false :delete_guest_user => false
) )
should_not contain_rabbitmq_vhost('/') is_expected.to_not contain_rabbitmq_vhost('/')
end end
end end
@ -86,7 +86,7 @@ describe 'cinder::rabbitmq' do
end end
it 'should not contain rabbitmq class calls' do it 'should not contain rabbitmq class calls' do
should_not contain_class('rabbitmq::server') is_expected.to_not contain_class('rabbitmq::server')
end end
end end

View File

@ -10,15 +10,15 @@ describe 'cinder::scheduler' do
describe 'with default parameters' do describe 'with default parameters' do
it { should contain_class('cinder::params') } it { is_expected.to contain_class('cinder::params') }
it { should contain_package('cinder-scheduler').with( it { is_expected.to contain_package('cinder-scheduler').with(
:name => 'cinder-scheduler', :name => 'cinder-scheduler',
:ensure => 'present', :ensure => 'present',
:before => 'Service[cinder-scheduler]' :before => 'Service[cinder-scheduler]'
) } ) }
it { should contain_service('cinder-scheduler').with( it { is_expected.to contain_service('cinder-scheduler').with(
:name => 'cinder-scheduler', :name => 'cinder-scheduler',
:enable => true, :enable => true,
:ensure => 'running', :ensure => 'running',
@ -35,8 +35,8 @@ describe 'cinder::scheduler' do
} }
end end
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') } it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
it { should contain_package('cinder-scheduler').with_ensure('present') } it { is_expected.to contain_package('cinder-scheduler').with_ensure('present') }
end end
describe 'with manage_service false' do describe 'with manage_service false' do
@ -45,7 +45,7 @@ describe 'cinder::scheduler' do
} }
end end
it 'should not change the state of the service' do it 'should not change the state of the service' do
should contain_service('cinder-scheduler').without_ensure is_expected.to contain_service('cinder-scheduler').without_ensure
end end
end end
end end
@ -59,9 +59,9 @@ describe 'cinder::scheduler' do
describe 'with default parameters' do describe 'with default parameters' do
it { should contain_class('cinder::params') } it { is_expected.to contain_class('cinder::params') }
it { should contain_service('cinder-scheduler').with( it { is_expected.to contain_service('cinder-scheduler').with(
:name => 'openstack-cinder-scheduler', :name => 'openstack-cinder-scheduler',
:enable => true, :enable => true,
:ensure => 'running', :ensure => 'running',
@ -75,7 +75,7 @@ describe 'cinder::scheduler' do
{ :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler' } { :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler' }
end end
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') } it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
end end
end end
end end

View File

@ -2,21 +2,21 @@ require 'spec_helper'
describe 'cinder::setup_test_volume' do describe 'cinder::setup_test_volume' do
it { should contain_package('lvm2').with( it { is_expected.to contain_package('lvm2').with(
:ensure => 'present' :ensure => 'present'
) } ) }
it { should contain_file('/var/lib/cinder').with( it { is_expected.to contain_file('/var/lib/cinder').with(
:ensure => 'directory', :ensure => 'directory',
:require => 'Package[cinder]' :require => 'Package[cinder]'
) } ) }
it 'should contain volume creation execs' do it 'should contain volume creation execs' do
should contain_exec('create_/var/lib/cinder/cinder-volumes').with( is_expected.to contain_exec('create_/var/lib/cinder/cinder-volumes').with(
:command => 'dd if=/dev/zero of="/var/lib/cinder/cinder-volumes" bs=1 count=0 seek=4G' :command => 'dd if=/dev/zero of="/var/lib/cinder/cinder-volumes" bs=1 count=0 seek=4G'
) )
should contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes') is_expected.to contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes')
should contain_exec('pvcreate /dev/loop2') is_expected.to contain_exec('pvcreate /dev/loop2')
should contain_exec('vgcreate cinder-volumes /dev/loop2') is_expected.to contain_exec('vgcreate cinder-volumes /dev/loop2')
end end
end end

View File

@ -13,82 +13,42 @@ describe 'cinder' do
req_params req_params
end end
it { should contain_class('cinder::params') } it { is_expected.to contain_class('cinder::params') }
it { should contain_class('mysql::bindings::python') } it { is_expected.to contain_class('mysql::bindings::python') }
it 'should contain default config' do it 'should contain default config' do
should contain_cinder_config('DEFAULT/rpc_backend').with( is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with(:value => 'cinder.openstack.common.rpc.impl_kombu')
:value => 'cinder.openstack.common.rpc.impl_kombu' is_expected.to contain_cinder_config('DEFAULT/control_exchange').with(:value => 'openstack')
) is_expected.to contain_cinder_config('DEFAULT/rabbit_password').with(:value => 'guest', :secret => true)
should contain_cinder_config('DEFAULT/control_exchange').with( is_expected.to contain_cinder_config('DEFAULT/rabbit_host').with(:value => '127.0.0.1')
:value => 'openstack' is_expected.to contain_cinder_config('DEFAULT/rabbit_port').with(:value => '5672')
) is_expected.to contain_cinder_config('DEFAULT/rabbit_hosts').with(:value => '127.0.0.1:5672')
should contain_cinder_config('DEFAULT/rabbit_password').with( is_expected.to contain_cinder_config('DEFAULT/rabbit_ha_queues').with(:value => false)
:value => 'guest', is_expected.to contain_cinder_config('DEFAULT/rabbit_virtual_host').with(:value => '/')
:secret => true is_expected.to contain_cinder_config('DEFAULT/rabbit_userid').with(:value => 'guest')
) is_expected.to contain_cinder_config('database/connection').with(:value => 'mysql://user:password@host/database', :secret => true)
should contain_cinder_config('DEFAULT/rabbit_host').with( is_expected.to contain_cinder_config('database/idle_timeout').with(:value => '3600')
:value => '127.0.0.1' is_expected.to contain_cinder_config('database/min_pool_size').with(:value => '1')
) is_expected.to contain_cinder_config('database/max_pool_size').with_ensure('absent')
should contain_cinder_config('DEFAULT/rabbit_port').with( is_expected.to contain_cinder_config('database/max_retries').with(:value => '10')
:value => '5672' is_expected.to contain_cinder_config('database/retry_interval').with(:value => '10')
) is_expected.to contain_cinder_config('database/max_overflow').with_ensure('absent')
should contain_cinder_config('DEFAULT/rabbit_hosts').with( is_expected.to contain_cinder_config('DEFAULT/verbose').with(:value => false)
:value => '127.0.0.1:5672' is_expected.to contain_cinder_config('DEFAULT/debug').with(:value => false)
) is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => 'nova')
should contain_cinder_config('DEFAULT/rabbit_ha_queues').with( is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => 'nova')
:value => false is_expected.to contain_cinder_config('DEFAULT/api_paste_config').with(:value => '/etc/cinder/api-paste.ini')
) is_expected.to contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder')
should contain_cinder_config('DEFAULT/rabbit_virtual_host').with(
:value => '/'
)
should contain_cinder_config('DEFAULT/rabbit_userid').with(
:value => 'guest'
)
should contain_cinder_config('database/connection').with(
:value => 'mysql://user:password@host/database',
:secret => true
)
should contain_cinder_config('database/idle_timeout').with(
:value => '3600'
)
should contain_cinder_config('database/min_pool_size').with(
:value => '1'
)
should contain_cinder_config('database/max_pool_size').with_ensure('absent')
should contain_cinder_config('database/max_retries').with(
:value => '10'
)
should contain_cinder_config('database/retry_interval').with(
:value => '10'
)
should contain_cinder_config('database/max_overflow').with_ensure('absent')
should contain_cinder_config('DEFAULT/verbose').with(
:value => false
)
should contain_cinder_config('DEFAULT/debug').with(
:value => false
)
should contain_cinder_config('DEFAULT/storage_availability_zone').with(
:value => 'nova'
)
should contain_cinder_config('DEFAULT/default_availability_zone').with(
:value => 'nova'
)
should contain_cinder_config('DEFAULT/api_paste_config').with(
:value => '/etc/cinder/api-paste.ini'
)
should contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder')
end end
it { should contain_file('/etc/cinder/cinder.conf').with( it { is_expected.to contain_file('/etc/cinder/cinder.conf').with(
:owner => 'cinder', :owner => 'cinder',
:group => 'cinder', :group => 'cinder',
:mode => '0600', :mode => '0600',
:require => 'Package[cinder]' :require => 'Package[cinder]'
) } ) }
it { should contain_file('/etc/cinder/api-paste.ini').with( it { is_expected.to contain_file('/etc/cinder/api-paste.ini').with(
:owner => 'cinder', :owner => 'cinder',
:group => 'cinder', :group => 'cinder',
:mode => '0600', :mode => '0600',
@ -102,18 +62,10 @@ describe 'cinder' do
end end
it 'should contain many' do it 'should contain many' do
should contain_cinder_config('DEFAULT/rabbit_host').with( is_expected.to contain_cinder_config('DEFAULT/rabbit_host').with(:value => nil)
:value => nil is_expected.to contain_cinder_config('DEFAULT/rabbit_port').with(:value => nil)
) is_expected.to contain_cinder_config('DEFAULT/rabbit_hosts').with(:value => 'rabbit1:5672,rabbit2:5672')
should contain_cinder_config('DEFAULT/rabbit_port').with( is_expected.to contain_cinder_config('DEFAULT/rabbit_ha_queues').with(:value => true)
:value => nil
)
should contain_cinder_config('DEFAULT/rabbit_hosts').with(
:value => 'rabbit1:5672,rabbit2:5672'
)
should contain_cinder_config('DEFAULT/rabbit_ha_queues').with(
:value => true
)
end end
end end
@ -123,18 +75,10 @@ describe 'cinder' do
end end
it 'should contain many' do it 'should contain many' do
should contain_cinder_config('DEFAULT/rabbit_host').with( is_expected.to contain_cinder_config('DEFAULT/rabbit_host').with(:value => nil)
:value => nil is_expected.to contain_cinder_config('DEFAULT/rabbit_port').with(:value => nil)
) is_expected.to contain_cinder_config('DEFAULT/rabbit_hosts').with(:value => 'rabbit1:5672')
should contain_cinder_config('DEFAULT/rabbit_port').with( is_expected.to contain_cinder_config('DEFAULT/rabbit_ha_queues').with(:value => true)
:value => nil
)
should contain_cinder_config('DEFAULT/rabbit_hosts').with(
:value => 'rabbit1:5672'
)
should contain_cinder_config('DEFAULT/rabbit_ha_queues').with(
:value => true
)
end end
end end
@ -148,21 +92,21 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('database/connection').with_value('mysql://user:password@host/database') } it { is_expected.to contain_cinder_config('database/connection').with_value('mysql://user:password@host/database') }
it { should contain_cinder_config('DEFAULT/rpc_backend').with_value('cinder.openstack.common.rpc.impl_qpid') } it { is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with_value('cinder.openstack.common.rpc.impl_qpid') }
it { should contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { should contain_cinder_config('DEFAULT/qpid_port').with_value('5672') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_port').with_value('5672') }
it { should contain_cinder_config('DEFAULT/qpid_username').with_value('guest') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_username').with_value('guest') }
it { should contain_cinder_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) } it { is_expected.to contain_cinder_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) }
it { should contain_cinder_config('DEFAULT/qpid_reconnect').with_value(true) } it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect').with_value(true) }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { should contain_cinder_config('DEFAULT/qpid_protocol').with_value('tcp') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { should contain_cinder_config('DEFAULT/qpid_tcp_nodelay').with_value(true) } it { is_expected.to contain_cinder_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
end end
describe 'with qpid rpc and no qpid_sasl_mechanisms' do describe 'with qpid rpc and no qpid_sasl_mechanisms' do
@ -174,7 +118,7 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_ensure('absent') }
end end
describe 'with qpid rpc and qpid_sasl_mechanisms string' do describe 'with qpid rpc and qpid_sasl_mechanisms string' do
@ -187,7 +131,7 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('PLAIN') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('PLAIN') }
end end
describe 'with qpid rpc and qpid_sasl_mechanisms array' do describe 'with qpid rpc and qpid_sasl_mechanisms array' do
@ -200,7 +144,7 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('DIGEST-MD5 GSSAPI PLAIN') } it { is_expected.to contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('DIGEST-MD5 GSSAPI PLAIN') }
end end
describe 'with SSL enabled with kombu' do describe 'with SSL enabled with kombu' do
@ -215,11 +159,11 @@ describe 'cinder' do
end end
it do it do
should contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('true') is_expected.to contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('true')
should contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs')
should contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file')
should contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile')
should contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
end end
end end
@ -231,11 +175,11 @@ describe 'cinder' do
end end
it do it do
should contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('true') is_expected.to contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('true')
should contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
should contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
should contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
should contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1')
end end
end end
@ -251,11 +195,11 @@ describe 'cinder' do
end end
it do it do
should contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('false') is_expected.to contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('false')
should contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
should contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
should contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
should contain_cinder_config('DEFAULT/kombu_ssl_version').with_ensure('absent') is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_version').with_ensure('absent')
end end
end end
@ -264,7 +208,7 @@ describe 'cinder' do
req_params req_params
end end
it { should contain_cinder_config('DEFAULT/use_syslog').with_value(false) } it { is_expected.to contain_cinder_config('DEFAULT/use_syslog').with_value(false) }
end end
describe 'with syslog enabled' do describe 'with syslog enabled' do
@ -274,8 +218,8 @@ describe 'cinder' do
}) })
end end
it { should contain_cinder_config('DEFAULT/use_syslog').with_value(true) } it { is_expected.to contain_cinder_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') } it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
end end
describe 'with syslog enabled and custom settings' do describe 'with syslog enabled and custom settings' do
@ -286,13 +230,13 @@ describe 'cinder' do
}) })
end end
it { should contain_cinder_config('DEFAULT/use_syslog').with_value(true) } it { is_expected.to contain_cinder_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') } it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end end
describe 'with log_dir disabled' do describe 'with log_dir disabled' do
let(:params) { req_params.merge!({:log_dir => false}) } let(:params) { req_params.merge!({:log_dir => false}) }
it { should contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') }
end end
describe 'with amqp_durable_queues disabled' do describe 'with amqp_durable_queues disabled' do
@ -300,7 +244,7 @@ describe 'cinder' do
req_params req_params
end end
it { should contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(false) } it { is_expected.to contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(false) }
end end
describe 'with amqp_durable_queues enabled' do describe 'with amqp_durable_queues enabled' do
@ -310,7 +254,7 @@ describe 'cinder' do
}) })
end end
it { should contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(true) } it { is_expected.to contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(true) }
end end
describe 'with postgresql' do describe 'with postgresql' do
@ -321,13 +265,13 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('database/connection').with( it { is_expected.to contain_cinder_config('database/connection').with(
:value => 'postgresql://user:drowssap@host/database', :value => 'postgresql://user:drowssap@host/database',
:secret => true :secret => true
) } ) }
it { should_not contain_class('mysql::python') } it { is_expected.to_not contain_class('mysql::python') }
it { should_not contain_class('mysql::bindings') } it { is_expected.to_not contain_class('mysql::bindings') }
it { should_not contain_class('mysql::bindings::python') } it { is_expected.to_not contain_class('mysql::bindings::python') }
end end
describe 'with SSL socket options set' do describe 'with SSL socket options set' do
@ -341,9 +285,9 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') } it { is_expected.to contain_cinder_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') }
it { should contain_cinder_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') } it { is_expected.to contain_cinder_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') }
it { should contain_cinder_config('DEFAULT/ssl_key_file').with_value('/path/to/key') } it { is_expected.to contain_cinder_config('DEFAULT/ssl_key_file').with_value('/path/to/key') }
end end
describe 'with SSL socket options set to false' do describe 'with SSL socket options set to false' do
@ -357,9 +301,9 @@ describe 'cinder' do
} }
end end
it { should contain_cinder_config('DEFAULT/ssl_ca_file').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/ssl_ca_file').with_ensure('absent') }
it { should contain_cinder_config('DEFAULT/ssl_cert_file').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/ssl_cert_file').with_ensure('absent') }
it { should contain_cinder_config('DEFAULT/ssl_key_file').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/ssl_key_file').with_ensure('absent') }
end end
describe 'with SSL socket options set wrongly configured' do describe 'with SSL socket options set wrongly configured' do
@ -372,11 +316,7 @@ describe 'cinder' do
} }
end end
it 'should raise an error' do it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
expect {
should compile
}.to raise_error Puppet::Error, /The cert_file parameter is required when use_ssl is set to true/
end
end end
describe 'with APIs set for Kilo (proposed)' do describe 'with APIs set for Kilo (proposed)' do

View File

@ -11,23 +11,23 @@ describe 'cinder::vmware' do
describe 'with defaults' do describe 'with defaults' do
it 'should create vmware special types' do it 'should create vmware special types' do
should contain_cinder__type('vmware-thin').with( is_expected.to contain_cinder__type('vmware-thin').with(
:set_key => 'vmware:vmdk_type', :set_key => 'vmware:vmdk_type',
:set_value => 'thin') :set_value => 'thin')
should contain_cinder__type('vmware-thick').with( is_expected.to contain_cinder__type('vmware-thick').with(
:set_key => 'vmware:vmdk_type', :set_key => 'vmware:vmdk_type',
:set_value => 'thick') :set_value => 'thick')
should contain_cinder__type('vmware-eagerZeroedThick').with( is_expected.to contain_cinder__type('vmware-eagerZeroedThick').with(
:set_key => 'vmware:vmdk_type', :set_key => 'vmware:vmdk_type',
:set_value => 'eagerZeroedThick') :set_value => 'eagerZeroedThick')
should contain_cinder__type('vmware-full').with( is_expected.to contain_cinder__type('vmware-full').with(
:set_key => 'vmware:clone_type', :set_key => 'vmware:clone_type',
:set_value => 'full') :set_value => 'full')
should contain_cinder__type('vmware-linked').with( is_expected.to contain_cinder__type('vmware-linked').with(
:set_key => 'vmware:clone_type', :set_key => 'vmware:clone_type',
:set_value => 'linked') :set_value => 'linked')
end end

View File

@ -21,12 +21,12 @@ describe 'cinder::volume::emc_vnx' do
describe 'emc vnx volume driver' do describe 'emc vnx volume driver' do
it 'configure emc vnx volume driver' do it 'configure emc vnx volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver') is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver')
should contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2') is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2')
should contain_cinder_config('DEFAULT/san_login').with_value('emc') is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('emc')
should contain_cinder_config('DEFAULT/san_password').with_value('password') is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password')
should contain_cinder_config('DEFAULT/iscsi_ip_address').with_value('127.0.0.3') is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with_value('127.0.0.3')
should contain_cinder_config('DEFAULT/storage_vnx_pool_name').with_value('emc-storage-pool') is_expected.to contain_cinder_config('DEFAULT/storage_vnx_pool_name').with_value('emc-storage-pool')
end end
end end
end end

View File

@ -19,16 +19,16 @@ describe 'cinder::volume::eqlx' do
describe 'eqlx volume driver' do describe 'eqlx volume driver' do
it 'configures eqlx volume driver' do it 'configures eqlx volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver') is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver')
should contain_cinder_config('DEFAULT/volume_backend_name').with_value('DEFAULT') is_expected.to contain_cinder_config('DEFAULT/volume_backend_name').with_value('DEFAULT')
params.each_pair do |config,value| params.each_pair do |config,value|
should contain_cinder_config("DEFAULT/#{config}").with_value(value) is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value(value)
end end
end end
it 'marks eqlx_chap_password as secret' do it 'marks eqlx_chap_password as secret' do
should contain_cinder_config('DEFAULT/eqlx_chap_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/eqlx_chap_password').with_secret( true )
end end
end end

View File

@ -13,15 +13,11 @@ describe 'cinder::volume::glusterfs' do
end end
it 'configures glusterfs volume driver' do it 'configures glusterfs volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value( is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.glusterfs.GlusterfsDriver')
'cinder.volume.drivers.glusterfs.GlusterfsDriver') is_expected.to contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value('/etc/cinder/other_shares.conf')
should contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value( is_expected.to contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value(true)
'/etc/cinder/other_shares.conf') is_expected.to contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value('/cinder_mount_point')
should contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value( is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
true)
should contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value(
'/cinder_mount_point')
should contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n", :content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n",
:require => 'Package[cinder]', :require => 'Package[cinder]',
:notify => 'Service[cinder-volume]' :notify => 'Service[cinder-volume]'
@ -34,9 +30,7 @@ describe 'cinder::volume::glusterfs' do
:glusterfs_disk_util => 'foo', :glusterfs_disk_util => 'foo',
}) })
end end
it 'should fails' do it_raises 'a Puppet::Error', /glusterfs_disk_util is removed in Icehouse./
expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./)
end
end end
end end

View File

@ -16,13 +16,13 @@ describe 'cinder::volume::iscsi' do
req_params req_params
end end
it { should contain_cinder_config('DEFAULT/volume_driver').with( it { is_expected.to contain_cinder_config('DEFAULT/volume_driver').with(
:value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')} :value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')}
it { should contain_cinder_config('DEFAULT/iscsi_ip_address').with(:value => '127.0.0.2')} it { is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with(:value => '127.0.0.2')}
it { should contain_cinder_config('DEFAULT/iscsi_helper').with(:value => 'tgtadm')} it { is_expected.to contain_cinder_config('DEFAULT/iscsi_helper').with(:value => 'tgtadm')}
it { should contain_cinder_config('DEFAULT/volume_group').with(:value => 'cinder-volumes')} it { is_expected.to contain_cinder_config('DEFAULT/volume_group').with(:value => 'cinder-volumes')}
it { should contain_cinder_config('DEFAULT/volumes_dir').with(:value => '/var/lib/cinder/volumes')} it { is_expected.to contain_cinder_config('DEFAULT/volumes_dir').with(:value => '/var/lib/cinder/volumes')}
it { should contain_cinder_config('DEFAULT/iscsi_protocol').with(:value => 'iscsi')} it { is_expected.to contain_cinder_config('DEFAULT/iscsi_protocol').with(:value => 'iscsi')}
end end
@ -30,7 +30,7 @@ describe 'cinder::volume::iscsi' do
let(:params) { req_params.merge(:volumes_dir => '/etc/cinder/volumes')} let(:params) { req_params.merge(:volumes_dir => '/etc/cinder/volumes')}
it 'should contain a cinder::backend::iscsi resource with /etc/cinder/volumes as $volumes dir' do it 'should contain a cinder::backend::iscsi resource with /etc/cinder/volumes as $volumes dir' do
should contain_cinder__backend__iscsi('DEFAULT').with({ is_expected.to contain_cinder__backend__iscsi('DEFAULT').with({
:volumes_dir => '/etc/cinder/volumes' :volumes_dir => '/etc/cinder/volumes'
}) })
end end
@ -40,11 +40,7 @@ describe 'cinder::volume::iscsi' do
describe 'with a unsupported iscsi helper' do describe 'with a unsupported iscsi helper' do
let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')} let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')}
it 'should raise an error' do it_raises 'a Puppet::Error', /Unsupported iscsi helper: fooboozoo/
expect {
should compile
}.to raise_error Puppet::Error, /Unsupported iscsi helper: fooboozoo/
end
end end
describe 'with RedHat' do describe 'with RedHat' do
@ -59,7 +55,7 @@ describe 'cinder::volume::iscsi' do
:operatingsystemmajrelease => '6'} :operatingsystemmajrelease => '6'}
end end
it { should contain_file_line('cinder include').with( it { is_expected.to contain_file_line('cinder include').with(
:line => 'include /var/lib/cinder/volumes/*', :line => 'include /var/lib/cinder/volumes/*',
:path => '/etc/tgt/targets.conf' :path => '/etc/tgt/targets.conf'
) } ) }
@ -78,8 +74,8 @@ describe 'cinder::volume::iscsi' do
{:osfamily => 'RedHat'} {:osfamily => 'RedHat'}
end end
it { should contain_package('targetcli').with_ensure('present')} it { is_expected.to contain_package('targetcli').with_ensure('present')}
it { should contain_service('target').with( it { is_expected.to contain_service('target').with(
:ensure => 'running', :ensure => 'running',
:enable => 'true', :enable => 'true',
:require => 'Package[targetcli]' :require => 'Package[targetcli]'

View File

@ -39,19 +39,19 @@ describe 'cinder::volume::netapp' do
end end
it 'configures netapp volume driver' do it 'configures netapp volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value( is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value(
'cinder.volume.drivers.netapp.common.NetAppDriver') 'cinder.volume.drivers.netapp.common.NetAppDriver')
params_hash.each_pair do |config,value| params_hash.each_pair do |config,value|
should contain_cinder_config("DEFAULT/#{config}").with_value( value ) is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value( value )
end end
end end
it 'marks netapp_password as secret' do it 'marks netapp_password as secret' do
should contain_cinder_config('DEFAULT/netapp_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/netapp_password').with_secret( true )
end end
it 'marks netapp_sa_password as secret' do it 'marks netapp_sa_password as secret' do
should contain_cinder_config('DEFAULT/netapp_sa_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/netapp_sa_password').with_secret( true )
end end
end end
@ -75,7 +75,7 @@ describe 'cinder::volume::netapp' do
}) } }) }
it 'writes NFS shares to file' do it 'writes NFS shares to file' do
should contain_file("#{req_params[:nfs_shares_config]}") is_expected.to contain_file("#{req_params[:nfs_shares_config]}")
.with_content("10.0.0.1:/test1\n10.0.0.2:/test2") .with_content("10.0.0.1:/test1\n10.0.0.2:/test2")
end end
end end

View File

@ -31,12 +31,12 @@ describe 'cinder::volume::nexenta' do
it 'configures nexenta volume driver' do it 'configures nexenta volume driver' do
params_hash.each_pair do |config, value| params_hash.each_pair do |config, value|
should contain_cinder_config("DEFAULT/#{config}").with_value(value) is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value(value)
end end
end end
it 'marks nexenta_password as secret' do it 'marks nexenta_password as secret' do
should contain_cinder_config('DEFAULT/nexenta_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/nexenta_password').with_secret( true )
end end
end end

View File

@ -17,23 +17,23 @@ describe 'cinder::volume::nfs' do
describe 'nfs volume driver' do describe 'nfs volume driver' do
it 'configures nfs volume driver' do it 'configures nfs volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value( is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value(
'cinder.volume.drivers.nfs.NfsDriver') 'cinder.volume.drivers.nfs.NfsDriver')
should contain_cinder_config('DEFAULT/nfs_shares_config').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_shares_config').with_value(
'/etc/cinder/other_shares.conf') '/etc/cinder/other_shares.conf')
should contain_cinder_config('DEFAULT/nfs_mount_options').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_mount_options').with_value(
'vers=3') 'vers=3')
should contain_cinder_config('DEFAULT/nfs_sparsed_volumes').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_sparsed_volumes').with_value(
true) true)
should contain_cinder_config('DEFAULT/nfs_mount_point_base').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_mount_point_base').with_value(
'/cinder_mount_point') '/cinder_mount_point')
should contain_cinder_config('DEFAULT/nfs_disk_util').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_disk_util').with_value(
'du') 'du')
should contain_cinder_config('DEFAULT/nfs_used_ratio').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_used_ratio').with_value(
'0.95') '0.95')
should contain_cinder_config('DEFAULT/nfs_oversub_ratio').with_value( is_expected.to contain_cinder_config('DEFAULT/nfs_oversub_ratio').with_value(
'1.0') '1.0')
should contain_file('/etc/cinder/other_shares.conf').with( is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/shares\n10.10.10.10:/shares2", :content => "10.10.10.10:/shares\n10.10.10.10:/shares2",
:require => 'Package[cinder]', :require => 'Package[cinder]',
:notify => 'Service[cinder-volume]' :notify => 'Service[cinder-volume]'

View File

@ -13,7 +13,7 @@ describe 'cinder::volume::rbd' do
} }
end end
it { should contain_class('cinder::params') } it { is_expected.to contain_class('cinder::params') }
let :params do let :params do
req_params req_params
@ -25,17 +25,17 @@ describe 'cinder::volume::rbd' do
describe 'rbd volume driver' do describe 'rbd volume driver' do
it 'configure rbd volume driver' do it 'configure rbd volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.rbd.RBDDriver') is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.rbd.RBDDriver')
should contain_cinder_config('DEFAULT/rbd_ceph_conf').with_value(req_params[:rbd_ceph_conf]) is_expected.to contain_cinder_config('DEFAULT/rbd_ceph_conf').with_value(req_params[:rbd_ceph_conf])
should contain_cinder_config('DEFAULT/rbd_flatten_volume_from_snapshot').with_value(req_params[:rbd_flatten_volume_from_snapshot]) is_expected.to contain_cinder_config('DEFAULT/rbd_flatten_volume_from_snapshot').with_value(req_params[:rbd_flatten_volume_from_snapshot])
should contain_cinder_config('DEFAULT/volume_tmp_dir').with_value(req_params[:volume_tmp_dir]) is_expected.to contain_cinder_config('DEFAULT/volume_tmp_dir').with_value(req_params[:volume_tmp_dir])
should contain_cinder_config('DEFAULT/rbd_max_clone_depth').with_value(req_params[:rbd_max_clone_depth]) is_expected.to contain_cinder_config('DEFAULT/rbd_max_clone_depth').with_value(req_params[:rbd_max_clone_depth])
should contain_cinder_config('DEFAULT/rbd_pool').with_value(req_params[:rbd_pool]) is_expected.to contain_cinder_config('DEFAULT/rbd_pool').with_value(req_params[:rbd_pool])
should contain_cinder_config('DEFAULT/rbd_user').with_value(req_params[:rbd_user]) is_expected.to contain_cinder_config('DEFAULT/rbd_user').with_value(req_params[:rbd_user])
should contain_cinder_config('DEFAULT/rbd_secret_uuid').with_value(req_params[:rbd_secret_uuid]) is_expected.to contain_cinder_config('DEFAULT/rbd_secret_uuid').with_value(req_params[:rbd_secret_uuid])
should contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present') is_expected.to contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present')
should contain_file_line('set initscript env').with( is_expected.to contain_file_line('set initscript env').with(
:line => /env CEPH_ARGS=\"--id test\"/, :line => /env CEPH_ARGS=\"--id test\"/,
:path => '/etc/init/cinder-volume.override', :path => '/etc/init/cinder-volume.override',
:notify => 'Service[cinder-volume]') :notify => 'Service[cinder-volume]')
@ -43,12 +43,12 @@ describe 'cinder::volume::rbd' do
context 'with rbd_secret_uuid disabled' do context 'with rbd_secret_uuid disabled' do
let(:params) { req_params.merge!({:rbd_secret_uuid => false}) } let(:params) { req_params.merge!({:rbd_secret_uuid => false}) }
it { should contain_cinder_config('DEFAULT/rbd_secret_uuid').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/rbd_secret_uuid').with_ensure('absent') }
end end
context 'with volume_tmp_dir disabled' do context 'with volume_tmp_dir disabled' do
let(:params) { req_params.merge!({:volume_tmp_dir => false}) } let(:params) { req_params.merge!({:volume_tmp_dir => false}) }
it { should contain_cinder_config('DEFAULT/volume_tmp_dir').with_ensure('absent') } it { is_expected.to contain_cinder_config('DEFAULT/volume_tmp_dir').with_ensure('absent') }
end end
end end
@ -64,13 +64,13 @@ describe 'cinder::volume::rbd' do
end end
it 'should ensure that the cinder-volume sysconfig file is present' do it 'should ensure that the cinder-volume sysconfig file is present' do
should contain_file('/etc/sysconfig/openstack-cinder-volume').with( is_expected.to contain_file('/etc/sysconfig/openstack-cinder-volume').with(
:ensure => 'present' :ensure => 'present'
) )
end end
it 'should configure RedHat init override' do it 'should configure RedHat init override' do
should contain_file_line('set initscript env').with( is_expected.to contain_file_line('set initscript env').with(
:line => /export CEPH_ARGS=\"--id test\"/, :line => /export CEPH_ARGS=\"--id test\"/,
:path => '/etc/sysconfig/openstack-cinder-volume', :path => '/etc/sysconfig/openstack-cinder-volume',
:notify => 'Service[cinder-volume]') :notify => 'Service[cinder-volume]')

View File

@ -27,12 +27,12 @@ describe 'cinder::volume::san' do
it 'configures cinder volume driver' do it 'configures cinder volume driver' do
params_hash.each_pair do |config,value| params_hash.each_pair do |config,value|
should contain_cinder_config("DEFAULT/#{config}").with_value( value ) is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value( value )
end end
end end
it 'marks san_password as secret' do it 'marks san_password as secret' do
should contain_cinder_config('DEFAULT/san_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/san_password').with_secret( true )
end end
end end

View File

@ -15,14 +15,14 @@ describe 'cinder::volume::solidfire' do
describe 'solidfire volume driver' do describe 'solidfire volume driver' do
it 'configure solidfire volume driver' do it 'configure solidfire volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.solidfire.SolidFireDriver') is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.solidfire.SolidFireDriver')
should contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2') is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2')
should contain_cinder_config('DEFAULT/san_login').with_value('solidfire') is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('solidfire')
should contain_cinder_config('DEFAULT/san_password').with_value('password') is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password')
end end
it 'marks san_password as secret' do it 'marks san_password as secret' do
should contain_cinder_config('DEFAULT/san_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/san_password').with_secret( true )
end end
end end

View File

@ -10,8 +10,8 @@ describe 'cinder::volume' do
{:osfamily => 'Debian'} {:osfamily => 'Debian'}
end end
it { should contain_package('cinder-volume').with_ensure('present') } it { is_expected.to contain_package('cinder-volume').with_ensure('present') }
it { should contain_service('cinder-volume').with( it { is_expected.to contain_service('cinder-volume').with(
'hasstatus' => true 'hasstatus' => true
)} )}
@ -20,7 +20,7 @@ describe 'cinder::volume' do
{ 'manage_service' => false } { 'manage_service' => false }
end end
it 'should not change the state of the service' do it 'should not change the state of the service' do
should contain_service('cinder-volume').without_ensure is_expected.to contain_service('cinder-volume').without_ensure
end end
end end
end end

View File

@ -22,24 +22,24 @@ describe 'cinder::volume::vmdk' do
end end
it 'should configure vmdk driver in cinder.conf' do it 'should configure vmdk driver in cinder.conf' do
should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver') is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver')
should contain_cinder_config('DEFAULT/vmware_host_ip').with_value(params[:host_ip]) is_expected.to contain_cinder_config('DEFAULT/vmware_host_ip').with_value(params[:host_ip])
should contain_cinder_config('DEFAULT/vmware_host_username').with_value(params[:host_username]) is_expected.to contain_cinder_config('DEFAULT/vmware_host_username').with_value(params[:host_username])
should contain_cinder_config('DEFAULT/vmware_host_password').with_value(params[:host_password]) is_expected.to contain_cinder_config('DEFAULT/vmware_host_password').with_value(params[:host_password])
should contain_cinder_config('DEFAULT/vmware_volume_folder').with_value('cinder-volumes') is_expected.to contain_cinder_config('DEFAULT/vmware_volume_folder').with_value('cinder-volumes')
should contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(10) is_expected.to contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(10)
should contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(100) is_expected.to contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(100)
should contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(5) is_expected.to contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(5)
should contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(7200) is_expected.to contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(7200)
should_not contain_cinder_config('DEFAULT/vmware_wsdl_location') is_expected.to_not contain_cinder_config('DEFAULT/vmware_wsdl_location')
end end
it 'marks vmware_host_password as secret' do it 'marks vmware_host_password as secret' do
should contain_cinder_config('DEFAULT/vmware_host_password').with_secret( true ) is_expected.to contain_cinder_config('DEFAULT/vmware_host_password').with_secret( true )
end end
it 'installs vmdk python driver' do it 'installs vmdk python driver' do
should contain_package('python-suds').with( is_expected.to contain_package('python-suds').with(
:ensure => 'present' :ensure => 'present'
) )
end end
@ -50,12 +50,12 @@ describe 'cinder::volume::vmdk' do
end end
it 'should configure vmdk driver in cinder.conf' do it 'should configure vmdk driver in cinder.conf' do
should contain_cinder_config('DEFAULT/vmware_volume_folder').with_value(params[:volume_folder]) is_expected.to contain_cinder_config('DEFAULT/vmware_volume_folder').with_value(params[:volume_folder])
should contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(params[:api_retry_count]) is_expected.to contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(params[:api_retry_count])
should contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(params[:max_object_retrieval]) is_expected.to contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(params[:max_object_retrieval])
should contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(params[:task_poll_interval]) is_expected.to contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(params[:task_poll_interval])
should contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs]) is_expected.to contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs])
should contain_cinder_config('DEFAULT/vmware_wsdl_location').with_value(params[:wsdl_location]) is_expected.to contain_cinder_config('DEFAULT/vmware_wsdl_location').with_value(params[:wsdl_location])
end end
end end
end end

View File

@ -23,12 +23,12 @@ describe 'cinder::backend::emc_vnx' do
describe 'emc vnx volume driver' do describe 'emc vnx volume driver' do
it 'configure emc vnx volume driver' do it 'configure emc vnx volume driver' do
should contain_cinder_config('emc/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver') is_expected.to contain_cinder_config('emc/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver')
should contain_cinder_config('emc/san_ip').with_value('127.0.0.2') is_expected.to contain_cinder_config('emc/san_ip').with_value('127.0.0.2')
should contain_cinder_config('emc/san_login').with_value('emc') is_expected.to contain_cinder_config('emc/san_login').with_value('emc')
should contain_cinder_config('emc/san_password').with_value('password') is_expected.to contain_cinder_config('emc/san_password').with_value('password')
should contain_cinder_config('emc/iscsi_ip_address').with_value('127.0.0.3') is_expected.to contain_cinder_config('emc/iscsi_ip_address').with_value('127.0.0.3')
should contain_cinder_config('emc/storage_vnx_pool_name').with_value('emc-storage-pool') is_expected.to contain_cinder_config('emc/storage_vnx_pool_name').with_value('emc-storage-pool')
end end
end end
end end

View File

@ -24,11 +24,11 @@ describe 'cinder::backend::eqlx' do
describe 'eqlx volume driver' do describe 'eqlx volume driver' do
it 'configure eqlx volume driver' do it 'configure eqlx volume driver' do
should contain_cinder_config( is_expected.to contain_cinder_config(
"#{config_group_name}/volume_driver").with_value( "#{config_group_name}/volume_driver").with_value(
'cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver') 'cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver')
params.each_pair do |config,value| params.each_pair do |config,value|
should contain_cinder_config( is_expected.to contain_cinder_config(
"#{config_group_name}/#{config}").with_value(value) "#{config_group_name}/#{config}").with_value(value)
end end
end end

View File

@ -15,15 +15,15 @@ describe 'cinder::backend::glusterfs' do
end end
it 'configures glusterfs volume driver' do it 'configures glusterfs volume driver' do
should contain_cinder_config('mygluster/volume_driver').with_value( is_expected.to contain_cinder_config('mygluster/volume_driver').with_value(
'cinder.volume.drivers.glusterfs.GlusterfsDriver') 'cinder.volume.drivers.glusterfs.GlusterfsDriver')
should contain_cinder_config('mygluster/glusterfs_shares_config').with_value( is_expected.to contain_cinder_config('mygluster/glusterfs_shares_config').with_value(
'/etc/cinder/other_shares.conf') '/etc/cinder/other_shares.conf')
should contain_cinder_config('mygluster/glusterfs_sparsed_volumes').with_value( is_expected.to contain_cinder_config('mygluster/glusterfs_sparsed_volumes').with_value(
true) true)
should contain_cinder_config('mygluster/glusterfs_mount_point_base').with_value( is_expected.to contain_cinder_config('mygluster/glusterfs_mount_point_base').with_value(
'/cinder_mount_point') '/cinder_mount_point')
should contain_file('/etc/cinder/other_shares.conf').with( is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n", :content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n",
:require => 'Package[cinder]', :require => 'Package[cinder]',
:notify => 'Service[cinder-volume]' :notify => 'Service[cinder-volume]'
@ -36,9 +36,7 @@ describe 'cinder::backend::glusterfs' do
:glusterfs_disk_util => 'foo', :glusterfs_disk_util => 'foo',
}) })
end end
it 'should fails' do it_raises 'a Puppet::Error', /glusterfs_disk_util is removed in Icehouse./
expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./)
end
end end
end end

View File

@ -29,19 +29,19 @@ describe 'cinder::backend::iscsi' do
describe 'with default params' do describe 'with default params' do
it 'should configure iscsi driver' do it 'should configure iscsi driver' do
should contain_cinder_config('hippo/volume_backend_name').with( is_expected.to contain_cinder_config('hippo/volume_backend_name').with(
:value => 'hippo') :value => 'hippo')
should contain_cinder_config('hippo/volume_driver').with( is_expected.to contain_cinder_config('hippo/volume_driver').with(
:value => 'cinder.volume.drivers.lvm.LVMVolumeDriver') :value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')
should contain_cinder_config('hippo/iscsi_ip_address').with( is_expected.to contain_cinder_config('hippo/iscsi_ip_address').with(
:value => '127.0.0.2') :value => '127.0.0.2')
should contain_cinder_config('hippo/iscsi_helper').with( is_expected.to contain_cinder_config('hippo/iscsi_helper').with(
:value => 'tgtadm') :value => 'tgtadm')
should contain_cinder_config('hippo/volume_group').with( is_expected.to contain_cinder_config('hippo/volume_group').with(
:value => 'cinder-volumes') :value => 'cinder-volumes')
should contain_cinder_config('hippo/volumes_dir').with( is_expected.to contain_cinder_config('hippo/volumes_dir').with(
:value => '/var/lib/cinder/volumes') :value => '/var/lib/cinder/volumes')
should contain_cinder_config('hippo/iscsi_protocol').with( is_expected.to contain_cinder_config('hippo/iscsi_protocol').with(
:value => 'iscsi') :value => 'iscsi')
end end
end end
@ -52,7 +52,7 @@ describe 'cinder::backend::iscsi' do
end end
it 'should configure iscsi driver with iser protocol' do it 'should configure iscsi driver with iser protocol' do
should contain_cinder_config('hippo/iscsi_protocol').with( is_expected.to contain_cinder_config('hippo/iscsi_protocol').with(
:value => 'iser') :value => 'iser')
end end
end end
@ -63,7 +63,7 @@ describe 'cinder::backend::iscsi' do
end end
it 'should configure iscsi driver with /etc/cinder/volumes as volumes_dir' do it 'should configure iscsi driver with /etc/cinder/volumes as volumes_dir' do
should contain_cinder_config('hippo/volumes_dir').with( is_expected.to contain_cinder_config('hippo/volumes_dir').with(
:value => '/etc/cinder/volumes' :value => '/etc/cinder/volumes'
) )
end end
@ -75,7 +75,7 @@ describe 'cinder::backend::iscsi' do
{:osfamily => 'RedHat'} {:osfamily => 'RedHat'}
end end
it { should contain_file_line('cinder include').with( it { is_expected.to contain_file_line('cinder include').with(
:line => 'include /var/lib/cinder/volumes/*', :line => 'include /var/lib/cinder/volumes/*',
:path => '/etc/tgt/targets.conf' :path => '/etc/tgt/targets.conf'
) } ) }

View File

@ -41,19 +41,19 @@ describe 'cinder::backend::netapp' do
end end
it 'configures netapp volume driver' do it 'configures netapp volume driver' do
should contain_cinder_config("#{params_hash[:volume_backend_name]}/volume_driver").with_value( is_expected.to contain_cinder_config("#{params_hash[:volume_backend_name]}/volume_driver").with_value(
'cinder.volume.drivers.netapp.common.NetAppDriver') 'cinder.volume.drivers.netapp.common.NetAppDriver')
params_hash.each_pair do |config,value| params_hash.each_pair do |config,value|
should contain_cinder_config("#{params_hash[:volume_backend_name]}/#{config}").with_value( value ) is_expected.to contain_cinder_config("#{params_hash[:volume_backend_name]}/#{config}").with_value( value )
end end
end end
it 'marks netapp_password as secret' do it 'marks netapp_password as secret' do
should contain_cinder_config("#{params_hash[:volume_backend_name]}/netapp_password").with_secret( true ) is_expected.to contain_cinder_config("#{params_hash[:volume_backend_name]}/netapp_password").with_secret( true )
end end
it 'marks netapp_sa_password as secret' do it 'marks netapp_sa_password as secret' do
should contain_cinder_config("#{params_hash[:volume_backend_name]}/netapp_sa_password").with_secret( true ) is_expected.to contain_cinder_config("#{params_hash[:volume_backend_name]}/netapp_sa_password").with_secret( true )
end end
end end
@ -75,7 +75,7 @@ describe 'cinder::backend::netapp' do
:netapp_storage_family => 'eseries', :netapp_storage_family => 'eseries',
}) } }) }
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/use_multipath_for_image_xfer").with_value('true') } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/use_multipath_for_image_xfer").with_value('true') }
end end
context 'with NFS shares provided' do context 'with NFS shares provided' do
@ -85,7 +85,7 @@ describe 'cinder::backend::netapp' do
}) } }) }
it 'writes NFS shares to file' do it 'writes NFS shares to file' do
should contain_file("#{req_params[:nfs_shares_config]}") \ is_expected.to contain_file("#{req_params[:nfs_shares_config]}") \
.with_content("10.0.0.1:/test1\n10.0.0.2:/test2") .with_content("10.0.0.1:/test1\n10.0.0.2:/test2")
end end
end end
@ -98,9 +98,7 @@ describe 'cinder::backend::netapp' do
}) })
end end
it 'throw error' do it_raises 'a Puppet::Error', /"not an array" is not an Array. It looks to be a String/
expect {subject}.to raise_error(Puppet::Error, /"not an array" is not an Array. It looks to be a String/)
end
end end
end end

View File

@ -32,7 +32,7 @@ describe 'cinder::backend::nexenta' do
it 'configures nexenta volume driver' do it 'configures nexenta volume driver' do
params_hash.each_pair do |config, value| params_hash.each_pair do |config, value|
should contain_cinder_config("nexenta/#{config}").with_value(value) is_expected.to contain_cinder_config("nexenta/#{config}").with_value(value)
end end
end end
end end

View File

@ -20,25 +20,25 @@ describe 'cinder::backend::nfs' do
describe 'nfs volume driver' do describe 'nfs volume driver' do
it 'configures nfs volume driver' do it 'configures nfs volume driver' do
should contain_cinder_config('hippo/volume_backend_name').with( is_expected.to contain_cinder_config('hippo/volume_backend_name').with(
:value => 'hippo') :value => 'hippo')
should contain_cinder_config('hippo/volume_driver').with_value( is_expected.to contain_cinder_config('hippo/volume_driver').with_value(
'cinder.volume.drivers.nfs.NfsDriver') 'cinder.volume.drivers.nfs.NfsDriver')
should contain_cinder_config('hippo/nfs_shares_config').with_value( is_expected.to contain_cinder_config('hippo/nfs_shares_config').with_value(
'/etc/cinder/other_shares.conf') '/etc/cinder/other_shares.conf')
should contain_cinder_config('hippo/nfs_mount_options').with_value( is_expected.to contain_cinder_config('hippo/nfs_mount_options').with_value(
'vers=3') 'vers=3')
should contain_cinder_config('hippo/nfs_sparsed_volumes').with_value( is_expected.to contain_cinder_config('hippo/nfs_sparsed_volumes').with_value(
true) true)
should contain_cinder_config('hippo/nfs_mount_point_base').with_value( is_expected.to contain_cinder_config('hippo/nfs_mount_point_base').with_value(
'/cinder_mount_point') '/cinder_mount_point')
should contain_cinder_config('hippo/nfs_disk_util').with_value( is_expected.to contain_cinder_config('hippo/nfs_disk_util').with_value(
'du') 'du')
should contain_cinder_config('hippo/nfs_used_ratio').with_value( is_expected.to contain_cinder_config('hippo/nfs_used_ratio').with_value(
'0.7') '0.7')
should contain_cinder_config('hippo/nfs_oversub_ratio').with_value( is_expected.to contain_cinder_config('hippo/nfs_oversub_ratio').with_value(
'0.9') '0.9')
should contain_file('/etc/cinder/other_shares.conf').with( is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/shares\n10.10.10.10:/shares2", :content => "10.10.10.10:/shares\n10.10.10.10:/shares2",
:require => 'Package[cinder]', :require => 'Package[cinder]',
:notify => 'Service[cinder-volume]' :notify => 'Service[cinder-volume]'

View File

@ -17,7 +17,7 @@ describe 'cinder::backend::rbd' do
} }
end end
it { should contain_class('cinder::params') } it { is_expected.to contain_class('cinder::params') }
let :params do let :params do
req_params req_params
@ -29,17 +29,17 @@ describe 'cinder::backend::rbd' do
describe 'rbd backend volume driver' do describe 'rbd backend volume driver' do
it 'configure rbd volume driver' do it 'configure rbd volume driver' do
should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_backend_name").with_value(req_params[:volume_backend_name]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_backend_name").with_value(req_params[:volume_backend_name])
should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver')
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_ceph_conf").with_value(req_params[:rbd_ceph_conf]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_ceph_conf").with_value(req_params[:rbd_ceph_conf])
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_flatten_volume_from_snapshot").with_value(req_params[:rbd_flatten_volume_from_snapshot]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_flatten_volume_from_snapshot").with_value(req_params[:rbd_flatten_volume_from_snapshot])
should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_value(req_params[:volume_tmp_dir]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_value(req_params[:volume_tmp_dir])
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_max_clone_depth").with_value(req_params[:rbd_max_clone_depth]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_max_clone_depth").with_value(req_params[:rbd_max_clone_depth])
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool])
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user])
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_value(req_params[:rbd_secret_uuid]) is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_value(req_params[:rbd_secret_uuid])
should contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present') is_expected.to contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present')
should contain_file_line('set initscript env').with( is_expected.to contain_file_line('set initscript env').with(
:line => /env CEPH_ARGS=\"--id test\"/, :line => /env CEPH_ARGS=\"--id test\"/,
:path => '/etc/init/cinder-volume.override', :path => '/etc/init/cinder-volume.override',
:notify => 'Service[cinder-volume]') :notify => 'Service[cinder-volume]')
@ -47,12 +47,12 @@ describe 'cinder::backend::rbd' do
context 'with rbd_secret_uuid disabled' do context 'with rbd_secret_uuid disabled' do
let(:params) { req_params.merge!({:rbd_secret_uuid => false}) } let(:params) { req_params.merge!({:rbd_secret_uuid => false}) }
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_ensure('absent') } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_ensure('absent') }
end end
context 'with volume_tmp_dir disabled' do context 'with volume_tmp_dir disabled' do
let(:params) { req_params.merge!({:volume_tmp_dir => false}) } let(:params) { req_params.merge!({:volume_tmp_dir => false}) }
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_ensure('absent') } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_ensure('absent') }
end end
context 'with another RBD backend' do context 'with another RBD backend' do
@ -62,12 +62,12 @@ describe 'cinder::backend::rbd' do
rbd_user => 'test' rbd_user => 'test'
}" }"
end end
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') }
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool]) } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool]) }
it { should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) }
it { should contain_cinder_config("ceph2/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') } it { is_expected.to contain_cinder_config("ceph2/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') }
it { should contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') } it { is_expected.to contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') }
it { should contain_cinder_config("ceph2/rbd_user").with_value('test') } it { is_expected.to contain_cinder_config("ceph2/rbd_user").with_value('test') }
end end
end end
@ -81,13 +81,13 @@ describe 'cinder::backend::rbd' do
end end
it 'should ensure that the cinder-volume sysconfig file is present' do it 'should ensure that the cinder-volume sysconfig file is present' do
should contain_file('/etc/sysconfig/openstack-cinder-volume').with( is_expected.to contain_file('/etc/sysconfig/openstack-cinder-volume').with(
:ensure => 'present' :ensure => 'present'
) )
end end
it 'should configure RedHat init override' do it 'should configure RedHat init override' do
should contain_file_line('set initscript env').with( is_expected.to contain_file_line('set initscript env').with(
:line => /export CEPH_ARGS=\"--id test\"/, :line => /export CEPH_ARGS=\"--id test\"/,
:path => '/etc/sysconfig/openstack-cinder-volume', :path => '/etc/sysconfig/openstack-cinder-volume',
:notify => 'Service[cinder-volume]') :notify => 'Service[cinder-volume]')

View File

@ -28,7 +28,7 @@ describe 'cinder::backend::san' do
it 'configures cinder volume driver' do it 'configures cinder volume driver' do
params_hash.each_pair do |config,value| params_hash.each_pair do |config,value|
should contain_cinder_config("mysan/#{config}").with_value( value ) is_expected.to contain_cinder_config("mysan/#{config}").with_value( value )
end end
end end
end end

View File

@ -17,13 +17,13 @@ describe 'cinder::backend::solidfire' do
describe 'solidfire volume driver' do describe 'solidfire volume driver' do
it 'configure solidfire volume driver' do it 'configure solidfire volume driver' do
should contain_cinder_config('solidfire/volume_driver').with_value( is_expected.to contain_cinder_config('solidfire/volume_driver').with_value(
'cinder.volume.drivers.solidfire.SolidFireDriver') 'cinder.volume.drivers.solidfire.SolidFireDriver')
should contain_cinder_config('solidfire/san_ip').with_value( is_expected.to contain_cinder_config('solidfire/san_ip').with_value(
'127.0.0.2') '127.0.0.2')
should contain_cinder_config('solidfire/san_login').with_value( is_expected.to contain_cinder_config('solidfire/san_login').with_value(
'solidfire') 'solidfire')
should contain_cinder_config('solidfire/san_password').with_value( is_expected.to contain_cinder_config('solidfire/san_password').with_value(
'password') 'password')
end end
end end

View File

@ -24,21 +24,21 @@ describe 'cinder::backend::vmdk' do
end end
it 'should configure vmdk driver in cinder.conf' do it 'should configure vmdk driver in cinder.conf' do
should contain_cinder_config('hippo/volume_backend_name').with_value('hippo') is_expected.to contain_cinder_config('hippo/volume_backend_name').with_value('hippo')
should contain_cinder_config('hippo/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver') is_expected.to contain_cinder_config('hippo/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver')
should contain_cinder_config('hippo/vmware_host_ip').with_value(params[:host_ip]) is_expected.to contain_cinder_config('hippo/vmware_host_ip').with_value(params[:host_ip])
should contain_cinder_config('hippo/vmware_host_username').with_value(params[:host_username]) is_expected.to contain_cinder_config('hippo/vmware_host_username').with_value(params[:host_username])
should contain_cinder_config('hippo/vmware_host_password').with_value(params[:host_password]) is_expected.to contain_cinder_config('hippo/vmware_host_password').with_value(params[:host_password])
should contain_cinder_config('hippo/vmware_volume_folder').with_value('cinder-volumes') is_expected.to contain_cinder_config('hippo/vmware_volume_folder').with_value('cinder-volumes')
should contain_cinder_config('hippo/vmware_api_retry_count').with_value(10) is_expected.to contain_cinder_config('hippo/vmware_api_retry_count').with_value(10)
should contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(100) is_expected.to contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(100)
should contain_cinder_config('hippo/vmware_task_poll_interval').with_value(5) is_expected.to contain_cinder_config('hippo/vmware_task_poll_interval').with_value(5)
should contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(7200) is_expected.to contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(7200)
should_not contain_cinder_config('hippo/vmware_wsdl_location') is_expected.to_not contain_cinder_config('hippo/vmware_wsdl_location')
end end
it 'installs suds python package' do it 'installs suds python package' do
should contain_package('python-suds').with( is_expected.to contain_package('python-suds').with(
:ensure => 'present') :ensure => 'present')
end end
@ -48,12 +48,12 @@ describe 'cinder::backend::vmdk' do
end end
it 'should configure vmdk driver in cinder.conf' do it 'should configure vmdk driver in cinder.conf' do
should contain_cinder_config('hippo/vmware_volume_folder').with_value(params[:volume_folder]) is_expected.to contain_cinder_config('hippo/vmware_volume_folder').with_value(params[:volume_folder])
should contain_cinder_config('hippo/vmware_api_retry_count').with_value(params[:api_retry_count]) is_expected.to contain_cinder_config('hippo/vmware_api_retry_count').with_value(params[:api_retry_count])
should contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(params[:max_object_retrieval]) is_expected.to contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(params[:max_object_retrieval])
should contain_cinder_config('hippo/vmware_task_poll_interval').with_value(params[:task_poll_interval]) is_expected.to contain_cinder_config('hippo/vmware_task_poll_interval').with_value(params[:task_poll_interval])
should contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs]) is_expected.to contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs])
should contain_cinder_config('hippo/vmware_wsdl_location').with_value(params[:wsdl_location]) is_expected.to contain_cinder_config('hippo/vmware_wsdl_location').with_value(params[:wsdl_location])
end end
end end
end end

View File

@ -17,7 +17,7 @@ describe 'cinder::type_set' do
end end
it 'should have its execs' do it 'should have its execs' do
should contain_exec('cinder type-key sith set monchichi=hippo').with( is_expected.to contain_exec('cinder type-key sith set monchichi=hippo').with(
:command => 'cinder type-key sith set monchichi=hippo', :command => 'cinder type-key sith set monchichi=hippo',
:unless => "cinder extra-specs-list | grep -Eq '\\bsith\\b.*\\bmonchichi\\b.*\\bhippo\\b'", :unless => "cinder extra-specs-list | grep -Eq '\\bsith\\b.*\\bmonchichi\\b.*\\bhippo\\b'",
:environment => [ :environment => [

View File

@ -17,7 +17,7 @@ describe 'cinder::type' do
end end
it 'should have its execs' do it 'should have its execs' do
should contain_exec('cinder type-create hippo').with( is_expected.to contain_exec('cinder type-create hippo').with(
:command => 'cinder type-create hippo', :command => 'cinder type-create hippo',
:environment => [ :environment => [
'OS_TENANT_NAME=admin', 'OS_TENANT_NAME=admin',
@ -26,7 +26,7 @@ describe 'cinder::type' do
'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/'], 'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/'],
:unless => "cinder type-list | grep -qP '\\bhippo\\b'", :unless => "cinder type-list | grep -qP '\\bhippo\\b'",
:require => 'Package[python-cinderclient]') :require => 'Package[python-cinderclient]')
should contain_exec('cinder type-key hippo set volume_backend_name=name1') is_expected.to contain_exec('cinder type-key hippo set volume_backend_name=name1')
should contain_exec('cinder type-key hippo set volume_backend_name=name2') is_expected.to contain_exec('cinder type-key hippo set volume_backend_name=name2')
end end
end end

View File

@ -1,5 +1,5 @@
shared_examples_for "a Puppet::Error" do |description| shared_examples_for "a Puppet::Error" do |description|
it "with message matching #{description.inspect}" do it "with message matching #{description.inspect}" do
expect { should have_class_count(1) }.to raise_error(Puppet::Error, description) expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
end end
end end