]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
spec: updates for rspec-puppet 2.x and rspec 3.x
authorSebastien Badia <sebastien.badia@enovance.com>
Sun, 22 Feb 2015 21:02:45 +0000 (22:02 +0100)
committerGael Chamoulaud <gchamoul@redhat.com>
Wed, 11 Mar 2015 07:56:44 +0000 (08:56 +0100)
This patch aim to update our specs test in order to work with the new
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: Ieaff6bc8bdd8548648ff5e76b212d4df382fa8a3
Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant

21 files changed:
Gemfile
spec/classes/ceilometer_agent_auth_spec.rb
spec/classes/ceilometer_agent_central_spec.rb
spec/classes/ceilometer_agent_compute_spec.rb
spec/classes/ceilometer_agent_notification_spec.rb
spec/classes/ceilometer_alarm_evaluator_spec.rb
spec/classes/ceilometer_alarm_notifier_spec.rb
spec/classes/ceilometer_api_spec.rb
spec/classes/ceilometer_client_spec.rb
spec/classes/ceilometer_collector_spec.rb
spec/classes/ceilometer_config_spec.rb
spec/classes/ceilometer_db_mysql_spec.rb
spec/classes/ceilometer_db_postgresql_spec.rb
spec/classes/ceilometer_db_spec.rb
spec/classes/ceilometer_expirer_spec.rb
spec/classes/ceilometer_init_spec.rb
spec/classes/ceilometer_keystone_auth_spec.rb
spec/classes/ceilometer_logging_spec.rb
spec/classes/ceilometer_policy_spec.rb
spec/classes/ceilometer_wsgi_apache_spec.rb
spec/shared_examples.rb

diff --git a/Gemfile b/Gemfile
index 9810d19af1418979f24beda312e0b8bed735e6e4..7cd12c5f1b238d86ca6d9b75b2a5d8e2213b9a8b 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -2,12 +2,9 @@ source 'https://rubygems.org'
 
 group :development, :test do
   gem 'puppetlabs_spec_helper', :require => false
-  gem 'rspec-puppet', '~> 1.0.1'
+  gem 'rspec-puppet', '~> 2.0.0'
   gem 'puppet-lint-param-docs'
   gem 'metadata-json-lint'
-  gem 'puppet-syntax'
-  gem 'rake', '10.1.1'
-  gem 'rspec', '< 2.99'
   gem 'json'
   gem 'webmock'
 end
index 4f47eb39755cc3e8f1704525e54bd33cd71a25c2..f72459315e8ef39465313c26701b1b53956653da 100644 (file)
@@ -19,20 +19,20 @@ describe 'ceilometer::agent::auth' do
   shared_examples_for 'ceilometer-agent-auth' do
 
     it 'configures authentication' do
-      should contain_ceilometer_config('service_credentials/os_auth_url').with_value('http://localhost:5000/v2.0')
-      should contain_ceilometer_config('service_credentials/os_region_name').with_value('RegionOne')
-      should contain_ceilometer_config('service_credentials/os_username').with_value('ceilometer')
-      should contain_ceilometer_config('service_credentials/os_password').with_value('password')
-      should contain_ceilometer_config('service_credentials/os_password').with_value(params[:auth_password]).with_secret(true)
-      should contain_ceilometer_config('service_credentials/os_tenant_name').with_value('services')
-      should contain_ceilometer_config('service_credentials/os_cacert').with(:ensure => 'absent')
+      is_expected.to contain_ceilometer_config('service_credentials/os_auth_url').with_value('http://localhost:5000/v2.0')
+      is_expected.to contain_ceilometer_config('service_credentials/os_region_name').with_value('RegionOne')
+      is_expected.to contain_ceilometer_config('service_credentials/os_username').with_value('ceilometer')
+      is_expected.to contain_ceilometer_config('service_credentials/os_password').with_value('password')
+      is_expected.to contain_ceilometer_config('service_credentials/os_password').with_value(params[:auth_password]).with_secret(true)
+      is_expected.to contain_ceilometer_config('service_credentials/os_tenant_name').with_value('services')
+      is_expected.to contain_ceilometer_config('service_credentials/os_cacert').with(:ensure => 'absent')
     end
 
     context 'when overriding parameters' do
       before do
         params.merge!(:auth_cacert => '/tmp/dummy.pem')
       end
-      it { should contain_ceilometer_config('service_credentials/os_cacert').with_value(params[:auth_cacert]) }
+      it { is_expected.to contain_ceilometer_config('service_credentials/os_cacert').with_value(params[:auth_cacert]) }
     end
 
   end
index 9782086d1cf9a993bb5139d90694b2ab8661d7dd..5643e1d703b5583955b57aa0e792274d7808805b 100644 (file)
@@ -16,10 +16,10 @@ describe 'ceilometer::agent::central' do
 
   shared_examples_for 'ceilometer-agent-central' do
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer-agent-central package' do
-      should contain_package('ceilometer-agent-central').with(
+      is_expected.to contain_package('ceilometer-agent-central').with(
         :ensure => 'latest',
         :name   => platform_params[:agent_package_name],
         :before => 'Service[ceilometer-agent-central]'
@@ -27,7 +27,7 @@ describe 'ceilometer::agent::central' do
     end
 
     it 'ensures ceilometer-common is installed before the service' do
-      should contain_package('ceilometer-common').with(
+      is_expected.to contain_package('ceilometer-common').with(
         :before => /Service\[ceilometer-agent-central\]/
       )
     end
@@ -39,7 +39,7 @@ describe 'ceilometer::agent::central' do
         end
 
         it 'configures ceilometer-agent-central service' do
-          should contain_service('ceilometer-agent-central').with(
+          is_expected.to contain_service('ceilometer-agent-central').with(
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
             :name       => platform_params[:agent_service_name],
             :enable     => params[:enabled],
@@ -51,7 +51,7 @@ describe 'ceilometer::agent::central' do
     end
 
     it 'configures central agent' do
-      should contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
+      is_expected.to contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
     end
 
     context 'with disabled service managing' do
@@ -62,7 +62,7 @@ describe 'ceilometer::agent::central' do
       end
 
       it 'configures ceilometer-agent-central service' do
-        should contain_service('ceilometer-agent-central').with(
+        is_expected.to contain_service('ceilometer-agent-central').with(
           :ensure     => nil,
           :name       => platform_params[:agent_service_name],
           :enable     => false,
index c0dd64ed3fbbf75ddccbbe1303979c5f28878289..bea0b2505e67575567108578b2a8c4696d228750 100644 (file)
@@ -16,10 +16,10 @@ describe 'ceilometer::agent::compute' do
 
   shared_examples_for 'ceilometer-agent-compute' do
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer-agent-compute package' do
-      should contain_package('ceilometer-agent-compute').with(
+      is_expected.to contain_package('ceilometer-agent-compute').with(
         :ensure => 'installed',
         :name   => platform_params[:agent_package_name],
         :before => 'Service[ceilometer-agent-compute]'
@@ -28,31 +28,31 @@ describe 'ceilometer::agent::compute' do
 
     it 'adds ceilometer user to nova group and, if required, to libvirt group' do
       if platform_params[:libvirt_group]
-        should contain_user('ceilometer').with_groups(['nova', "#{platform_params[:libvirt_group]}"])
+        is_expected.to contain_user('ceilometer').with_groups(['nova', "#{platform_params[:libvirt_group]}"])
       else
-        should contain_user('ceilometer').with_groups('nova')
+        is_expected.to contain_user('ceilometer').with_groups('nova')
       end
     end
 
     it 'ensures ceilometer-common is installed before the service' do
-      should contain_package('ceilometer-common').with(
+      is_expected.to contain_package('ceilometer-common').with(
         :before => /Service\[ceilometer-agent-compute\]/
       )
     end
 
     it 'ensures nova-common is installed before the package ceilometer-common' do
-        should contain_package('nova-common').with(
+        is_expected.to contain_package('nova-common').with(
             :before => /Package\[ceilometer-common\]/
         )
     end
 
     it 'configures nova notification driver' do
-      should contain_file_line_after('nova-notification-driver-common').with(
+      is_expected.to contain_file_line_after('nova-notification-driver-common').with(
         :line   => 'notification_driver=nova.openstack.common.notifier.rpc_notifier',
         :path   => '/etc/nova/nova.conf',
         :notify => 'Service[nova-compute]'
       )
-      should contain_file_line_after('nova-notification-driver-ceilometer').with(
+      is_expected.to contain_file_line_after('nova-notification-driver-ceilometer').with(
         :line   => 'notification_driver=ceilometer.compute.nova_notifier',
         :path   => '/etc/nova/nova.conf',
         :notify => 'Service[nova-compute]'
@@ -67,7 +67,7 @@ describe 'ceilometer::agent::compute' do
 
         it 'configures ceilometer-agent-compute service' do
 
-          should contain_service('ceilometer-agent-compute').with(
+          is_expected.to contain_service('ceilometer-agent-compute').with(
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
             :name       => platform_params[:agent_service_name],
             :enable     => params[:enabled],
@@ -86,7 +86,7 @@ describe 'ceilometer::agent::compute' do
       end
 
       it 'configures ceilometer-agent-compute service' do
-        should contain_service('ceilometer-agent-compute').with(
+        is_expected.to contain_service('ceilometer-agent-compute').with(
           :ensure     => nil,
           :name       => platform_params[:agent_service_name],
           :enable     => false,
index 62ca2889dd55fa92588217891051a53c0fb3f9a8..e1cd8ec67a0e2ad6d9986a42d9b280cdf3b998f9 100644 (file)
@@ -35,17 +35,17 @@ describe 'ceilometer::agent::notification' do
 
   shared_examples_for 'ceilometer-agent-notification' do
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer agent notification package' do
-      should contain_package(platform_params[:agent_notification_package_name]).with(
+      is_expected.to contain_package(platform_params[:agent_notification_package_name]).with(
         :ensure => 'present'
       )
     end
 
     it 'configures notifications parameters in ceilometer.conf' do
-      should contain_ceilometer_config('notification/ack_on_event_error').with_value( params[:ack_on_event_error] )
-      should contain_ceilometer_config('notification/store_events').with_value( params[:store_events] )
+      is_expected.to contain_ceilometer_config('notification/ack_on_event_error').with_value( params[:ack_on_event_error] )
+      is_expected.to contain_ceilometer_config('notification/store_events').with_value( params[:store_events] )
     end
 
     [{:enabled => true}, {:enabled => false}].each do |param_hash|
@@ -55,7 +55,7 @@ describe 'ceilometer::agent::notification' do
         end
 
         it 'configures ceilometer agent notification service' do
-          should contain_service('ceilometer-agent-notification').with(
+          is_expected.to contain_service('ceilometer-agent-notification').with(
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
             :name       => platform_params[:agent_notification_service_name],
             :enable     => params[:enabled],
@@ -74,7 +74,7 @@ describe 'ceilometer::agent::notification' do
       end
 
       it 'configures ceilometer-agent-notification service' do
-        should contain_service('ceilometer-agent-notification').with(
+        is_expected.to contain_service('ceilometer-agent-notification').with(
           :ensure     => nil,
           :name       => platform_params[:agent_notification_service_name],
           :enable     => false,
index e8589a09b8fcfc6b576ccd809ee84a72c3aeae95..b1fe5bcb02f7df2e2c8a16fed7096b37cf0002ae 100644 (file)
@@ -17,28 +17,28 @@ describe 'ceilometer::alarm::evaluator' do
   end
 
   shared_examples_for 'ceilometer-alarm-evaluator' do
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer-alarm package' do
-      should contain_package(platform_params[:alarm_evaluator_package_name]).with_before('Service[ceilometer-alarm-evaluator]')
-      should contain_package(platform_params[:alarm_evaluator_package_name]).with(
+      is_expected.to contain_package(platform_params[:alarm_evaluator_package_name]).with_before('Service[ceilometer-alarm-evaluator]')
+      is_expected.to contain_package(platform_params[:alarm_evaluator_package_name]).with(
         :ensure => 'present',
         :name   => platform_params[:alarm_evaluator_package_name]
       )
     end
 
     it 'ensures ceilometer-common is installed before the service' do
-      should contain_package('ceilometer-common').with(
+      is_expected.to contain_package('ceilometer-common').with(
         :before => /Service\[ceilometer-alarm-evaluator\]/
       )
     end
 
     it 'configures alarm evaluator' do
-      should contain_ceilometer_config('alarm/evaluation_interval').with_value( params[:evaluation_interval] )
-      should contain_ceilometer_config('alarm/evaluation_service').with_value( params[:evaluation_service] )
-      should contain_ceilometer_config('alarm/partition_rpc_topic').with_value( params[:partition_rpc_topic] )
-      should contain_ceilometer_config('alarm/record_history').with_value( params[:record_history] )
-      should_not contain_ceilometer_config('coordination/backend_url')
+      is_expected.to contain_ceilometer_config('alarm/evaluation_interval').with_value( params[:evaluation_interval] )
+      is_expected.to contain_ceilometer_config('alarm/evaluation_service').with_value( params[:evaluation_service] )
+      is_expected.to contain_ceilometer_config('alarm/partition_rpc_topic').with_value( params[:partition_rpc_topic] )
+      is_expected.to contain_ceilometer_config('alarm/record_history').with_value( params[:record_history] )
+      is_expected.to_not contain_ceilometer_config('coordination/backend_url')
     end
 
     context 'when overriding parameters' do
@@ -49,11 +49,11 @@ describe 'ceilometer::alarm::evaluator' do
                       :evaluation_service  => 'ceilometer.alarm.service.SingletonTestAlarmService',
                       :coordination_url     => 'redis://localhost:6379')
       end
-      it { should contain_ceilometer_config('alarm/evaluation_interval').with_value(params[:evaluation_interval]) }
-      it { should contain_ceilometer_config('alarm/evaluation_service').with_value(params[:evaluation_service]) }
-      it { should contain_ceilometer_config('alarm/record_history').with_value(params[:record_history]) }
-      it { should contain_ceilometer_config('alarm/partition_rpc_topic').with_value(params[:partition_rpc_topic])  }
-      it { should contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url]) }
+      it { is_expected.to contain_ceilometer_config('alarm/evaluation_interval').with_value(params[:evaluation_interval]) }
+      it { is_expected.to contain_ceilometer_config('alarm/evaluation_service').with_value(params[:evaluation_service]) }
+      it { is_expected.to contain_ceilometer_config('alarm/record_history').with_value(params[:record_history]) }
+      it { is_expected.to contain_ceilometer_config('alarm/partition_rpc_topic').with_value(params[:partition_rpc_topic])  }
+      it { is_expected.to contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url]) }
     end
 
     context 'when override the evaluation interval with a non numeric value' do
@@ -61,7 +61,7 @@ describe 'ceilometer::alarm::evaluator' do
         params.merge!(:evaluation_interval => 'NaN')
       end
 
-      it { expect { should contain_ceilometer_config('alarm/evaluation_interval') }.to\
+      it { expect { is_expected.to contain_ceilometer_config('alarm/evaluation_interval') }.to\
         raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
     end
 
@@ -72,7 +72,7 @@ describe 'ceilometer::alarm::evaluator' do
         end
 
         it 'configures ceilometer-alarm-evaluator service' do
-          should contain_service('ceilometer-alarm-evaluator').with(
+          is_expected.to contain_service('ceilometer-alarm-evaluator').with(
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
             :name       => platform_params[:alarm_evaluator_service_name],
             :enable     => params[:enabled],
@@ -91,7 +91,7 @@ describe 'ceilometer::alarm::evaluator' do
       end
 
       it 'configures ceilometer-alarm-evaluator service' do
-        should contain_service('ceilometer-alarm-evaluator').with(
+        is_expected.to contain_service('ceilometer-alarm-evaluator').with(
           :ensure     => nil,
           :name       => platform_params[:alarm_evaluator_service_name],
           :enable     => false,
index d4e65a1e3af22a5effa633cea5f03852d2572ade..f0aa78c68065015c1ccfe490cf3dab7a9e19360d 100644 (file)
@@ -18,27 +18,27 @@ describe 'ceilometer::alarm::notifier' do
   end
 
   shared_examples_for 'ceilometer-alarm-notifier' do
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer-alarm package' do
-      should contain_package(platform_params[:alarm_notifier_package_name]).with_before('Service[ceilometer-alarm-notifier]')
-      should contain_package(platform_params[:alarm_notifier_package_name]).with(
+      is_expected.to contain_package(platform_params[:alarm_notifier_package_name]).with_before('Service[ceilometer-alarm-notifier]')
+      is_expected.to contain_package(platform_params[:alarm_notifier_package_name]).with(
         :ensure => 'present',
         :name   => platform_params[:alarm_notifier_package_name]
       )
     end
 
     it 'ensures ceilometer-common is installed before the service' do
-      should contain_package('ceilometer-common').with(
+      is_expected.to contain_package('ceilometer-common').with(
         :before => /Service\[ceilometer-alarm-notifier\]/
       )
     end
 
     it 'configures alarm notifier' do
-      should_not contain_ceilometer_config('alarm/notifier_rpc_topic')
-      should_not contain_ceilometer_config('alarm/rest_notifier_certificate_key')
-      should_not contain_ceilometer_config('alarm/rest_notifier_certificate_file')
-      should_not contain_ceilometer_config('alarm/rest_notifier_ssl_verify')
+      is_expected.to_not contain_ceilometer_config('alarm/notifier_rpc_topic')
+      is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_certificate_key')
+      is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_certificate_file')
+      is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_ssl_verify')
     end
 
     context 'when overriding parameters' do
@@ -48,10 +48,10 @@ describe 'ceilometer::alarm::notifier' do
                       :rest_notifier_certificate_file => '/var/file',
                       :rest_notifier_ssl_verify       => true)
       end
-      it { should contain_ceilometer_config('alarm/notifier_rpc_topic').with_value(params[:notifier_rpc_topic]) }
-      it { should contain_ceilometer_config('alarm/rest_notifier_certificate_key').with_value(params[:rest_notifier_certificate_key]) }
-      it { should contain_ceilometer_config('alarm/rest_notifier_certificate_file').with_value(params[:rest_notifier_certificate_file]) }
-      it { should contain_ceilometer_config('alarm/rest_notifier_ssl_verify').with_value(params[:rest_notifier_ssl_verify])  }
+      it { is_expected.to contain_ceilometer_config('alarm/notifier_rpc_topic').with_value(params[:notifier_rpc_topic]) }
+      it { is_expected.to contain_ceilometer_config('alarm/rest_notifier_certificate_key').with_value(params[:rest_notifier_certificate_key]) }
+      it { is_expected.to contain_ceilometer_config('alarm/rest_notifier_certificate_file').with_value(params[:rest_notifier_certificate_file]) }
+      it { is_expected.to contain_ceilometer_config('alarm/rest_notifier_ssl_verify').with_value(params[:rest_notifier_ssl_verify])  }
     end
 
     [{:enabled => true}, {:enabled => false}].each do |param_hash|
@@ -61,7 +61,7 @@ describe 'ceilometer::alarm::notifier' do
         end
 
         it 'configures ceilometer-alarm-notifier service' do
-          should contain_service('ceilometer-alarm-notifier').with(
+          is_expected.to contain_service('ceilometer-alarm-notifier').with(
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
             :name       => platform_params[:alarm_notifier_service_name],
             :enable     => params[:enabled],
@@ -80,7 +80,7 @@ describe 'ceilometer::alarm::notifier' do
       end
 
       it 'configures ceilometer-alarm-notifier service' do
-        should contain_service('ceilometer-alarm-notifier').with(
+        is_expected.to contain_service('ceilometer-alarm-notifier').with(
           :ensure     => nil,
           :name       => platform_params[:alarm_notifier_service_name],
           :enable     => false,
index c5538a6ccdd5c640871d5a71c73a2b2cb092bc0c..fc4cdefe51daf13b03b6ab2fcdcef4b8a279f00d 100644 (file)
@@ -25,37 +25,37 @@ describe 'ceilometer::api' do
 
     context 'without required parameter keystone_password' do
       before { params.delete(:keystone_password) }
-      it { expect { should raise_error(Puppet::Error) } }
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
     end
 
-    it { should contain_class('ceilometer::params') }
-    it { should contain_class('ceilometer::policy') }
+    it { is_expected.to contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::policy') }
 
     it 'installs ceilometer-api package' do
-      should contain_package('ceilometer-api').with(
+      is_expected.to contain_package('ceilometer-api').with(
         :ensure => 'latest',
         :name   => platform_params[:api_package_name]
       )
     end
 
     it 'configures keystone authentication middleware' do
-      should contain_ceilometer_config('keystone_authtoken/auth_host').with_value( params[:keystone_host] )
-      should contain_ceilometer_config('keystone_authtoken/auth_port').with_value( params[:keystone_port] )
-      should contain_ceilometer_config('keystone_authtoken/auth_protocol').with_value( params[:keystone_protocol] )
-      should contain_ceilometer_config('keystone_authtoken/admin_tenant_name').with_value( params[:keystone_tenant] )
-      should contain_ceilometer_config('keystone_authtoken/admin_user').with_value( params[:keystone_user] )
-      should contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] )
-      should contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] ).with_secret(true)
-      should contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
-      should contain_ceilometer_config('keystone_authtoken/auth_uri').with_value( params[:keystone_protocol] + "://" + params[:keystone_host] + ":5000/" )
-      should contain_ceilometer_config('api/host').with_value( params[:host] )
-      should contain_ceilometer_config('api/port').with_value( params[:port] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/auth_host').with_value( params[:keystone_host] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/auth_port').with_value( params[:keystone_port] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/auth_protocol').with_value( params[:keystone_protocol] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/admin_tenant_name').with_value( params[:keystone_tenant] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/admin_user').with_value( params[:keystone_user] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
+      is_expected.to contain_ceilometer_config('keystone_authtoken/auth_uri').with_value( params[:keystone_protocol] + "://" + params[:keystone_host] + ":5000/" )
+      is_expected.to contain_ceilometer_config('api/host').with_value( params[:host] )
+      is_expected.to contain_ceilometer_config('api/port').with_value( params[:port] )
     end
 
     context 'when specifying keystone_auth_admin_prefix' do
       describe 'with a correct value' do
         before { params['keystone_auth_admin_prefix'] = '/keystone/admin' }
-        it { should contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/admin') }
+        it { is_expected.to contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/admin') }
       end
 
       [
@@ -69,7 +69,7 @@ describe 'ceilometer::api' do
         describe "with an incorrect value #{auth_admin_prefix}" do
           before { params['keystone_auth_admin_prefix'] = auth_admin_prefix }
 
-          it { expect { should contain_ceilomete_config('keystone_authtoken/auth_admin_prefix') }.to \
+          it { expect { is_expected.to contain_ceilomete_config('keystone_authtoken/auth_admin_prefix') }.to \
             raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
         end
       end
@@ -82,7 +82,7 @@ describe 'ceilometer::api' do
         end
 
         it 'configures ceilometer-api service' do
-          should contain_service('ceilometer-api').with(
+          is_expected.to contain_service('ceilometer-api').with(
             :ensure     => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
             :name       => platform_params[:api_service_name],
             :enable     => params[:enabled],
@@ -103,7 +103,7 @@ describe 'ceilometer::api' do
       end
 
       it 'configures ceilometer-api service' do
-        should contain_service('ceilometer-api').with(
+        is_expected.to contain_service('ceilometer-api').with(
           :ensure     => nil,
           :name       => platform_params[:api_service_name],
           :enable     => false,
@@ -150,7 +150,7 @@ describe 'ceilometer::api' do
       })
     end
     it 'should configure custom auth_uri correctly' do
-      should contain_ceilometer_config('keystone_authtoken/auth_uri').with_value( 'https://foo.bar:1234/' )
+      is_expected.to contain_ceilometer_config('keystone_authtoken/auth_uri').with_value( 'https://foo.bar:1234/' )
     end
   end
 
index 777c931e9302f8417b0542a1f450212b255eafc8..4c9034aca36b4e660005b8ddf951b95f71d66464 100644 (file)
@@ -4,10 +4,10 @@ describe 'ceilometer::client' do
 
   shared_examples_for 'ceilometer client' do
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer client package' do
-      should contain_package('python-ceilometerclient').with(
+      is_expected.to contain_package('python-ceilometerclient').with(
         :ensure => 'present',
         :name   => platform_params[:client_package_name]
       )
index 72b5668f2e1e9aa6e4fb521f2dea73d6e5552cc6..314c61b94d54494ae251689fd339dd11d97dd271 100644 (file)
@@ -13,16 +13,16 @@ describe 'ceilometer::collector' do
         pre_condition << "class { 'ceilometer::db': }"
       end
 
-      it { should contain_class('ceilometer::params') }
+      it { is_expected.to contain_class('ceilometer::params') }
 
       it 'installs ceilometer-collector package' do
-        should contain_package(platform_params[:collector_package_name]).with(
+        is_expected.to contain_package(platform_params[:collector_package_name]).with(
           :ensure => 'present'
         )
       end
 
       it 'configures ceilometer-collector service' do
-        should contain_service('ceilometer-collector').with(
+        is_expected.to contain_service('ceilometer-collector').with(
           :ensure     => 'running',
           :name       => platform_params[:collector_service_name],
           :enable     => true,
@@ -32,8 +32,8 @@ describe 'ceilometer::collector' do
       end
 
       it 'configures relationships on database' do
-        should contain_class('ceilometer::db').with_before('Service[ceilometer-collector]')
-        should contain_exec('ceilometer-dbsync').with_notify('Service[ceilometer-collector]')
+        is_expected.to contain_class('ceilometer::db').with_before('Service[ceilometer-collector]')
+        is_expected.to contain_exec('ceilometer-dbsync').with_notify('Service[ceilometer-collector]')
       end
     end
 
@@ -43,10 +43,10 @@ describe 'ceilometer::collector' do
       end
 
       # Catalog compilation does not crash for lack of ceilometer::db
-      it { should compile }
+      it { is_expected.to compile }
 
       it 'configures ceilometer-collector service' do
-        should contain_service('ceilometer-collector').with(
+        is_expected.to contain_service('ceilometer-collector').with(
           :ensure     => 'stopped',
           :name       => platform_params[:collector_service_name],
           :enable     => false,
@@ -63,7 +63,7 @@ describe 'ceilometer::collector' do
       end
 
       it 'configures ceilometer-collector service' do
-        should contain_service('ceilometer-collector').with(
+        is_expected.to contain_service('ceilometer-collector').with(
           :ensure     => nil,
           :name       => platform_params[:collector_service_name],
           :enable     => false,
index 33e960356e021bc1f591845a1a0a759bdffc463e..44fdbba1e814822ff0779315a7625cde62e7368a 100644 (file)
@@ -11,8 +11,8 @@ describe 'ceilometer::config' do
   end
 
     it 'with [api] options ceilometer_config ' do
-      should contain_ceilometer_config('api/host').with_value('0.0.0.0')
-      should contain_ceilometer_config('api/port').with_value('8777')
+      is_expected.to contain_ceilometer_config('api/host').with_value('0.0.0.0')
+      is_expected.to contain_ceilometer_config('api/port').with_value('8777')
     end
 
   describe 'with [rpc_notifier2] options ceilometer_config' do
@@ -22,7 +22,7 @@ describe 'ceilometer::config' do
       })
     end
     it 'should configure rpc_notifier2 topics correctly' do
-      should contain_ceilometer_config('rpc_notifier2/topics').with_value('notifications')
+      is_expected.to contain_ceilometer_config('rpc_notifier2/topics').with_value('notifications')
     end
 
   end
index 5d32abad66ef511f8e7ad23429cb94576c39be61..a8015db3612e53acf3e5d5443e06563838de32ef 100644 (file)
@@ -20,11 +20,11 @@ describe 'ceilometer::db::mysql' do
 
     context 'when omiting the required parameter password' do
       before { params.delete(:password) }
-      it { expect { should raise_error(Puppet::Error) } }
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
     end
 
     it 'creates a mysql database' do
-      should contain_openstacklib__db__mysql( params[:dbname] ).with(
+      is_expected.to contain_openstacklib__db__mysql( params[:dbname] ).with(
         :user          => params[:user],
         :password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
         :host          => params[:host],
index 6478342d34612de32326805992f23d2738156175..dd84edbced0f27eeffd1a28f0e1e5d776406e06b 100644 (file)
@@ -24,7 +24,7 @@ describe 'ceilometer::db::postgresql' do
         req_params
       end
 
-      it { should contain_postgresql__server__db('ceilometer').with(
+      it { is_expected.to contain_postgresql__server__db('ceilometer').with(
         :user     => 'ceilometer',
         :password => 'md52899c518e96bce6633ab342b0ca38292'
       )}
@@ -47,7 +47,7 @@ describe 'ceilometer::db::postgresql' do
         req_params
       end
 
-      it { should contain_postgresql__server__db('ceilometer').with(
+      it { is_expected.to contain_postgresql__server__db('ceilometer').with(
         :user     => 'ceilometer',
         :password => 'md52899c518e96bce6633ab342b0ca38292'
       )}
index 8ba949280aac54d7cdea393f8a993342c02ddd76..190473159f4e9d0e11b1b4402f8c9a4c0a3a5ac2 100644 (file)
@@ -13,18 +13,18 @@ describe 'ceilometer::db' do
         :sync_db             => true }
     end
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs python-mongodb package' do
-      should contain_package('ceilometer-backend-package').with(
+      is_expected.to contain_package('ceilometer-backend-package').with(
         :ensure => 'present',
         :name => 'python-pymongo')
-      should contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer')
-      should contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer')
+      is_expected.to contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true)
     end
 
     it 'runs ceilometer-dbsync' do
-      should contain_exec('ceilometer-dbsync').with(
+      is_expected.to contain_exec('ceilometer-dbsync').with(
         :command     => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
         :path        => '/usr/bin',
         :refreshonly => 'true',
@@ -47,18 +47,18 @@ describe 'ceilometer::db' do
         :sync_db             => false }
     end
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs pymongo package' do
-      should contain_package('ceilometer-backend-package').with(
+      is_expected.to contain_package('ceilometer-backend-package').with(
         :ensure => 'present',
         :name => 'python-pymongo')
-      should contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer')
-      should contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer')
+      is_expected.to contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true)
     end
 
     it 'runs ceilometer-dbsync' do
-      should contain_exec('ceilometer-dbsync').with(
+      is_expected.to contain_exec('ceilometer-dbsync').with(
         :command     => '/bin/true',
         :path        => '/usr/bin',
         :refreshonly => 'true',
@@ -82,16 +82,16 @@ describe 'ceilometer::db' do
         :sync_db             => true }
     end
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs pymongo package' do
-      should contain_package('ceilometer-backend-package').with(
+      is_expected.to contain_package('ceilometer-backend-package').with(
         :ensure => 'present',
         :name => 'python-pymongo')
     end
 
     it 'runs ceilometer-dbsync' do
-      should contain_exec('ceilometer-dbsync').with(
+      is_expected.to contain_exec('ceilometer-dbsync').with(
         :command     => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
         :path        => '/usr/bin',
         :refreshonly => 'true',
@@ -115,15 +115,15 @@ describe 'ceilometer::db' do
         :sync_db             => false }
     end
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs pymongo package' do
-      should contain_ceilometer_config('database/connection').with_value('sqlite:///var/lib/ceilometer.db')
-      should contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('database/connection').with_value('sqlite:///var/lib/ceilometer.db')
+      is_expected.to contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true)
     end
 
     it 'runs ceilometer-dbsync' do
-      should contain_exec('ceilometer-dbsync').with(
+      is_expected.to contain_exec('ceilometer-dbsync').with(
         :command     => '/bin/true',
         :path        => '/usr/bin',
         :refreshonly => 'true',
@@ -144,16 +144,16 @@ describe 'ceilometer::db' do
         :sync_db             => true }
     end
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs python-mongodb package' do
-      should contain_package('ceilometer-backend-package').with(
+      is_expected.to contain_package('ceilometer-backend-package').with(
         :ensure => 'present',
         :name => 'python-pysqlite2')
     end
 
     it 'runs ceilometer-dbsync' do
-      should contain_exec('ceilometer-dbsync').with(
+      is_expected.to contain_exec('ceilometer-dbsync').with(
         :command     => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
         :path        => '/usr/bin',
         :refreshonly => 'true',
index 945c9f12225aafae5b263d4674190f8975a02480..1df2728630e8964170bf3db4957654202a931f87 100644 (file)
@@ -32,17 +32,17 @@ describe 'ceilometer::expirer' do
 
   shared_examples_for 'ceilometer-expirer' do
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'installs ceilometer common package' do
-      should contain_package('ceilometer-common').with(
+      is_expected.to contain_package('ceilometer-common').with(
         :ensure => 'present',
         :name   => platform_params[:common_package_name]
       )
     end
 
     it 'configures a cron' do
-      should contain_cron('ceilometer-expirer').with(
+      is_expected.to contain_cron('ceilometer-expirer').with(
         :command     => 'ceilometer-expirer',
         :environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
         :user        => 'ceilometer',
@@ -55,7 +55,7 @@ describe 'ceilometer::expirer' do
     end
 
     it 'configures database section in ceilometer.conf' do
-      should contain_ceilometer_config('database/time_to_live').with_value( params[:time_to_live] )
+      is_expected.to contain_ceilometer_config('database/time_to_live').with_value( params[:time_to_live] )
     end
 
   end
index 1da2e3200f68534e7cd041f3e8f9da32ce27bf6e..ca2c783d3d07adc6b97f32959e61f5b056a5aa29 100644 (file)
@@ -67,17 +67,17 @@ describe 'ceilometer' do
 
   shared_examples_for 'a ceilometer base installation' do
 
-    it { should contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('ceilometer::params') }
 
     it 'configures ceilometer group' do
-      should contain_group('ceilometer').with(
+      is_expected.to contain_group('ceilometer').with(
         :name    => 'ceilometer',
         :require => 'Package[ceilometer-common]'
       )
     end
 
     it 'configures ceilometer user' do
-      should contain_user('ceilometer').with(
+      is_expected.to contain_user('ceilometer').with(
         :name    => 'ceilometer',
         :gid     => 'ceilometer',
         :system  => true,
@@ -86,7 +86,7 @@ describe 'ceilometer' do
     end
 
     it 'configures ceilometer configuration folder' do
-      should contain_file('/etc/ceilometer/').with(
+      is_expected.to contain_file('/etc/ceilometer/').with(
         :ensure  => 'directory',
         :owner   => 'ceilometer',
         :group   => 'ceilometer',
@@ -96,7 +96,7 @@ describe 'ceilometer' do
     end
 
     it 'configures ceilometer configuration file' do
-      should contain_file('/etc/ceilometer/ceilometer.conf').with(
+      is_expected.to contain_file('/etc/ceilometer/ceilometer.conf').with(
         :owner   => 'ceilometer',
         :group   => 'ceilometer',
         :mode    => '0640',
@@ -105,50 +105,50 @@ describe 'ceilometer' do
     end
 
     it 'installs ceilometer common package' do
-      should contain_package('ceilometer-common').with(
+      is_expected.to contain_package('ceilometer-common').with(
         :ensure => 'present',
         :name   => platform_params[:common_package_name]
       )
     end
 
     it 'configures required metering_secret' do
-      should contain_ceilometer_config('publisher/metering_secret').with_value('metering-s3cr3t')
-      should contain_ceilometer_config('publisher/metering_secret').with_value( params[:metering_secret] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('publisher/metering_secret').with_value('metering-s3cr3t')
+      is_expected.to contain_ceilometer_config('publisher/metering_secret').with_value( params[:metering_secret] ).with_secret(true)
     end
 
     context 'without the required metering_secret' do
       before { params.delete(:metering_secret) }
-      it { expect { should raise_error(Puppet::Error) } }
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
     end
 
     it 'configures debug and verbosity' do
-      should contain_ceilometer_config('DEFAULT/debug').with_value( params[:debug] )
-      should contain_ceilometer_config('DEFAULT/verbose').with_value( params[:verbose] )
+      is_expected.to contain_ceilometer_config('DEFAULT/debug').with_value( params[:debug] )
+      is_expected.to contain_ceilometer_config('DEFAULT/verbose').with_value( params[:verbose] )
     end
 
     it 'configures logging directory by default' do
-      should contain_ceilometer_config('DEFAULT/log_dir').with_value( params[:log_dir] )
+      is_expected.to contain_ceilometer_config('DEFAULT/log_dir').with_value( params[:log_dir] )
     end
 
     context 'with logging directory disabled' do
       before { params.merge!( :log_dir => false) }
 
-      it { should contain_ceilometer_config('DEFAULT/log_dir').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/log_dir').with_ensure('absent') }
     end
 
     it 'configures notification_topics' do
-      should contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications')
+      is_expected.to contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications')
     end
 
     it 'configures syslog to be disabled by default' do
-      should contain_ceilometer_config('DEFAULT/use_syslog').with_value('false')
+      is_expected.to contain_ceilometer_config('DEFAULT/use_syslog').with_value('false')
     end
 
     context 'with syslog enabled' do
       before { params.merge!( :use_syslog => 'true' ) }
 
-      it { should contain_ceilometer_config('DEFAULT/use_syslog').with_value('true') }
-      it { should contain_ceilometer_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/use_syslog').with_value('true') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
     end
 
     context 'with syslog enabled and custom settings' do
@@ -157,15 +157,15 @@ describe 'ceilometer' do
        :log_facility => 'LOG_LOCAL0'
       ) }
 
-      it { should contain_ceilometer_config('DEFAULT/use_syslog').with_value('true') }
-      it { should contain_ceilometer_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/use_syslog').with_value('true') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
     end
 
     context 'with overriden notification_topics parameter' do
       before { params.merge!( :notification_topics => ['notifications', 'custom']) }
 
       it 'configures notification_topics' do
-        should contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications,custom')
+        is_expected.to contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications,custom')
       end
     end
   end
@@ -173,58 +173,58 @@ describe 'ceilometer' do
   shared_examples_for 'rabbit without HA support (with backward compatibility)' do
 
     it 'configures rabbit' do
-      should contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
-      should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
-      should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
-      should contain_ceilometer_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
     end
 
-    it { should contain_ceilometer_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_port').with_value( params[:rabbit_port] ) }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( "#{params[:rabbit_host]}:#{params[:rabbit_port]}" ) }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_ha_queues').with_value('false') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_port').with_value( params[:rabbit_port] ) }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( "#{params[:rabbit_host]}:#{params[:rabbit_port]}" ) }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_ha_queues').with_value('false') }
 
   end
 
   shared_examples_for 'rabbit without HA support (without backward compatibility)' do
 
     it 'configures rabbit' do
-      should contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
-      should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
-      should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
-      should contain_ceilometer_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
     end
 
-    it { should contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_ha_queues').with_value('false') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_ha_queues').with_value('false') }
 
   end
 
   shared_examples_for 'rabbit with HA support' do
 
     it 'configures rabbit' do
-      should contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
-      should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
-      should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
-      should contain_ceilometer_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] )
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
+      is_expected.to contain_ceilometer_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
     end
 
-    it { should contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
-    it { should contain_ceilometer_config('DEFAULT/rabbit_ha_queues').with_value('true') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
+    it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_ha_queues').with_value('true') }
 
   end
 
   shared_examples_for 'rabbit with SSL support' do
     context "with default parameters" do
-      it { should contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('false') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_version').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('false') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_version').with_ensure('absent') }
     end
 
     context "with SSL enabled with kombu" do
@@ -236,11 +236,11 @@ describe 'ceilometer' do
         :kombu_ssl_version  => 'TLSv1'
       ) }
 
-      it { should contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ca.crt') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/cert.crt') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/cert.key') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_value('/path/to/ca.crt') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_value('/path/to/cert.crt') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_value('/path/to/cert.key') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
     end
 
     context "with SSL enabled without kombu" do
@@ -248,11 +248,11 @@ describe 'ceilometer' do
         :rabbit_use_ssl     => 'true'
       ) }
 
-      it { should contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
-      it { should contain_ceilometer_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') }
     end
 
     context "with SSL wrongly configured" do
@@ -275,29 +275,29 @@ describe 'ceilometer' do
 
   shared_examples_for 'qpid support' do
     context("with default parameters") do
-      it { should contain_ceilometer_config('DEFAULT/qpid_reconnect').with_value(true) }
-      it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_heartbeat').with_value('60') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_protocol').with_value('tcp') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect').with_value(true) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_heartbeat').with_value('60') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_protocol').with_value('tcp') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
     end
 
     context("with mandatory parameters set") do
-      it { should contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_qpid') }
-      it { should contain_ceilometer_config('DEFAULT/qpid_hostname').with_value( params[:qpid_hostname] ) }
-      it { should contain_ceilometer_config('DEFAULT/qpid_port').with_value( params[:qpid_port] ) }
-      it { should contain_ceilometer_config('DEFAULT/qpid_username').with_value( params[:qpid_username]) }
-      it { should contain_ceilometer_config('DEFAULT/qpid_password').with_value(params[:qpid_password]) }
-      it { should contain_ceilometer_config('DEFAULT/qpid_password').with_value( params[:qpid_password] ).with_secret(true) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_qpid') }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_hostname').with_value( params[:qpid_hostname] ) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_port').with_value( params[:qpid_port] ) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_username').with_value( params[:qpid_username]) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_password').with_value(params[:qpid_password]) }
+      it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_password').with_value( params[:qpid_password] ).with_secret(true) }
     end
 
     context("failing if the rpc_backend is not present") do
       before { params.delete( :rpc_backend) }
-      it { expect { should raise_error(Puppet::Error) } }
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
     end
   end
 
index 1960d34c2d63b57e293173ead483b4d239747fbe..b01bb6f19b4f1800f8dabc5f08a13db0faac5487 100644 (file)
@@ -23,7 +23,7 @@ describe 'ceilometer::keystone::auth' do
   shared_examples_for 'ceilometer keystone auth' do
 
     context 'without the required password parameter' do
-      it { expect { should raise_error(Puppet::Error) } }
+      it { expect { is_expected.to raise_error(Puppet::Error) } }
     end
 
     let :params do
@@ -32,7 +32,7 @@ describe 'ceilometer::keystone::auth' do
 
     context 'with the required parameters' do
       it 'configures ceilometer user' do
-        should contain_keystone_user( default_params[:auth_name] ).with(
+        is_expected.to contain_keystone_user( default_params[:auth_name] ).with(
           :ensure   => 'present',
           :password => params[:password],
           :email    => default_params[:email],
@@ -41,14 +41,14 @@ describe 'ceilometer::keystone::auth' do
       end
 
       it 'configures ceilometer user roles' do
-        should contain_keystone_user_role("#{default_params[:auth_name]}@#{default_params[:tenant]}").with(
+        is_expected.to contain_keystone_user_role("#{default_params[:auth_name]}@#{default_params[:tenant]}").with(
           :ensure  => 'present',
           :roles   => ['admin','ResellerAdmin']
         )
       end
 
       it 'configures ceilometer service' do
-        should contain_keystone_service( default_params[:auth_name] ).with(
+        is_expected.to contain_keystone_service( default_params[:auth_name] ).with(
           :ensure      => 'present',
           :type        => default_params[:service_type],
           :description => 'Openstack Metering Service'
@@ -56,7 +56,7 @@ describe 'ceilometer::keystone::auth' do
       end
 
       it 'configure ceilometer endpoints' do
-        should contain_keystone_endpoint("#{default_params[:region]}/#{default_params[:auth_name]}").with(
+        is_expected.to contain_keystone_endpoint("#{default_params[:region]}/#{default_params[:auth_name]}").with(
           :ensure       => 'present',
           :public_url   => "#{default_params[:public_protocol]}://#{default_params[:public_address]}:#{default_params[:port]}",
           :admin_url    => "#{default_params[:admin_protocol]}://#{default_params[:admin_address]}:#{default_params[:port]}",
@@ -84,7 +84,7 @@ describe 'ceilometer::keystone::auth' do
       end
 
       it 'configures ceilometer user' do
-        should contain_keystone_user( params[:auth_name] ).with(
+        is_expected.to contain_keystone_user( params[:auth_name] ).with(
           :ensure   => 'present',
           :password => params[:password],
           :email    => params[:email],
@@ -93,14 +93,14 @@ describe 'ceilometer::keystone::auth' do
       end
 
       it 'configures ceilometer user roles' do
-        should contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
+        is_expected.to contain_keystone_user_role("#{params[:auth_name]}@#{params[:tenant]}").with(
           :ensure  => 'present',
           :roles   => ['admin','ResellerAdmin']
         )
       end
 
       it 'configures ceilometer service' do
-        should contain_keystone_service( params[:auth_name] ).with(
+        is_expected.to contain_keystone_service( params[:auth_name] ).with(
           :ensure      => 'present',
           :type        => params[:service_type],
           :description => 'Openstack Metering Service'
@@ -108,7 +108,7 @@ describe 'ceilometer::keystone::auth' do
       end
 
       it 'configure ceilometer endpoints' do
-        should contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
+        is_expected.to contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
           :ensure       => 'present',
           :public_url   => "#{params[:public_protocol]}://#{params[:public_address]}:#{params[:port]}",
           :admin_url    => "#{params[:admin_protocol]}://#{params[:admin_address]}:#{params[:port]}",
@@ -125,7 +125,7 @@ describe 'ceilometer::keystone::auth' do
           })
         end
         it 'configure ceilometer endpoints' do
-          should contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
+          is_expected.to contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}").with(
             :ensure       => 'present',
             :public_url   => params[:public_url],
             :admin_url    => params[:admin_url],
@@ -138,7 +138,7 @@ describe 'ceilometer::keystone::auth' do
         before do
           params.delete!(:configure_endpoint)
           it 'does not configure ceilometer endpoints' do
-            should_not contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}")
+            is_expected.to_not contain_keystone_endpoint("#{params[:region]}/#{params[:auth_name]}")
           end
         end
       end
@@ -151,16 +151,16 @@ describe 'ceilometer::keystone::auth' do
         })
       end
       it 'configures correct user name' do
-        should contain_keystone_user('ceilometer')
+        is_expected.to contain_keystone_user('ceilometer')
       end
       it 'configures correct user role' do
-        should contain_keystone_user_role('ceilometer@services')
+        is_expected.to contain_keystone_user_role('ceilometer@services')
       end
       it 'configures correct service name' do
-        should contain_keystone_service('ceilometer_service')
+        is_expected.to contain_keystone_service('ceilometer_service')
       end
       it 'configures correct endpoint name' do
-        should contain_keystone_endpoint('RegionOne/ceilometer_service')
+        is_expected.to contain_keystone_endpoint('RegionOne/ceilometer_service')
       end
     end
 
@@ -169,10 +169,10 @@ describe 'ceilometer::keystone::auth' do
         params.merge!( :configure_user => false )
       end
 
-      it { should_not contain_keystone_user('ceilometer') }
-      it { should contain_keystone_user_role('ceilometer@services') }
+      it { is_expected.to_not contain_keystone_user('ceilometer') }
+      it { is_expected.to contain_keystone_user_role('ceilometer@services') }
 
-      it { should contain_keystone_service('ceilometer').with(
+      it { is_expected.to contain_keystone_service('ceilometer').with(
         :ensure => 'present',
         :type        => 'metering',
         :description => 'Openstack Metering Service'
@@ -187,10 +187,10 @@ describe 'ceilometer::keystone::auth' do
         )
       end
 
-      it { should_not contain_keystone_user('ceilometer') }
-      it { should_not contain_keystone_user_role('ceilometer@services') }
+      it { is_expected.to_not contain_keystone_user('ceilometer') }
+      it { is_expected.to_not contain_keystone_user_role('ceilometer@services') }
 
-      it { should contain_keystone_service('ceilometer').with(
+      it { is_expected.to contain_keystone_service('ceilometer').with(
         :ensure => 'present',
         :type        => 'metering',
         :description => 'Openstack Metering Service'
index 7599ef26a33e0792c90c801575ff0b1b45de2209..5f204d5a7262a743b9d705b3119d4a2c2d476c17 100644 (file)
@@ -42,36 +42,36 @@ describe 'ceilometer::logging' do
 
   shared_examples_for 'logging params set' do
     it 'enables logging params' do
-      should contain_ceilometer_config('DEFAULT/logging_context_format_string').with_value(
+      is_expected.to contain_ceilometer_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_ceilometer_config('DEFAULT/logging_default_format_string').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/logging_default_format_string').with_value(
         '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
 
-      should contain_ceilometer_config('DEFAULT/logging_debug_format_suffix').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/logging_debug_format_suffix').with_value(
         '%(funcName)s %(pathname)s:%(lineno)d')
 
-      should contain_ceilometer_config('DEFAULT/logging_exception_prefix').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/logging_exception_prefix').with_value(
        '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
 
-      should contain_ceilometer_config('DEFAULT/log_config_append').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/log_config_append').with_value(
         '/etc/ceilometer/logging.conf')
-      should contain_ceilometer_config('DEFAULT/publish_errors').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/publish_errors').with_value(
         true)
 
-      should contain_ceilometer_config('DEFAULT/default_log_levels').with_value(
+      is_expected.to contain_ceilometer_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_ceilometer_config('DEFAULT/fatal_deprecations').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/fatal_deprecations').with_value(
         true)
 
-      should contain_ceilometer_config('DEFAULT/instance_format').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/instance_format').with_value(
         '[instance: %(uuid)s] ')
 
-      should contain_ceilometer_config('DEFAULT/instance_uuid_format').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/instance_uuid_format').with_value(
         '[instance: %(uuid)s] ')
 
-      should contain_ceilometer_config('DEFAULT/log_date_format').with_value(
+      is_expected.to contain_ceilometer_config('DEFAULT/log_date_format').with_value(
         '%Y-%m-%d %H:%M:%S')
     end
   end
@@ -84,7 +84,7 @@ describe 'ceilometer::logging' do
      :default_log_levels, :fatal_deprecations,
      :instance_format, :instance_uuid_format,
      :log_date_format, ].each { |param|
-        it { should contain_ceilometer_config("DEFAULT/#{param}").with_ensure('absent') }
+        it { is_expected.to contain_ceilometer_config("DEFAULT/#{param}").with_ensure('absent') }
       }
   end
 
index 79338dc3691626057da26b565f7220047d8a482e..46c0b189060e5b9da1222e15b66033d58178e9e0 100644 (file)
@@ -16,7 +16,7 @@ describe 'ceilometer::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'
       })
index 3613066d286956a897c585155194a3bf1db7de76..b7c689900913b61f1df87a1ce421b6a42f8479cf 100644 (file)
@@ -15,14 +15,14 @@ describe 'ceilometer::wsgi::apache' do
   end
 
   shared_examples_for 'apache serving ceilometer with mod_wsgi' do
-    it { should contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
-    it { should contain_class('ceilometer::params') }
-    it { should contain_class('apache') }
-    it { should contain_class('apache::mod::wsgi') }
+    it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
+    it { is_expected.to contain_class('ceilometer::params') }
+    it { is_expected.to contain_class('apache') }
+    it { is_expected.to contain_class('apache::mod::wsgi') }
 
     describe 'with default parameters' do
 
-      it { should contain_file("#{platform_parameters[:wsgi_script_path]}").with(
+      it { is_expected.to contain_file("#{platform_parameters[:wsgi_script_path]}").with(
         'ensure'  => 'directory',
         'owner'   => 'ceilometer',
         'group'   => 'ceilometer',
@@ -30,17 +30,17 @@ describe 'ceilometer::wsgi::apache' do
       )}
 
 
-      it { should contain_file('ceilometer_wsgi').with(
+      it { is_expected.to contain_file('ceilometer_wsgi').with(
         'ensure'  => 'file',
         'path'    => "#{platform_parameters[:wsgi_script_path]}/app",
         'source'  => platform_parameters[:wsgi_script_source],
         'owner'   => 'ceilometer',
         'group'   => 'ceilometer',
-        'mode'    => '0644',
-        'require' => ["File[#{platform_parameters[:wsgi_script_path]}]"]
+        'mode'    => '0644'
       )}
+      it { is_expected.to contain_file('ceilometer_wsgi').that_requires("File[#{platform_parameters[:wsgi_script_path]}]") }
 
-      it { should contain_apache__vhost('ceilometer_wsgi').with(
+      it { is_expected.to contain_apache__vhost('ceilometer_wsgi').with(
         'servername'                  => 'some.host.tld',
         'ip'                          => nil,
         'port'                        => '8777',
@@ -53,7 +53,7 @@ describe 'ceilometer::wsgi::apache' do
         'wsgi_script_aliases'         => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
         'require'                     => 'File[ceilometer_wsgi]'
       )}
-      it { should contain_file("#{platform_parameters[:httpd_ports_file]}") }
+      it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
     end
 
     describe 'when overriding parameters using different ports' do
@@ -67,7 +67,7 @@ describe 'ceilometer::wsgi::apache' do
         }
       end
 
-      it { should contain_apache__vhost('ceilometer_wsgi').with(
+      it { is_expected.to contain_apache__vhost('ceilometer_wsgi').with(
         'servername'                  => 'dummy.host',
         'ip'                          => '10.42.51.1',
         'port'                        => '12345',
@@ -81,7 +81,7 @@ describe 'ceilometer::wsgi::apache' do
         'require'                     => 'File[ceilometer_wsgi]'
       )}
 
-      it { should contain_file("#{platform_parameters[:httpd_ports_file]}") }
+      it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
     end
   end
 
index d92156a3618e079ee5ee5f1b86edca31c09bdee7..fec0eacc9826a60e94ab517f68ec7b21f9d36248 100644 (file)
@@ -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