From 4224fdd12e63688a808d411208d24085c504bef0 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Sun, 22 Feb 2015 22:29:32 +0100 Subject: [PATCH] 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 --- Gemfile | 3 +- spec/classes/cinder_api_spec.rb | 64 ++--- spec/classes/cinder_backends_spec.rb | 6 +- spec/classes/cinder_backup_ceph_spec.rb | 26 +- spec/classes/cinder_backup_spec.rb | 20 +- spec/classes/cinder_backup_swift_spec.rb | 22 +- spec/classes/cinder_ceilometer_spec.rb | 2 +- spec/classes/cinder_client_spec.rb | 4 +- spec/classes/cinder_db_mysql_spec.rb | 2 +- spec/classes/cinder_db_postgresql_spec.rb | 4 +- spec/classes/cinder_db_sync_spec.rb | 2 +- spec/classes/cinder_glance_spec.rb | 10 +- spec/classes/cinder_keystone_auth_spec.rb | 38 +-- spec/classes/cinder_logging_spec.rb | 24 +- spec/classes/cinder_policy_spec.rb | 2 +- spec/classes/cinder_qpid_spec.rb | 8 +- spec/classes/cinder_quota_spec.rb | 16 +- spec/classes/cinder_rabbitmq_spec.rb | 18 +- spec/classes/cinder_scheduler_spec.rb | 18 +- spec/classes/cinder_setup_test_volume_spec.rb | 12 +- spec/classes/cinder_spec.rb | 232 +++++++----------- spec/classes/cinder_vmware_spec.rb | 10 +- spec/classes/cinder_volume_emc_vnx_spec.rb | 12 +- spec/classes/cinder_volume_eqlx_spec.rb | 8 +- spec/classes/cinder_volume_glusterfs_spec.rb | 18 +- spec/classes/cinder_volume_iscsi_spec.rb | 26 +- spec/classes/cinder_volume_netapp_spec.rb | 10 +- spec/classes/cinder_volume_nexenta_spec.rb | 4 +- spec/classes/cinder_volume_nfs_spec.rb | 18 +- spec/classes/cinder_volume_rbd_spec.rb | 30 +-- spec/classes/cinder_volume_san_spec.rb | 4 +- spec/classes/cinder_volume_solidfire_spec.rb | 10 +- spec/classes/cinder_volume_spec.rb | 6 +- spec/classes/cinder_volume_vmdk_spec.rb | 36 +-- spec/defines/cinder_backend_emc_vnx_spec.rb | 12 +- spec/defines/cinder_backend_eqlx_spec.rb | 4 +- spec/defines/cinder_backend_glusterfs_spec.rb | 14 +- spec/defines/cinder_backend_iscsi_spec.rb | 20 +- spec/defines/cinder_backend_netapp_spec.rb | 16 +- spec/defines/cinder_backend_nexenta_spec.rb | 2 +- spec/defines/cinder_backend_nfs_spec.rb | 20 +- spec/defines/cinder_backend_rbd_spec.rb | 44 ++-- spec/defines/cinder_backend_san_spec.rb | 2 +- spec/defines/cinder_backend_solidfire_spec.rb | 8 +- spec/defines/cinder_backend_vmdk_spec.rb | 36 +-- spec/defines/cinder_type_set_spec.rb | 2 +- spec/defines/cinder_type_spec.rb | 6 +- spec/shared_examples.rb | 2 +- 48 files changed, 418 insertions(+), 495 deletions(-) diff --git a/Gemfile b/Gemfile index 4349e6e7..f3473cf0 100644 --- a/Gemfile +++ b/Gemfile @@ -14,9 +14,8 @@ group :development, :test do gem 'puppet-lint-variable_contains_upcase' gem 'puppet-lint-numericvariable' - gem 'rspec-puppet', '~> 1.0.1' + gem 'rspec-puppet', '~> 2.0.0', :require => false gem 'rake', '10.1.1' - gem 'rspec', '< 2.99' gem 'json' gem 'webmock' end diff --git a/spec/classes/cinder_api_spec.rb b/spec/classes/cinder_api_spec.rb index 546c87a8..23431696 100644 --- a/spec/classes/cinder_api_spec.rb +++ b/spec/classes/cinder_api_spec.rb @@ -15,64 +15,64 @@ describe 'cinder::api' do req_params end - it { should contain_service('cinder-api').with( + it { is_expected.to contain_service('cinder-api').with( 'hasstatus' => true, 'ensure' => 'running' )} 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' ) - 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' ) - should contain_cinder_config('DEFAULT/osapi_volume_workers').with( + is_expected.to contain_cinder_config('DEFAULT/osapi_volume_workers').with( :value => '8' ) - should contain_cinder_config('DEFAULT/default_volume_type').with( + is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with( :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' ) - 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' ) - 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' ) - 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' ) - 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' ) - 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' ) - 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' ) - 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' ) - 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' ) - 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' ) - 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', :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/' ) - should_not contain_cinder_config('DEFAULT/os_region_name') + is_expected.to_not contain_cinder_config('DEFAULT/os_region_name') end end @@ -82,7 +82,7 @@ describe 'cinder::api' do req_params.merge({'os_region_name' => 'MyRegion'}) end 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' ) end @@ -93,7 +93,7 @@ describe 'cinder::api' do req_params.merge({'default_volume_type' => 'foo'}) end 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' ) end @@ -104,7 +104,7 @@ describe 'cinder::api' do req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'}) end 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/' ) end @@ -115,7 +115,7 @@ describe 'cinder::api' do req_params.merge({'bind_host' => '192.168.1.3'}) end 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' ) end @@ -130,7 +130,7 @@ describe 'cinder::api' do } 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}" )} end @@ -152,7 +152,7 @@ describe 'cinder::api' do } 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/) } end end @@ -162,10 +162,10 @@ describe 'cinder::api' do req_params.merge({'enabled' => false}) end 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 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 @@ -174,7 +174,7 @@ describe 'cinder::api' do req_params.merge({'manage_service' => false}) end 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 @@ -183,7 +183,7 @@ describe 'cinder::api' do req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' }) 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)' )} end @@ -194,7 +194,7 @@ describe 'cinder::api' do :validate => true, }) 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', :provider => 'shell', :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', )} - 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]', )} end @@ -214,7 +214,7 @@ describe 'cinder::api' do :validation_options => { 'cinder-api' => { 'command' => 'my-script' } } }) 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', :provider => 'shell', :tries => '10', @@ -222,7 +222,7 @@ describe 'cinder::api' do :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]', )} end diff --git a/spec/classes/cinder_backends_spec.rb b/spec/classes/cinder_backends_spec.rb index de990d02..a029ee1e 100644 --- a/spec/classes/cinder_backends_spec.rb +++ b/spec/classes/cinder_backends_spec.rb @@ -45,7 +45,7 @@ describe 'cinder::backends' do end 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 @@ -57,9 +57,7 @@ describe 'cinder::backends' do ) end - it 'should fail to configure default volume type' do - 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 + it_raises 'a Puppet::Error', /The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api./ end end diff --git a/spec/classes/cinder_backup_ceph_spec.rb b/spec/classes/cinder_backup_ceph_spec.rb index 8c3a5521..90bd4f60 100644 --- a/spec/classes/cinder_backup_ceph_spec.rb +++ b/spec/classes/cinder_backup_ceph_spec.rb @@ -41,13 +41,13 @@ describe 'cinder::backup::ceph' do end it 'configures cinder.conf' do - should 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]) - should 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]) - should 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]) - should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count]) + is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.ceph') + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf]) + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user]) + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size]) + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool]) + is_expected.to 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_count').with_value(p[:backup_ceph_stripe_count]) end context 'when overriding default parameters' do @@ -60,12 +60,12 @@ describe 'cinder::backup::ceph' do params.merge!(:backup_ceph_stripe_count => '67') end it 'should replace default parameters with new values' do - should 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]) - should 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]) - should 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_conf').with_value(p[:backup_ceph_conf]) + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user]) + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size]) + is_expected.to contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool]) + is_expected.to 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_count').with_value(p[:backup_ceph_stripe_count]) end end end diff --git a/spec/classes/cinder_backup_spec.rb b/spec/classes/cinder_backup_spec.rb index 0f632ccb..58411809 100644 --- a/spec/classes/cinder_backup_spec.rb +++ b/spec/classes/cinder_backup_spec.rb @@ -39,28 +39,28 @@ describe 'cinder::backup' do default_params.merge(params) end - it { should contain_class('cinder::params') } + it { is_expected.to contain_class('cinder::params') } it 'installs cinder backup package' do 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], :ensure => 'present' ) - should 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(/Cinder_config\[.+\]/) + is_expected.to contain_package('cinder-backup').with_before(/Service\[cinder-backup\]/) end end 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 it 'configures cinder.conf' do - should contain_cinder_config('DEFAULT/backup_topic').with_value(p[:backup_topic]) - should 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]) - should contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template]) + is_expected.to contain_cinder_config('DEFAULT/backup_topic').with_value(p[:backup_topic]) + is_expected.to contain_cinder_config('DEFAULT/backup_manager').with_value(p[:backup_manager]) + is_expected.to contain_cinder_config('DEFAULT/backup_api_class').with_value(p[:backup_api_class]) + is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template]) end context 'when overriding backup_name_template' do @@ -68,7 +68,7 @@ describe 'cinder::backup' do params.merge!(:backup_name_template => 'foo-bar-%s') end 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 diff --git a/spec/classes/cinder_backup_swift_spec.rb b/spec/classes/cinder_backup_swift_spec.rb index dae1bd61..65c1789b 100644 --- a/spec/classes/cinder_backup_swift_spec.rb +++ b/spec/classes/cinder_backup_swift_spec.rb @@ -40,12 +40,12 @@ describe 'cinder::backup::swift' do end it 'configures cinder.conf' do - should 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]) - should 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]) - should 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_driver').with_value('cinder.backup.drivers.swift') + is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url]) + is_expected.to contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container]) + is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size]) + is_expected.to 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_backoff').with_value(p[:backup_swift_retry_backoff]) end context 'when overriding default parameters' do @@ -57,11 +57,11 @@ describe 'cinder::backup::swift' do params.merge!(:backup_swift_retry_backoff => '56') end it 'should replace default parameters with new values' do - should 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]) - should 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]) - 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_url').with_value(p[:backup_swift_url]) + is_expected.to contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container]) + is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size]) + is_expected.to 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_backoff').with_value(p[:backup_swift_retry_backoff]) end end end diff --git a/spec/classes/cinder_ceilometer_spec.rb b/spec/classes/cinder_ceilometer_spec.rb index e1b52a10..fdb9b49e 100644 --- a/spec/classes/cinder_ceilometer_spec.rb +++ b/spec/classes/cinder_ceilometer_spec.rb @@ -4,7 +4,7 @@ describe 'cinder::ceilometer' do describe 'with default parameters' 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') end end diff --git a/spec/classes/cinder_client_spec.rb b/spec/classes/cinder_client_spec.rb index 77b51ced..12820a95 100644 --- a/spec/classes/cinder_client_spec.rb +++ b/spec/classes/cinder_client_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' 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 {:osfamily => 'Debian'} end @@ -9,6 +9,6 @@ describe 'cinder::client' do let :params do {:package_ensure => 'latest'} end - it { should contain_package('python-cinderclient').with_ensure('latest') } + it { is_expected.to contain_package('python-cinderclient').with_ensure('latest') } end end diff --git a/spec/classes/cinder_db_mysql_spec.rb b/spec/classes/cinder_db_mysql_spec.rb index b5faa1db..86ebb442 100644 --- a/spec/classes/cinder_db_mysql_spec.rb +++ b/spec/classes/cinder_db_mysql_spec.rb @@ -19,7 +19,7 @@ describe 'cinder::db::mysql' do let :params do req_params end - it { should contain_openstacklib__db__mysql('cinder').with( + it { is_expected.to contain_openstacklib__db__mysql('cinder').with( :user => 'cinder', :password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122', :host => '127.0.0.1', diff --git a/spec/classes/cinder_db_postgresql_spec.rb b/spec/classes/cinder_db_postgresql_spec.rb index c56d1cdc..a949f659 100644 --- a/spec/classes/cinder_db_postgresql_spec.rb +++ b/spec/classes/cinder_db_postgresql_spec.rb @@ -24,7 +24,7 @@ describe 'cinder::db::postgresql' do req_params end - it { should contain_postgresql__server__db('cinder').with( + it { is_expected.to contain_postgresql__server__db('cinder').with( :user => 'cinder', :password => 'md506736c3030793e09882cc536063d433f' )} @@ -47,7 +47,7 @@ describe 'cinder::db::postgresql' do req_params end - it { should contain_postgresql__server__db('cinder').with( + it { is_expected.to contain_postgresql__server__db('cinder').with( :user => 'cinder', :password => 'md506736c3030793e09882cc536063d433f' )} diff --git a/spec/classes/cinder_db_sync_spec.rb b/spec/classes/cinder_db_sync_spec.rb index 906d4391..f45350f1 100644 --- a/spec/classes/cinder_db_sync_spec.rb +++ b/spec/classes/cinder_db_sync_spec.rb @@ -5,7 +5,7 @@ describe 'cinder::db::sync' do let :facts do {:osfamily => 'Debian'} 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', :path => '/usr/bin', :user => 'cinder', diff --git a/spec/classes/cinder_glance_spec.rb b/spec/classes/cinder_glance_spec.rb index 64bf89a5..b915504e 100644 --- a/spec/classes/cinder_glance_spec.rb +++ b/spec/classes/cinder_glance_spec.rb @@ -39,9 +39,9 @@ describe 'cinder::glance' do end it 'configures cinder.conf with default params' do - should 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]) - should contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure]) + is_expected.to contain_cinder_config('DEFAULT/glance_api_version').with_value(p[:glance_api_version]) + is_expected.to contain_cinder_config('DEFAULT/glance_num_retries').with_value(p[:glance_num_retries]) + is_expected.to contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure]) end 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') end 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 @@ -58,7 +58,7 @@ describe 'cinder::glance' do params.merge!(:glance_api_servers => ['10.0.0.1:9292','10.0.0.2:9292']) end 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 diff --git a/spec/classes/cinder_keystone_auth_spec.rb b/spec/classes/cinder_keystone_auth_spec.rb index b506a2cb..7fda4981 100644 --- a/spec/classes/cinder_keystone_auth_spec.rb +++ b/spec/classes/cinder_keystone_auth_spec.rb @@ -14,35 +14,35 @@ describe 'cinder::keystone::auth' do it 'should contain auth info' do - should contain_keystone_user('cinder').with( + is_expected.to contain_keystone_user('cinder').with( :ensure => 'present', :password => 'pw', :email => 'cinder@localhost', :tenant => 'services' ) - should contain_keystone_user_role('cinder@services').with( + is_expected.to contain_keystone_user_role('cinder@services').with( :ensure => 'present', :roles => 'admin' ) - should contain_keystone_service('cinder').with( + is_expected.to contain_keystone_service('cinder').with( :ensure => 'present', :type => 'volume', :description => 'Cinder Service' ) - should contain_keystone_service('cinderv2').with( + is_expected.to contain_keystone_service('cinderv2').with( :ensure => 'present', :type => 'volumev2', :description => 'Cinder Service v2' ) end - it { should contain_keystone_endpoint('RegionOne/cinder').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/cinder').with( :ensure => 'present', :public_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' ) } - it { should contain_keystone_endpoint('RegionOne/cinderv2').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/cinderv2').with( :ensure => 'present', :public_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 - it { should contain_keystone_endpoint('RegionThree/cinder').with( + it { is_expected.to contain_keystone_endpoint('RegionThree/cinder').with( :ensure => 'present', :public_url => 'https://10.0.42.1: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' )} - it { should contain_keystone_endpoint('RegionThree/cinderv2').with( + it { is_expected.to contain_keystone_endpoint('RegionThree/cinderv2').with( :ensure => 'present', :public_url => 'https://10.0.42.1: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 - describe 'when endpoint should not be configured' do + describe 'when endpoint is_expected.to not be configured' do let :params do req_params.merge( :configure_endpoint => false, :configure_endpoint_v2 => false ) end - it { should_not contain_keystone_endpoint('RegionOne/cinder') } - it { should_not contain_keystone_endpoint('RegionOne/cinderv2') } + it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinder') } + it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinderv2') } end - describe 'when user should not be configured' do + describe 'when user is_expected.to not be configured' do let :params do req_params.merge( :configure_user => false ) 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', :type => 'volume', :description => 'Cinder Service' @@ -112,7 +112,7 @@ describe 'cinder::keystone::auth' do 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 req_params.merge( :configure_user => false, @@ -120,11 +120,11 @@ describe 'cinder::keystone::auth' do ) 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', :type => 'volume', :description => 'Cinder Service' diff --git a/spec/classes/cinder_logging_spec.rb b/spec/classes/cinder_logging_spec.rb index ca967e7c..3e0adbf4 100644 --- a/spec/classes/cinder_logging_spec.rb +++ b/spec/classes/cinder_logging_spec.rb @@ -42,36 +42,36 @@ describe 'cinder::logging' do shared_examples_for 'logging params set' 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') - 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') - 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') - 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') - 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') - should contain_cinder_config('DEFAULT/publish_errors').with_value( + is_expected.to contain_cinder_config('DEFAULT/publish_errors').with_value( 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') - should contain_cinder_config('DEFAULT/fatal_deprecations').with_value( + is_expected.to contain_cinder_config('DEFAULT/fatal_deprecations').with_value( true) - should contain_cinder_config('DEFAULT/instance_format').with_value( + is_expected.to contain_cinder_config('DEFAULT/instance_format').with_value( '[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] ') - 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') end end @@ -84,7 +84,7 @@ describe 'cinder::logging' do :default_log_levels, :fatal_deprecations, :instance_format, :instance_uuid_format, :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 diff --git a/spec/classes/cinder_policy_spec.rb b/spec/classes/cinder_policy_spec.rb index e9b6d46d..7e500021 100644 --- a/spec/classes/cinder_policy_spec.rb +++ b/spec/classes/cinder_policy_spec.rb @@ -16,7 +16,7 @@ describe 'cinder::policy' do end 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', :value => 'foo:bar' }) diff --git a/spec/classes/cinder_qpid_spec.rb b/spec/classes/cinder_qpid_spec.rb index 0ace3209..59dae101 100644 --- a/spec/classes/cinder_qpid_spec.rb +++ b/spec/classes/cinder_qpid_spec.rb @@ -11,7 +11,7 @@ describe 'cinder::qpid' 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', :port => '5672' ) @@ -20,7 +20,7 @@ describe 'cinder::qpid' do it 'should contain user' do - should contain_qpid_user('guest').with( + is_expected.to contain_qpid_user('guest').with( :password => 'guest', :file => '/var/lib/qpidd/qpidd.sasldb', :realm => 'OPENSTACK', @@ -40,8 +40,8 @@ describe 'cinder::qpid' do it 'should be disabled' do - should_not contain_qpid_user('guest') - should contain_class('qpid::server').with( + is_expected.to_not contain_qpid_user('guest') + is_expected.to contain_class('qpid::server').with( :service_ensure => 'stopped' ) diff --git a/spec/classes/cinder_quota_spec.rb b/spec/classes/cinder_quota_spec.rb index ecbc2d97..54d34287 100644 --- a/spec/classes/cinder_quota_spec.rb +++ b/spec/classes/cinder_quota_spec.rb @@ -4,13 +4,13 @@ describe 'cinder::quota' do describe 'with default parameters' 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) - should contain_cinder_config('DEFAULT/quota_snapshots').with( + is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with( :value => 10) - should contain_cinder_config('DEFAULT/quota_gigabytes').with( + is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with( :value => 1000) - should contain_cinder_config('DEFAULT/quota_driver').with( + is_expected.to contain_cinder_config('DEFAULT/quota_driver').with( :value => 'cinder.quota.DbQuotaDriver') end end @@ -22,13 +22,13 @@ describe 'cinder::quota' do :quota_gigabytes => 100000 } end 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) - should contain_cinder_config('DEFAULT/quota_snapshots').with( + is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with( :value => 1000) - should contain_cinder_config('DEFAULT/quota_gigabytes').with( + is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with( :value => 100000) - should contain_cinder_config('DEFAULT/quota_driver').with( + is_expected.to contain_cinder_config('DEFAULT/quota_driver').with( :value => 'cinder.quota.DbQuotaDriver') end end diff --git a/spec/classes/cinder_rabbitmq_spec.rb b/spec/classes/cinder_rabbitmq_spec.rb index e38de3b7..d3cc5d6c 100644 --- a/spec/classes/cinder_rabbitmq_spec.rb +++ b/spec/classes/cinder_rabbitmq_spec.rb @@ -12,13 +12,13 @@ describe 'cinder::rabbitmq' 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', :port => '5672', :delete_guest_user => false ) - should contain_rabbitmq_vhost('/').with( + is_expected.to contain_rabbitmq_vhost('/').with( :provider => 'rabbitmqctl' ) end @@ -36,13 +36,13 @@ describe 'cinder::rabbitmq' do it 'should contain user and permissions' do - should contain_rabbitmq_user('dan').with( + is_expected.to contain_rabbitmq_user('dan').with( :admin => true, :password => 'pass', :provider => 'rabbitmqctl' ) - should contain_rabbitmq_user_permissions('dan@/').with( + is_expected.to contain_rabbitmq_user_permissions('dan@/').with( :configure_permission => '.*', :write_permission => '.*', :read_permission => '.*', @@ -64,15 +64,15 @@ describe 'cinder::rabbitmq' do it 'should be disabled' do - should_not contain_rabbitmq_user('dan') - should_not contain_rabbitmq_user_permissions('dan@/') - should contain_class('rabbitmq::server').with( + is_expected.to_not contain_rabbitmq_user('dan') + is_expected.to_not contain_rabbitmq_user_permissions('dan@/') + is_expected.to contain_class('rabbitmq::server').with( :service_ensure => 'stopped', :port => '5672', :delete_guest_user => false ) - should_not contain_rabbitmq_vhost('/') + is_expected.to_not contain_rabbitmq_vhost('/') end end @@ -86,7 +86,7 @@ describe 'cinder::rabbitmq' do end it 'should not contain rabbitmq class calls' do - should_not contain_class('rabbitmq::server') + is_expected.to_not contain_class('rabbitmq::server') end end diff --git a/spec/classes/cinder_scheduler_spec.rb b/spec/classes/cinder_scheduler_spec.rb index 4ce066a0..9cdab1db 100644 --- a/spec/classes/cinder_scheduler_spec.rb +++ b/spec/classes/cinder_scheduler_spec.rb @@ -10,15 +10,15 @@ describe 'cinder::scheduler' 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', :ensure => 'present', :before => 'Service[cinder-scheduler]' ) } - it { should contain_service('cinder-scheduler').with( + it { is_expected.to contain_service('cinder-scheduler').with( :name => 'cinder-scheduler', :enable => true, :ensure => 'running', @@ -35,8 +35,8 @@ describe 'cinder::scheduler' do } end - it { should 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_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') } + it { is_expected.to contain_package('cinder-scheduler').with_ensure('present') } end describe 'with manage_service false' do @@ -45,7 +45,7 @@ describe 'cinder::scheduler' do } end 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 @@ -59,9 +59,9 @@ describe 'cinder::scheduler' 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', :enable => true, :ensure => 'running', @@ -75,7 +75,7 @@ describe 'cinder::scheduler' do { :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler' } 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 diff --git a/spec/classes/cinder_setup_test_volume_spec.rb b/spec/classes/cinder_setup_test_volume_spec.rb index 678e196c..08e46864 100644 --- a/spec/classes/cinder_setup_test_volume_spec.rb +++ b/spec/classes/cinder_setup_test_volume_spec.rb @@ -2,21 +2,21 @@ require 'spec_helper' describe 'cinder::setup_test_volume' do - it { should contain_package('lvm2').with( + it { is_expected.to contain_package('lvm2').with( :ensure => 'present' ) } - it { should contain_file('/var/lib/cinder').with( + it { is_expected.to contain_file('/var/lib/cinder').with( :ensure => 'directory', :require => 'Package[cinder]' ) } 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' ) - should contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes') - should contain_exec('pvcreate /dev/loop2') - should contain_exec('vgcreate cinder-volumes /dev/loop2') + is_expected.to contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes') + is_expected.to contain_exec('pvcreate /dev/loop2') + is_expected.to contain_exec('vgcreate cinder-volumes /dev/loop2') end end diff --git a/spec/classes/cinder_spec.rb b/spec/classes/cinder_spec.rb index 1e625de4..b80466cb 100644 --- a/spec/classes/cinder_spec.rb +++ b/spec/classes/cinder_spec.rb @@ -13,82 +13,42 @@ describe 'cinder' do req_params end - it { should contain_class('cinder::params') } - it { should contain_class('mysql::bindings::python') } + it { is_expected.to contain_class('cinder::params') } + it { is_expected.to contain_class('mysql::bindings::python') } it 'should contain default config' do - should contain_cinder_config('DEFAULT/rpc_backend').with( - :value => 'cinder.openstack.common.rpc.impl_kombu' - ) - should contain_cinder_config('DEFAULT/control_exchange').with( - :value => 'openstack' - ) - should contain_cinder_config('DEFAULT/rabbit_password').with( - :value => 'guest', - :secret => true - ) - should contain_cinder_config('DEFAULT/rabbit_host').with( - :value => '127.0.0.1' - ) - should contain_cinder_config('DEFAULT/rabbit_port').with( - :value => '5672' - ) - should contain_cinder_config('DEFAULT/rabbit_hosts').with( - :value => '127.0.0.1:5672' - ) - should contain_cinder_config('DEFAULT/rabbit_ha_queues').with( - :value => false - ) - 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') + is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with(: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) + is_expected.to contain_cinder_config('DEFAULT/rabbit_host').with(:value => '127.0.0.1') + 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') + is_expected.to contain_cinder_config('DEFAULT/rabbit_ha_queues').with(:value => false) + is_expected.to contain_cinder_config('DEFAULT/rabbit_virtual_host').with(:value => '/') + 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) + is_expected.to contain_cinder_config('database/idle_timeout').with(:value => '3600') + 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') + is_expected.to contain_cinder_config('database/max_retries').with(:value => '10') + is_expected.to contain_cinder_config('database/retry_interval').with(:value => '10') + is_expected.to contain_cinder_config('database/max_overflow').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/verbose').with(:value => false) + is_expected.to contain_cinder_config('DEFAULT/debug').with(:value => false) + is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => 'nova') + is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => 'nova') + 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') end - it { should contain_file('/etc/cinder/cinder.conf').with( + it { is_expected.to contain_file('/etc/cinder/cinder.conf').with( :owner => 'cinder', :group => 'cinder', :mode => '0600', :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', :group => 'cinder', :mode => '0600', @@ -102,18 +62,10 @@ describe 'cinder' do end it 'should contain many' do - should contain_cinder_config('DEFAULT/rabbit_host').with( - :value => nil - ) - should contain_cinder_config('DEFAULT/rabbit_port').with( - :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 - ) + is_expected.to contain_cinder_config('DEFAULT/rabbit_host').with(: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') + is_expected.to contain_cinder_config('DEFAULT/rabbit_ha_queues').with(:value => true) end end @@ -123,18 +75,10 @@ describe 'cinder' do end it 'should contain many' do - should contain_cinder_config('DEFAULT/rabbit_host').with( - :value => nil - ) - should contain_cinder_config('DEFAULT/rabbit_port').with( - :value => nil - ) - should contain_cinder_config('DEFAULT/rabbit_hosts').with( - :value => 'rabbit1:5672' - ) - should contain_cinder_config('DEFAULT/rabbit_ha_queues').with( - :value => true - ) + is_expected.to contain_cinder_config('DEFAULT/rabbit_host').with(: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') + is_expected.to contain_cinder_config('DEFAULT/rabbit_ha_queues').with(:value => true) end end @@ -148,21 +92,21 @@ describe 'cinder' do } end - it { should 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 { should contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') } - it { should contain_cinder_config('DEFAULT/qpid_port').with_value('5672') } - it { should contain_cinder_config('DEFAULT/qpid_username').with_value('guest') } - it { should contain_cinder_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) } - it { should contain_cinder_config('DEFAULT/qpid_reconnect').with_value(true) } - it { should contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') } - it { should contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') } - it { should 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 { should contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') } - it { should contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') } - it { should 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('database/connection').with_value('mysql://user:password@host/database') } + it { is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with_value('cinder.openstack.common.rpc.impl_qpid') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_port').with_value('5672') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_username').with_value('guest') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect').with_value(true) } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_protocol').with_value('tcp') } + it { is_expected.to contain_cinder_config('DEFAULT/qpid_tcp_nodelay').with_value(true) } end describe 'with qpid rpc and no qpid_sasl_mechanisms' do @@ -174,7 +118,7 @@ describe 'cinder' do } 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 describe 'with qpid rpc and qpid_sasl_mechanisms string' do @@ -187,7 +131,7 @@ describe 'cinder' do } 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 describe 'with qpid rpc and qpid_sasl_mechanisms array' do @@ -200,7 +144,7 @@ describe 'cinder' do } 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 describe 'with SSL enabled with kombu' do @@ -215,11 +159,11 @@ describe 'cinder' do end it do - should 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') - should 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') - should contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') + is_expected.to contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('true') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') end end @@ -231,11 +175,11 @@ describe 'cinder' do end it do - should contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('true') - should contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') - should contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') - should 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/rabbit_use_ssl').with_value('true') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') end end @@ -251,11 +195,11 @@ describe 'cinder' do end it do - should contain_cinder_config('DEFAULT/rabbit_use_ssl').with_value('false') - should contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') - should contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') - should 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/rabbit_use_ssl').with_value('false') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') + is_expected.to contain_cinder_config('DEFAULT/kombu_ssl_version').with_ensure('absent') end end @@ -264,7 +208,7 @@ describe 'cinder' do req_params 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 describe 'with syslog enabled' do @@ -274,8 +218,8 @@ describe 'cinder' do }) end - it { should 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/use_syslog').with_value(true) } + it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') } end describe 'with syslog enabled and custom settings' do @@ -286,13 +230,13 @@ describe 'cinder' do }) end - it { should 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/use_syslog').with_value(true) } + it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') } end describe 'with log_dir disabled' do 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 describe 'with amqp_durable_queues disabled' do @@ -300,7 +244,7 @@ describe 'cinder' do req_params 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 describe 'with amqp_durable_queues enabled' do @@ -310,7 +254,7 @@ describe 'cinder' do }) 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 describe 'with postgresql' do @@ -321,13 +265,13 @@ describe 'cinder' do } 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', :secret => true ) } - it { should_not contain_class('mysql::python') } - it { should_not contain_class('mysql::bindings') } - it { should_not contain_class('mysql::bindings::python') } + it { is_expected.to_not contain_class('mysql::python') } + it { is_expected.to_not contain_class('mysql::bindings') } + it { is_expected.to_not contain_class('mysql::bindings::python') } end describe 'with SSL socket options set' do @@ -341,9 +285,9 @@ describe 'cinder' do } end - it { should 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 { should contain_cinder_config('DEFAULT/ssl_key_file').with_value('/path/to/key') } + it { is_expected.to contain_cinder_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') } + it { is_expected.to contain_cinder_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') } + it { is_expected.to contain_cinder_config('DEFAULT/ssl_key_file').with_value('/path/to/key') } end describe 'with SSL socket options set to false' do @@ -357,9 +301,9 @@ describe 'cinder' do } end - it { should contain_cinder_config('DEFAULT/ssl_ca_file').with_ensure('absent') } - it { should 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_ca_file').with_ensure('absent') } + it { is_expected.to contain_cinder_config('DEFAULT/ssl_cert_file').with_ensure('absent') } + it { is_expected.to contain_cinder_config('DEFAULT/ssl_key_file').with_ensure('absent') } end describe 'with SSL socket options set wrongly configured' do @@ -372,11 +316,7 @@ describe 'cinder' do } end - it 'should raise an error' do - expect { - should compile - }.to raise_error Puppet::Error, /The cert_file parameter is required when use_ssl is set to true/ - end + it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/ end describe 'with APIs set for Kilo (proposed)' do diff --git a/spec/classes/cinder_vmware_spec.rb b/spec/classes/cinder_vmware_spec.rb index 70561362..96786d40 100644 --- a/spec/classes/cinder_vmware_spec.rb +++ b/spec/classes/cinder_vmware_spec.rb @@ -11,23 +11,23 @@ describe 'cinder::vmware' do describe 'with defaults' 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_value => 'thin') - should contain_cinder__type('vmware-thick').with( + is_expected.to contain_cinder__type('vmware-thick').with( :set_key => 'vmware:vmdk_type', :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_value => 'eagerZeroedThick') - should contain_cinder__type('vmware-full').with( + is_expected.to contain_cinder__type('vmware-full').with( :set_key => 'vmware:clone_type', :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_value => 'linked') end diff --git a/spec/classes/cinder_volume_emc_vnx_spec.rb b/spec/classes/cinder_volume_emc_vnx_spec.rb index 3372e1f5..21e922d3 100644 --- a/spec/classes/cinder_volume_emc_vnx_spec.rb +++ b/spec/classes/cinder_volume_emc_vnx_spec.rb @@ -21,12 +21,12 @@ describe 'cinder::volume::emc_vnx' do describe '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') - should contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2') - should contain_cinder_config('DEFAULT/san_login').with_value('emc') - should contain_cinder_config('DEFAULT/san_password').with_value('password') - should 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/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver') + is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2') + is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('emc') + is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password') + is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with_value('127.0.0.3') + is_expected.to contain_cinder_config('DEFAULT/storage_vnx_pool_name').with_value('emc-storage-pool') end end end diff --git a/spec/classes/cinder_volume_eqlx_spec.rb b/spec/classes/cinder_volume_eqlx_spec.rb index 0f1a0ab8..da6b7b9c 100644 --- a/spec/classes/cinder_volume_eqlx_spec.rb +++ b/spec/classes/cinder_volume_eqlx_spec.rb @@ -19,16 +19,16 @@ describe 'cinder::volume::eqlx' do describe 'eqlx volume driver' do it 'configures eqlx volume driver' do - should 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_driver').with_value('cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver') + is_expected.to contain_cinder_config('DEFAULT/volume_backend_name').with_value('DEFAULT') 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 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 diff --git a/spec/classes/cinder_volume_glusterfs_spec.rb b/spec/classes/cinder_volume_glusterfs_spec.rb index 950d0c41..c5f50233 100644 --- a/spec/classes/cinder_volume_glusterfs_spec.rb +++ b/spec/classes/cinder_volume_glusterfs_spec.rb @@ -13,15 +13,11 @@ describe 'cinder::volume::glusterfs' do end it 'configures glusterfs volume driver' do - should contain_cinder_config('DEFAULT/volume_driver').with_value( - 'cinder.volume.drivers.glusterfs.GlusterfsDriver') - should contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value( - '/etc/cinder/other_shares.conf') - should contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value( - true) - should contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value( - '/cinder_mount_point') - should contain_file('/etc/cinder/other_shares.conf').with( + is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.glusterfs.GlusterfsDriver') + is_expected.to contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value('/etc/cinder/other_shares.conf') + is_expected.to contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value(true) + is_expected.to contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value('/cinder_mount_point') + is_expected.to contain_file('/etc/cinder/other_shares.conf').with( :content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n", :require => 'Package[cinder]', :notify => 'Service[cinder-volume]' @@ -34,9 +30,7 @@ describe 'cinder::volume::glusterfs' do :glusterfs_disk_util => 'foo', }) end - it 'should fails' do - expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./) - end + it_raises 'a Puppet::Error', /glusterfs_disk_util is removed in Icehouse./ end end diff --git a/spec/classes/cinder_volume_iscsi_spec.rb b/spec/classes/cinder_volume_iscsi_spec.rb index 091f7daf..34f2a09d 100644 --- a/spec/classes/cinder_volume_iscsi_spec.rb +++ b/spec/classes/cinder_volume_iscsi_spec.rb @@ -16,13 +16,13 @@ describe 'cinder::volume::iscsi' do req_params 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')} - it { should 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 { should 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 { should contain_cinder_config('DEFAULT/iscsi_protocol').with(:value => 'iscsi')} + it { is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with(:value => '127.0.0.2')} + it { is_expected.to contain_cinder_config('DEFAULT/iscsi_helper').with(:value => 'tgtadm')} + it { is_expected.to contain_cinder_config('DEFAULT/volume_group').with(:value => 'cinder-volumes')} + it { is_expected.to contain_cinder_config('DEFAULT/volumes_dir').with(:value => '/var/lib/cinder/volumes')} + it { is_expected.to contain_cinder_config('DEFAULT/iscsi_protocol').with(:value => 'iscsi')} end @@ -30,7 +30,7 @@ describe 'cinder::volume::iscsi' do 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 - should contain_cinder__backend__iscsi('DEFAULT').with({ + is_expected.to contain_cinder__backend__iscsi('DEFAULT').with({ :volumes_dir => '/etc/cinder/volumes' }) end @@ -40,11 +40,7 @@ describe 'cinder::volume::iscsi' do describe 'with a unsupported iscsi helper' do let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')} - it 'should raise an error' do - expect { - should compile - }.to raise_error Puppet::Error, /Unsupported iscsi helper: fooboozoo/ - end + it_raises 'a Puppet::Error', /Unsupported iscsi helper: fooboozoo/ end describe 'with RedHat' do @@ -59,7 +55,7 @@ describe 'cinder::volume::iscsi' do :operatingsystemmajrelease => '6'} 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/*', :path => '/etc/tgt/targets.conf' ) } @@ -78,8 +74,8 @@ describe 'cinder::volume::iscsi' do {:osfamily => 'RedHat'} end - it { should contain_package('targetcli').with_ensure('present')} - it { should contain_service('target').with( + it { is_expected.to contain_package('targetcli').with_ensure('present')} + it { is_expected.to contain_service('target').with( :ensure => 'running', :enable => 'true', :require => 'Package[targetcli]' diff --git a/spec/classes/cinder_volume_netapp_spec.rb b/spec/classes/cinder_volume_netapp_spec.rb index dd6a3377..a36ecfef 100644 --- a/spec/classes/cinder_volume_netapp_spec.rb +++ b/spec/classes/cinder_volume_netapp_spec.rb @@ -39,19 +39,19 @@ describe 'cinder::volume::netapp' do end 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') 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 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 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 @@ -75,7 +75,7 @@ describe 'cinder::volume::netapp' 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") end end diff --git a/spec/classes/cinder_volume_nexenta_spec.rb b/spec/classes/cinder_volume_nexenta_spec.rb index 258400fa..d6180502 100644 --- a/spec/classes/cinder_volume_nexenta_spec.rb +++ b/spec/classes/cinder_volume_nexenta_spec.rb @@ -31,12 +31,12 @@ describe 'cinder::volume::nexenta' do it 'configures nexenta volume driver' do 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 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 diff --git a/spec/classes/cinder_volume_nfs_spec.rb b/spec/classes/cinder_volume_nfs_spec.rb index 449153fc..602ba27e 100644 --- a/spec/classes/cinder_volume_nfs_spec.rb +++ b/spec/classes/cinder_volume_nfs_spec.rb @@ -17,23 +17,23 @@ describe 'cinder::volume::nfs' do describe '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') - 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') - should contain_cinder_config('DEFAULT/nfs_mount_options').with_value( + is_expected.to contain_cinder_config('DEFAULT/nfs_mount_options').with_value( '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) - 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') - should contain_cinder_config('DEFAULT/nfs_disk_util').with_value( + is_expected.to contain_cinder_config('DEFAULT/nfs_disk_util').with_value( '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') - should contain_cinder_config('DEFAULT/nfs_oversub_ratio').with_value( + is_expected.to contain_cinder_config('DEFAULT/nfs_oversub_ratio').with_value( '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", :require => 'Package[cinder]', :notify => 'Service[cinder-volume]' diff --git a/spec/classes/cinder_volume_rbd_spec.rb b/spec/classes/cinder_volume_rbd_spec.rb index 8436207f..9ec9eabf 100644 --- a/spec/classes/cinder_volume_rbd_spec.rb +++ b/spec/classes/cinder_volume_rbd_spec.rb @@ -13,7 +13,7 @@ describe 'cinder::volume::rbd' do } end - it { should contain_class('cinder::params') } + it { is_expected.to contain_class('cinder::params') } let :params do req_params @@ -25,17 +25,17 @@ describe 'cinder::volume::rbd' do describe '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]) - should 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]) - should 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]) - should 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]) - should contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present') - should contain_file_line('set initscript env').with( + is_expected.to contain_cinder_config('DEFAULT/rbd_ceph_conf').with_value(req_params[:rbd_ceph_conf]) + is_expected.to 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/volume_tmp_dir').with_value(req_params[:volume_tmp_dir]) + is_expected.to contain_cinder_config('DEFAULT/rbd_max_clone_depth').with_value(req_params[:rbd_max_clone_depth]) + is_expected.to contain_cinder_config('DEFAULT/rbd_pool').with_value(req_params[:rbd_pool]) + is_expected.to contain_cinder_config('DEFAULT/rbd_user').with_value(req_params[:rbd_user]) + is_expected.to contain_cinder_config('DEFAULT/rbd_secret_uuid').with_value(req_params[:rbd_secret_uuid]) + is_expected.to contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present') + is_expected.to contain_file_line('set initscript env').with( :line => /env CEPH_ARGS=\"--id test\"/, :path => '/etc/init/cinder-volume.override', :notify => 'Service[cinder-volume]') @@ -43,12 +43,12 @@ describe 'cinder::volume::rbd' do context 'with rbd_secret_uuid disabled' do 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 context 'with volume_tmp_dir disabled' do 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 @@ -64,13 +64,13 @@ describe 'cinder::volume::rbd' do end 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' ) end 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\"/, :path => '/etc/sysconfig/openstack-cinder-volume', :notify => 'Service[cinder-volume]') diff --git a/spec/classes/cinder_volume_san_spec.rb b/spec/classes/cinder_volume_san_spec.rb index f843fd91..0011b9e7 100644 --- a/spec/classes/cinder_volume_san_spec.rb +++ b/spec/classes/cinder_volume_san_spec.rb @@ -27,12 +27,12 @@ describe 'cinder::volume::san' do it 'configures cinder volume driver' do 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 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 diff --git a/spec/classes/cinder_volume_solidfire_spec.rb b/spec/classes/cinder_volume_solidfire_spec.rb index d6d4e5fd..33640c67 100644 --- a/spec/classes/cinder_volume_solidfire_spec.rb +++ b/spec/classes/cinder_volume_solidfire_spec.rb @@ -15,14 +15,14 @@ describe 'cinder::volume::solidfire' do describe 'solidfire volume driver' do it 'configure solidfire volume driver' do - should 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') - should 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/volume_driver').with_value('cinder.volume.drivers.solidfire.SolidFireDriver') + is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2') + is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('solidfire') + is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password') end 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 diff --git a/spec/classes/cinder_volume_spec.rb b/spec/classes/cinder_volume_spec.rb index 4b3cc14b..36bf5172 100644 --- a/spec/classes/cinder_volume_spec.rb +++ b/spec/classes/cinder_volume_spec.rb @@ -10,8 +10,8 @@ describe 'cinder::volume' do {:osfamily => 'Debian'} end - it { should contain_package('cinder-volume').with_ensure('present') } - it { should contain_service('cinder-volume').with( + it { is_expected.to contain_package('cinder-volume').with_ensure('present') } + it { is_expected.to contain_service('cinder-volume').with( 'hasstatus' => true )} @@ -20,7 +20,7 @@ describe 'cinder::volume' do { 'manage_service' => false } end 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 diff --git a/spec/classes/cinder_volume_vmdk_spec.rb b/spec/classes/cinder_volume_vmdk_spec.rb index 8aa364c3..96ae866c 100644 --- a/spec/classes/cinder_volume_vmdk_spec.rb +++ b/spec/classes/cinder_volume_vmdk_spec.rb @@ -22,24 +22,24 @@ describe 'cinder::volume::vmdk' do end it 'should configure vmdk driver in cinder.conf' do - should 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]) - should 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]) - should contain_cinder_config('DEFAULT/vmware_volume_folder').with_value('cinder-volumes') - should contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(10) - should contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(100) - should contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(5) - should contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(7200) - should_not contain_cinder_config('DEFAULT/vmware_wsdl_location') + is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver') + is_expected.to contain_cinder_config('DEFAULT/vmware_host_ip').with_value(params[:host_ip]) + is_expected.to contain_cinder_config('DEFAULT/vmware_host_username').with_value(params[:host_username]) + is_expected.to contain_cinder_config('DEFAULT/vmware_host_password').with_value(params[:host_password]) + is_expected.to contain_cinder_config('DEFAULT/vmware_volume_folder').with_value('cinder-volumes') + is_expected.to contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(10) + is_expected.to contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(100) + is_expected.to contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(5) + is_expected.to contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(7200) + is_expected.to_not contain_cinder_config('DEFAULT/vmware_wsdl_location') end 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 it 'installs vmdk python driver' do - should contain_package('python-suds').with( + is_expected.to contain_package('python-suds').with( :ensure => 'present' ) end @@ -50,12 +50,12 @@ describe 'cinder::volume::vmdk' do end it 'should configure vmdk driver in cinder.conf' do - should 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]) - should 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]) - should 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_volume_folder').with_value(params[:volume_folder]) + is_expected.to contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(params[:api_retry_count]) + is_expected.to contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(params[:max_object_retrieval]) + is_expected.to contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(params[:task_poll_interval]) + is_expected.to contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs]) + is_expected.to contain_cinder_config('DEFAULT/vmware_wsdl_location').with_value(params[:wsdl_location]) end end end diff --git a/spec/defines/cinder_backend_emc_vnx_spec.rb b/spec/defines/cinder_backend_emc_vnx_spec.rb index e5031bb6..c62f52b4 100644 --- a/spec/defines/cinder_backend_emc_vnx_spec.rb +++ b/spec/defines/cinder_backend_emc_vnx_spec.rb @@ -23,12 +23,12 @@ describe 'cinder::backend::emc_vnx' do describe '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') - should contain_cinder_config('emc/san_ip').with_value('127.0.0.2') - should contain_cinder_config('emc/san_login').with_value('emc') - should contain_cinder_config('emc/san_password').with_value('password') - should 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/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver') + is_expected.to contain_cinder_config('emc/san_ip').with_value('127.0.0.2') + is_expected.to contain_cinder_config('emc/san_login').with_value('emc') + is_expected.to contain_cinder_config('emc/san_password').with_value('password') + is_expected.to contain_cinder_config('emc/iscsi_ip_address').with_value('127.0.0.3') + is_expected.to contain_cinder_config('emc/storage_vnx_pool_name').with_value('emc-storage-pool') end end end diff --git a/spec/defines/cinder_backend_eqlx_spec.rb b/spec/defines/cinder_backend_eqlx_spec.rb index a6a287a9..91f12519 100644 --- a/spec/defines/cinder_backend_eqlx_spec.rb +++ b/spec/defines/cinder_backend_eqlx_spec.rb @@ -24,11 +24,11 @@ describe 'cinder::backend::eqlx' do describe '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( 'cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver') params.each_pair do |config,value| - should contain_cinder_config( + is_expected.to contain_cinder_config( "#{config_group_name}/#{config}").with_value(value) end end diff --git a/spec/defines/cinder_backend_glusterfs_spec.rb b/spec/defines/cinder_backend_glusterfs_spec.rb index c0b4fa2e..37098795 100644 --- a/spec/defines/cinder_backend_glusterfs_spec.rb +++ b/spec/defines/cinder_backend_glusterfs_spec.rb @@ -15,15 +15,15 @@ describe 'cinder::backend::glusterfs' do end 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') - 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') - should contain_cinder_config('mygluster/glusterfs_sparsed_volumes').with_value( + is_expected.to contain_cinder_config('mygluster/glusterfs_sparsed_volumes').with_value( 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') - 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", :require => 'Package[cinder]', :notify => 'Service[cinder-volume]' @@ -36,9 +36,7 @@ describe 'cinder::backend::glusterfs' do :glusterfs_disk_util => 'foo', }) end - it 'should fails' do - expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./) - end + it_raises 'a Puppet::Error', /glusterfs_disk_util is removed in Icehouse./ end end diff --git a/spec/defines/cinder_backend_iscsi_spec.rb b/spec/defines/cinder_backend_iscsi_spec.rb index 7a151f4e..59a02e95 100644 --- a/spec/defines/cinder_backend_iscsi_spec.rb +++ b/spec/defines/cinder_backend_iscsi_spec.rb @@ -29,19 +29,19 @@ describe 'cinder::backend::iscsi' do describe 'with default params' 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') - should contain_cinder_config('hippo/volume_driver').with( + is_expected.to contain_cinder_config('hippo/volume_driver').with( :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') - should contain_cinder_config('hippo/iscsi_helper').with( + is_expected.to contain_cinder_config('hippo/iscsi_helper').with( :value => 'tgtadm') - should contain_cinder_config('hippo/volume_group').with( + is_expected.to contain_cinder_config('hippo/volume_group').with( :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') - should contain_cinder_config('hippo/iscsi_protocol').with( + is_expected.to contain_cinder_config('hippo/iscsi_protocol').with( :value => 'iscsi') end end @@ -52,7 +52,7 @@ describe 'cinder::backend::iscsi' do end 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') end end @@ -63,7 +63,7 @@ describe 'cinder::backend::iscsi' do end 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' ) end @@ -75,7 +75,7 @@ describe 'cinder::backend::iscsi' do {:osfamily => 'RedHat'} 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/*', :path => '/etc/tgt/targets.conf' ) } diff --git a/spec/defines/cinder_backend_netapp_spec.rb b/spec/defines/cinder_backend_netapp_spec.rb index b1c163f7..d26e4763 100644 --- a/spec/defines/cinder_backend_netapp_spec.rb +++ b/spec/defines/cinder_backend_netapp_spec.rb @@ -41,19 +41,19 @@ describe 'cinder::backend::netapp' do end 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') 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 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 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 @@ -75,7 +75,7 @@ describe 'cinder::backend::netapp' do :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 context 'with NFS shares provided' do @@ -85,7 +85,7 @@ describe 'cinder::backend::netapp' 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") end end @@ -98,9 +98,7 @@ describe 'cinder::backend::netapp' do }) end - it 'throw error' do - expect {subject}.to raise_error(Puppet::Error, /"not an array" is not an Array. It looks to be a String/) - end + it_raises 'a Puppet::Error', /"not an array" is not an Array. It looks to be a String/ end end diff --git a/spec/defines/cinder_backend_nexenta_spec.rb b/spec/defines/cinder_backend_nexenta_spec.rb index 2c26c586..82e19142 100644 --- a/spec/defines/cinder_backend_nexenta_spec.rb +++ b/spec/defines/cinder_backend_nexenta_spec.rb @@ -32,7 +32,7 @@ describe 'cinder::backend::nexenta' do it 'configures nexenta volume driver' do 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 diff --git a/spec/defines/cinder_backend_nfs_spec.rb b/spec/defines/cinder_backend_nfs_spec.rb index bc7906f6..5d2bf3e6 100644 --- a/spec/defines/cinder_backend_nfs_spec.rb +++ b/spec/defines/cinder_backend_nfs_spec.rb @@ -20,25 +20,25 @@ describe 'cinder::backend::nfs' do describe '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') - 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') - 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') - should contain_cinder_config('hippo/nfs_mount_options').with_value( + is_expected.to contain_cinder_config('hippo/nfs_mount_options').with_value( '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) - 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') - should contain_cinder_config('hippo/nfs_disk_util').with_value( + is_expected.to contain_cinder_config('hippo/nfs_disk_util').with_value( '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') - should contain_cinder_config('hippo/nfs_oversub_ratio').with_value( + is_expected.to contain_cinder_config('hippo/nfs_oversub_ratio').with_value( '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", :require => 'Package[cinder]', :notify => 'Service[cinder-volume]' diff --git a/spec/defines/cinder_backend_rbd_spec.rb b/spec/defines/cinder_backend_rbd_spec.rb index 33839c86..0a49dccd 100644 --- a/spec/defines/cinder_backend_rbd_spec.rb +++ b/spec/defines/cinder_backend_rbd_spec.rb @@ -17,7 +17,7 @@ describe 'cinder::backend::rbd' do } end - it { should contain_class('cinder::params') } + it { is_expected.to contain_class('cinder::params') } let :params do req_params @@ -29,17 +29,17 @@ describe 'cinder::backend::rbd' do describe 'rbd backend 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]) - should 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]) - should 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]) - should 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]) - should 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]) - should contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present') - should contain_file_line('set initscript env').with( + is_expected.to 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_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') + is_expected.to 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_flatten_volume_from_snapshot").with_value(req_params[:rbd_flatten_volume_from_snapshot]) + is_expected.to 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]}/rbd_max_clone_depth").with_value(req_params[:rbd_max_clone_depth]) + is_expected.to 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_user").with_value(req_params[:rbd_user]) + is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_value(req_params[:rbd_secret_uuid]) + is_expected.to contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present') + is_expected.to contain_file_line('set initscript env').with( :line => /env CEPH_ARGS=\"--id test\"/, :path => '/etc/init/cinder-volume.override', :notify => 'Service[cinder-volume]') @@ -47,12 +47,12 @@ describe 'cinder::backend::rbd' do context 'with rbd_secret_uuid disabled' do 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 context 'with volume_tmp_dir disabled' do 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 context 'with another RBD backend' do @@ -62,12 +62,12 @@ describe 'cinder::backend::rbd' do rbd_user => 'test' }" end - it { should 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 { should 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 { should 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("#{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]}/rbd_pool").with_value(req_params[:rbd_pool]) } + it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user]) } + it { is_expected.to contain_cinder_config("ceph2/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver') } + it { is_expected.to contain_cinder_config("ceph2/rbd_pool").with_value('volumes2') } + it { is_expected.to contain_cinder_config("ceph2/rbd_user").with_value('test') } end end @@ -81,13 +81,13 @@ describe 'cinder::backend::rbd' do end 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' ) end 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\"/, :path => '/etc/sysconfig/openstack-cinder-volume', :notify => 'Service[cinder-volume]') diff --git a/spec/defines/cinder_backend_san_spec.rb b/spec/defines/cinder_backend_san_spec.rb index ef647de2..d5e0d343 100644 --- a/spec/defines/cinder_backend_san_spec.rb +++ b/spec/defines/cinder_backend_san_spec.rb @@ -28,7 +28,7 @@ describe 'cinder::backend::san' do it 'configures cinder volume driver' do 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 diff --git a/spec/defines/cinder_backend_solidfire_spec.rb b/spec/defines/cinder_backend_solidfire_spec.rb index 0b5a7122..7c2e30e1 100644 --- a/spec/defines/cinder_backend_solidfire_spec.rb +++ b/spec/defines/cinder_backend_solidfire_spec.rb @@ -17,13 +17,13 @@ describe 'cinder::backend::solidfire' do describe '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') - should contain_cinder_config('solidfire/san_ip').with_value( + is_expected.to contain_cinder_config('solidfire/san_ip').with_value( '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') - should contain_cinder_config('solidfire/san_password').with_value( + is_expected.to contain_cinder_config('solidfire/san_password').with_value( 'password') end end diff --git a/spec/defines/cinder_backend_vmdk_spec.rb b/spec/defines/cinder_backend_vmdk_spec.rb index 85940aca..9e7dc493 100644 --- a/spec/defines/cinder_backend_vmdk_spec.rb +++ b/spec/defines/cinder_backend_vmdk_spec.rb @@ -24,21 +24,21 @@ describe 'cinder::backend::vmdk' do end it 'should configure vmdk driver in cinder.conf' do - should 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') - should 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]) - should contain_cinder_config('hippo/vmware_host_password').with_value(params[:host_password]) - should contain_cinder_config('hippo/vmware_volume_folder').with_value('cinder-volumes') - should contain_cinder_config('hippo/vmware_api_retry_count').with_value(10) - should contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(100) - should contain_cinder_config('hippo/vmware_task_poll_interval').with_value(5) - should contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(7200) - should_not contain_cinder_config('hippo/vmware_wsdl_location') + is_expected.to contain_cinder_config('hippo/volume_backend_name').with_value('hippo') + is_expected.to contain_cinder_config('hippo/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver') + is_expected.to contain_cinder_config('hippo/vmware_host_ip').with_value(params[:host_ip]) + is_expected.to contain_cinder_config('hippo/vmware_host_username').with_value(params[:host_username]) + is_expected.to contain_cinder_config('hippo/vmware_host_password').with_value(params[:host_password]) + is_expected.to contain_cinder_config('hippo/vmware_volume_folder').with_value('cinder-volumes') + is_expected.to contain_cinder_config('hippo/vmware_api_retry_count').with_value(10) + is_expected.to contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(100) + is_expected.to contain_cinder_config('hippo/vmware_task_poll_interval').with_value(5) + is_expected.to contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(7200) + is_expected.to_not contain_cinder_config('hippo/vmware_wsdl_location') end it 'installs suds python package' do - should contain_package('python-suds').with( + is_expected.to contain_package('python-suds').with( :ensure => 'present') end @@ -48,12 +48,12 @@ describe 'cinder::backend::vmdk' do end it 'should configure vmdk driver in cinder.conf' do - should 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]) - should 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]) - should 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_volume_folder').with_value(params[:volume_folder]) + is_expected.to contain_cinder_config('hippo/vmware_api_retry_count').with_value(params[:api_retry_count]) + is_expected.to contain_cinder_config('hippo/vmware_max_object_retrieval').with_value(params[:max_object_retrieval]) + is_expected.to contain_cinder_config('hippo/vmware_task_poll_interval').with_value(params[:task_poll_interval]) + is_expected.to contain_cinder_config('hippo/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs]) + is_expected.to contain_cinder_config('hippo/vmware_wsdl_location').with_value(params[:wsdl_location]) end end end diff --git a/spec/defines/cinder_type_set_spec.rb b/spec/defines/cinder_type_set_spec.rb index 2faba85e..97d1180d 100644 --- a/spec/defines/cinder_type_set_spec.rb +++ b/spec/defines/cinder_type_set_spec.rb @@ -17,7 +17,7 @@ describe 'cinder::type_set' do end 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', :unless => "cinder extra-specs-list | grep -Eq '\\bsith\\b.*\\bmonchichi\\b.*\\bhippo\\b'", :environment => [ diff --git a/spec/defines/cinder_type_spec.rb b/spec/defines/cinder_type_spec.rb index 4fa2ac98..350c29b7 100644 --- a/spec/defines/cinder_type_spec.rb +++ b/spec/defines/cinder_type_spec.rb @@ -17,7 +17,7 @@ describe 'cinder::type' do end 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', :environment => [ 'OS_TENANT_NAME=admin', @@ -26,7 +26,7 @@ describe 'cinder::type' do 'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/'], :unless => "cinder type-list | grep -qP '\\bhippo\\b'", :require => 'Package[python-cinderclient]') - should 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=name1') + is_expected.to contain_exec('cinder type-key hippo set volume_backend_name=name2') end end diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb index d92156a3..fec0eacc 100644 --- a/spec/shared_examples.rb +++ b/spec/shared_examples.rb @@ -1,5 +1,5 @@ shared_examples_for "a Puppet::Error" do |description| 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