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 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
This commit is contained in:
Sebastien Badia 2015-02-22 22:02:45 +01:00 committed by Gael Chamoulaud
parent 85c742cd83
commit 55b7aad8cf
21 changed files with 245 additions and 248 deletions

View File

@ -2,12 +2,9 @@ source 'https://rubygems.org'
group :development, :test do group :development, :test do
gem 'puppetlabs_spec_helper', :require => false gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 1.0.1' gem 'rspec-puppet', '~> 2.0.0'
gem 'puppet-lint-param-docs' gem 'puppet-lint-param-docs'
gem 'metadata-json-lint' gem 'metadata-json-lint'
gem 'puppet-syntax'
gem 'rake', '10.1.1'
gem 'rspec', '< 2.99'
gem 'json' gem 'json'
gem 'webmock' gem 'webmock'
end end

View File

@ -19,20 +19,20 @@ describe 'ceilometer::agent::auth' do
shared_examples_for 'ceilometer-agent-auth' do shared_examples_for 'ceilometer-agent-auth' do
it 'configures authentication' do it 'configures authentication' do
should contain_ceilometer_config('service_credentials/os_auth_url').with_value('http://localhost:5000/v2.0') is_expected.to 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') is_expected.to contain_ceilometer_config('service_credentials/os_region_name').with_value('RegionOne')
should contain_ceilometer_config('service_credentials/os_username').with_value('ceilometer') is_expected.to contain_ceilometer_config('service_credentials/os_username').with_value('ceilometer')
should contain_ceilometer_config('service_credentials/os_password').with_value('password') is_expected.to 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) is_expected.to 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') is_expected.to 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_cacert').with(:ensure => 'absent')
end end
context 'when overriding parameters' do context 'when overriding parameters' do
before do before do
params.merge!(:auth_cacert => '/tmp/dummy.pem') params.merge!(:auth_cacert => '/tmp/dummy.pem')
end 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
end end

View File

@ -16,10 +16,10 @@ describe 'ceilometer::agent::central' do
shared_examples_for '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 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', :ensure => 'latest',
:name => platform_params[:agent_package_name], :name => platform_params[:agent_package_name],
:before => 'Service[ceilometer-agent-central]' :before => 'Service[ceilometer-agent-central]'
@ -27,7 +27,7 @@ describe 'ceilometer::agent::central' do
end end
it 'ensures ceilometer-common is installed before the service' do 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\]/ :before => /Service\[ceilometer-agent-central\]/
) )
end end
@ -39,7 +39,7 @@ describe 'ceilometer::agent::central' do
end end
it 'configures ceilometer-agent-central service' do 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', :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:agent_service_name], :name => platform_params[:agent_service_name],
:enable => params[:enabled], :enable => params[:enabled],
@ -51,7 +51,7 @@ describe 'ceilometer::agent::central' do
end end
it 'configures central agent' do 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 end
context 'with disabled service managing' do context 'with disabled service managing' do
@ -62,7 +62,7 @@ describe 'ceilometer::agent::central' do
end end
it 'configures ceilometer-agent-central service' do 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, :ensure => nil,
:name => platform_params[:agent_service_name], :name => platform_params[:agent_service_name],
:enable => false, :enable => false,

View File

@ -16,10 +16,10 @@ describe 'ceilometer::agent::compute' do
shared_examples_for '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 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', :ensure => 'installed',
:name => platform_params[:agent_package_name], :name => platform_params[:agent_package_name],
:before => 'Service[ceilometer-agent-compute]' :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 it 'adds ceilometer user to nova group and, if required, to libvirt group' do
if platform_params[:libvirt_group] 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 else
should contain_user('ceilometer').with_groups('nova') is_expected.to contain_user('ceilometer').with_groups('nova')
end end
end end
it 'ensures ceilometer-common is installed before the service' do 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\]/ :before => /Service\[ceilometer-agent-compute\]/
) )
end end
it 'ensures nova-common is installed before the package ceilometer-common' do 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\]/ :before => /Package\[ceilometer-common\]/
) )
end end
it 'configures nova notification driver' do 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', :line => 'notification_driver=nova.openstack.common.notifier.rpc_notifier',
:path => '/etc/nova/nova.conf', :path => '/etc/nova/nova.conf',
:notify => 'Service[nova-compute]' :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', :line => 'notification_driver=ceilometer.compute.nova_notifier',
:path => '/etc/nova/nova.conf', :path => '/etc/nova/nova.conf',
:notify => 'Service[nova-compute]' :notify => 'Service[nova-compute]'
@ -67,7 +67,7 @@ describe 'ceilometer::agent::compute' do
it 'configures ceilometer-agent-compute service' 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', :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:agent_service_name], :name => platform_params[:agent_service_name],
:enable => params[:enabled], :enable => params[:enabled],
@ -86,7 +86,7 @@ describe 'ceilometer::agent::compute' do
end end
it 'configures ceilometer-agent-compute service' 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 => nil, :ensure => nil,
:name => platform_params[:agent_service_name], :name => platform_params[:agent_service_name],
:enable => false, :enable => false,

View File

@ -35,17 +35,17 @@ describe 'ceilometer::agent::notification' do
shared_examples_for '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 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' :ensure => 'present'
) )
end end
it 'configures notifications parameters in ceilometer.conf' do it 'configures notifications parameters in ceilometer.conf' do
should contain_ceilometer_config('notification/ack_on_event_error').with_value( params[:ack_on_event_error] ) is_expected.to 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/store_events').with_value( params[:store_events] )
end end
[{:enabled => true}, {:enabled => false}].each do |param_hash| [{:enabled => true}, {:enabled => false}].each do |param_hash|
@ -55,7 +55,7 @@ describe 'ceilometer::agent::notification' do
end end
it 'configures ceilometer agent notification service' do 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', :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:agent_notification_service_name], :name => platform_params[:agent_notification_service_name],
:enable => params[:enabled], :enable => params[:enabled],
@ -74,7 +74,7 @@ describe 'ceilometer::agent::notification' do
end end
it 'configures ceilometer-agent-notification service' do 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, :ensure => nil,
:name => platform_params[:agent_notification_service_name], :name => platform_params[:agent_notification_service_name],
:enable => false, :enable => false,

View File

@ -17,28 +17,28 @@ describe 'ceilometer::alarm::evaluator' do
end end
shared_examples_for 'ceilometer-alarm-evaluator' do 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 it 'installs ceilometer-alarm package' do
should 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_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(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:alarm_evaluator_package_name] :name => platform_params[:alarm_evaluator_package_name]
) )
end end
it 'ensures ceilometer-common is installed before the service' do 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\]/ :before => /Service\[ceilometer-alarm-evaluator\]/
) )
end end
it 'configures alarm evaluator' do it 'configures alarm evaluator' do
should contain_ceilometer_config('alarm/evaluation_interval').with_value( params[:evaluation_interval] ) is_expected.to contain_ceilometer_config('alarm/evaluation_interval').with_value( params[:evaluation_interval] )
should contain_ceilometer_config('alarm/evaluation_service').with_value( params[:evaluation_service] ) is_expected.to 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] ) is_expected.to 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] ) is_expected.to contain_ceilometer_config('alarm/record_history').with_value( params[:record_history] )
should_not contain_ceilometer_config('coordination/backend_url') is_expected.to_not contain_ceilometer_config('coordination/backend_url')
end end
context 'when overriding parameters' do context 'when overriding parameters' do
@ -49,11 +49,11 @@ describe 'ceilometer::alarm::evaluator' do
:evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService', :evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService',
:coordination_url => 'redis://localhost:6379') :coordination_url => 'redis://localhost:6379')
end end
it { should contain_ceilometer_config('alarm/evaluation_interval').with_value(params[:evaluation_interval]) } it { is_expected.to 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 { is_expected.to 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 { is_expected.to 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 { is_expected.to 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('coordination/backend_url').with_value( params[:coordination_url]) }
end end
context 'when override the evaluation interval with a non numeric value' do 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') params.merge!(:evaluation_interval => 'NaN')
end 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/) } raise_error(Puppet::Error, /validate_re\(\): .* does not match/) }
end end
@ -72,7 +72,7 @@ describe 'ceilometer::alarm::evaluator' do
end end
it 'configures ceilometer-alarm-evaluator service' do 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', :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:alarm_evaluator_service_name], :name => platform_params[:alarm_evaluator_service_name],
:enable => params[:enabled], :enable => params[:enabled],
@ -91,7 +91,7 @@ describe 'ceilometer::alarm::evaluator' do
end end
it 'configures ceilometer-alarm-evaluator service' do 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, :ensure => nil,
:name => platform_params[:alarm_evaluator_service_name], :name => platform_params[:alarm_evaluator_service_name],
:enable => false, :enable => false,

View File

@ -18,27 +18,27 @@ describe 'ceilometer::alarm::notifier' do
end end
shared_examples_for 'ceilometer-alarm-notifier' do 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 it 'installs ceilometer-alarm package' do
should 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_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(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:alarm_notifier_package_name] :name => platform_params[:alarm_notifier_package_name]
) )
end end
it 'ensures ceilometer-common is installed before the service' do 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\]/ :before => /Service\[ceilometer-alarm-notifier\]/
) )
end end
it 'configures alarm notifier' do it 'configures alarm notifier' do
should_not contain_ceilometer_config('alarm/notifier_rpc_topic') is_expected.to_not contain_ceilometer_config('alarm/notifier_rpc_topic')
should_not contain_ceilometer_config('alarm/rest_notifier_certificate_key') is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_certificate_key')
should_not contain_ceilometer_config('alarm/rest_notifier_certificate_file') is_expected.to_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/rest_notifier_ssl_verify')
end end
context 'when overriding parameters' do context 'when overriding parameters' do
@ -48,10 +48,10 @@ describe 'ceilometer::alarm::notifier' do
:rest_notifier_certificate_file => '/var/file', :rest_notifier_certificate_file => '/var/file',
:rest_notifier_ssl_verify => true) :rest_notifier_ssl_verify => true)
end end
it { should contain_ceilometer_config('alarm/notifier_rpc_topic').with_value(params[:notifier_rpc_topic]) } it { is_expected.to 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 { is_expected.to 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 { is_expected.to 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/rest_notifier_ssl_verify').with_value(params[:rest_notifier_ssl_verify]) }
end end
[{:enabled => true}, {:enabled => false}].each do |param_hash| [{:enabled => true}, {:enabled => false}].each do |param_hash|
@ -61,7 +61,7 @@ describe 'ceilometer::alarm::notifier' do
end end
it 'configures ceilometer-alarm-notifier service' do 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', :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:alarm_notifier_service_name], :name => platform_params[:alarm_notifier_service_name],
:enable => params[:enabled], :enable => params[:enabled],
@ -80,7 +80,7 @@ describe 'ceilometer::alarm::notifier' do
end end
it 'configures ceilometer-alarm-notifier service' do 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, :ensure => nil,
:name => platform_params[:alarm_notifier_service_name], :name => platform_params[:alarm_notifier_service_name],
:enable => false, :enable => false,

View File

@ -25,37 +25,37 @@ describe 'ceilometer::api' do
context 'without required parameter keystone_password' do context 'without required parameter keystone_password' do
before { params.delete(:keystone_password) } before { params.delete(:keystone_password) }
it { expect { should raise_error(Puppet::Error) } } it { expect { is_expected.to raise_error(Puppet::Error) } }
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it { should contain_class('ceilometer::policy') } it { is_expected.to contain_class('ceilometer::policy') }
it 'installs ceilometer-api package' do it 'installs ceilometer-api package' do
should contain_package('ceilometer-api').with( is_expected.to contain_package('ceilometer-api').with(
:ensure => 'latest', :ensure => 'latest',
:name => platform_params[:api_package_name] :name => platform_params[:api_package_name]
) )
end end
it 'configures keystone authentication middleware' do it 'configures keystone authentication middleware' do
should contain_ceilometer_config('keystone_authtoken/auth_host').with_value( params[:keystone_host] ) is_expected.to 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] ) is_expected.to 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] ) is_expected.to 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] ) is_expected.to 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] ) is_expected.to 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] ) is_expected.to 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) is_expected.to 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') is_expected.to 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/" ) is_expected.to 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] ) is_expected.to 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('api/port').with_value( params[:port] )
end end
context 'when specifying keystone_auth_admin_prefix' do context 'when specifying keystone_auth_admin_prefix' do
describe 'with a correct value' do describe 'with a correct value' do
before { params['keystone_auth_admin_prefix'] = '/keystone/admin' } 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 end
[ [
@ -69,7 +69,7 @@ describe 'ceilometer::api' do
describe "with an incorrect value #{auth_admin_prefix}" do describe "with an incorrect value #{auth_admin_prefix}" do
before { params['keystone_auth_admin_prefix'] = auth_admin_prefix } 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/) } raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
end end
end end
@ -82,7 +82,7 @@ describe 'ceilometer::api' do
end end
it 'configures ceilometer-api service' do 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', :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:api_service_name], :name => platform_params[:api_service_name],
:enable => params[:enabled], :enable => params[:enabled],
@ -103,7 +103,7 @@ describe 'ceilometer::api' do
end end
it 'configures ceilometer-api service' do it 'configures ceilometer-api service' do
should contain_service('ceilometer-api').with( is_expected.to contain_service('ceilometer-api').with(
:ensure => nil, :ensure => nil,
:name => platform_params[:api_service_name], :name => platform_params[:api_service_name],
:enable => false, :enable => false,
@ -150,7 +150,7 @@ describe 'ceilometer::api' do
}) })
end end
it 'should configure custom auth_uri correctly' do 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
end end

View File

@ -4,10 +4,10 @@ describe 'ceilometer::client' do
shared_examples_for '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 it 'installs ceilometer client package' do
should contain_package('python-ceilometerclient').with( is_expected.to contain_package('python-ceilometerclient').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:client_package_name] :name => platform_params[:client_package_name]
) )

View File

@ -13,16 +13,16 @@ describe 'ceilometer::collector' do
pre_condition << "class { 'ceilometer::db': }" pre_condition << "class { 'ceilometer::db': }"
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it 'installs ceilometer-collector package' do 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' :ensure => 'present'
) )
end end
it 'configures ceilometer-collector service' do it 'configures ceilometer-collector service' do
should contain_service('ceilometer-collector').with( is_expected.to contain_service('ceilometer-collector').with(
:ensure => 'running', :ensure => 'running',
:name => platform_params[:collector_service_name], :name => platform_params[:collector_service_name],
:enable => true, :enable => true,
@ -32,8 +32,8 @@ describe 'ceilometer::collector' do
end end
it 'configures relationships on database' do it 'configures relationships on database' do
should contain_class('ceilometer::db').with_before('Service[ceilometer-collector]') is_expected.to contain_class('ceilometer::db').with_before('Service[ceilometer-collector]')
should contain_exec('ceilometer-dbsync').with_notify('Service[ceilometer-collector]') is_expected.to contain_exec('ceilometer-dbsync').with_notify('Service[ceilometer-collector]')
end end
end end
@ -43,10 +43,10 @@ describe 'ceilometer::collector' do
end end
# Catalog compilation does not crash for lack of ceilometer::db # Catalog compilation does not crash for lack of ceilometer::db
it { should compile } it { is_expected.to compile }
it 'configures ceilometer-collector service' do it 'configures ceilometer-collector service' do
should contain_service('ceilometer-collector').with( is_expected.to contain_service('ceilometer-collector').with(
:ensure => 'stopped', :ensure => 'stopped',
:name => platform_params[:collector_service_name], :name => platform_params[:collector_service_name],
:enable => false, :enable => false,
@ -63,7 +63,7 @@ describe 'ceilometer::collector' do
end end
it 'configures ceilometer-collector service' do it 'configures ceilometer-collector service' do
should contain_service('ceilometer-collector').with( is_expected.to contain_service('ceilometer-collector').with(
:ensure => nil, :ensure => nil,
:name => platform_params[:collector_service_name], :name => platform_params[:collector_service_name],
:enable => false, :enable => false,

View File

@ -11,8 +11,8 @@ describe 'ceilometer::config' do
end end
it 'with [api] options ceilometer_config ' do it 'with [api] options ceilometer_config ' do
should contain_ceilometer_config('api/host').with_value('0.0.0.0') is_expected.to 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/port').with_value('8777')
end end
describe 'with [rpc_notifier2] options ceilometer_config' do describe 'with [rpc_notifier2] options ceilometer_config' do
@ -22,7 +22,7 @@ describe 'ceilometer::config' do
}) })
end end
it 'should configure rpc_notifier2 topics correctly' do 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
end end

View File

@ -20,11 +20,11 @@ describe 'ceilometer::db::mysql' do
context 'when omiting the required parameter password' do context 'when omiting the required parameter password' do
before { params.delete(:password) } before { params.delete(:password) }
it { expect { should raise_error(Puppet::Error) } } it { expect { is_expected.to raise_error(Puppet::Error) } }
end end
it 'creates a mysql database' do 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], :user => params[:user],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0', :password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:host => params[:host], :host => params[:host],

View File

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

View File

@ -13,18 +13,18 @@ describe 'ceilometer::db' do
:sync_db => true } :sync_db => true }
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it 'installs python-mongodb package' do it 'installs python-mongodb package' do
should contain_package('ceilometer-backend-package').with( is_expected.to contain_package('ceilometer-backend-package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pymongo') :name => 'python-pymongo')
should contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer') is_expected.to 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( params[:database_connection] ).with_secret(true)
end end
it 'runs ceilometer-dbsync' do 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', :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
:path => '/usr/bin', :path => '/usr/bin',
:refreshonly => 'true', :refreshonly => 'true',
@ -47,18 +47,18 @@ describe 'ceilometer::db' do
:sync_db => false } :sync_db => false }
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it 'installs pymongo package' do it 'installs pymongo package' do
should contain_package('ceilometer-backend-package').with( is_expected.to contain_package('ceilometer-backend-package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pymongo') :name => 'python-pymongo')
should contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer') is_expected.to 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( params[:database_connection] ).with_secret(true)
end end
it 'runs ceilometer-dbsync' do it 'runs ceilometer-dbsync' do
should contain_exec('ceilometer-dbsync').with( is_expected.to contain_exec('ceilometer-dbsync').with(
:command => '/bin/true', :command => '/bin/true',
:path => '/usr/bin', :path => '/usr/bin',
:refreshonly => 'true', :refreshonly => 'true',
@ -82,16 +82,16 @@ describe 'ceilometer::db' do
:sync_db => true } :sync_db => true }
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it 'installs pymongo package' do it 'installs pymongo package' do
should contain_package('ceilometer-backend-package').with( is_expected.to contain_package('ceilometer-backend-package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pymongo') :name => 'python-pymongo')
end end
it 'runs ceilometer-dbsync' do 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', :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
:path => '/usr/bin', :path => '/usr/bin',
:refreshonly => 'true', :refreshonly => 'true',
@ -115,15 +115,15 @@ describe 'ceilometer::db' do
:sync_db => false } :sync_db => false }
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it 'installs pymongo package' do it 'installs pymongo package' do
should contain_ceilometer_config('database/connection').with_value('sqlite:///var/lib/ceilometer.db') is_expected.to 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( params[:database_connection] ).with_secret(true)
end end
it 'runs ceilometer-dbsync' do it 'runs ceilometer-dbsync' do
should contain_exec('ceilometer-dbsync').with( is_expected.to contain_exec('ceilometer-dbsync').with(
:command => '/bin/true', :command => '/bin/true',
:path => '/usr/bin', :path => '/usr/bin',
:refreshonly => 'true', :refreshonly => 'true',
@ -144,16 +144,16 @@ describe 'ceilometer::db' do
:sync_db => true } :sync_db => true }
end end
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it 'installs python-mongodb package' do it 'installs python-mongodb package' do
should contain_package('ceilometer-backend-package').with( is_expected.to contain_package('ceilometer-backend-package').with(
:ensure => 'present', :ensure => 'present',
:name => 'python-pysqlite2') :name => 'python-pysqlite2')
end end
it 'runs ceilometer-dbsync' do 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', :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf',
:path => '/usr/bin', :path => '/usr/bin',
:refreshonly => 'true', :refreshonly => 'true',

View File

@ -32,17 +32,17 @@ describe 'ceilometer::expirer' do
shared_examples_for '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 it 'installs ceilometer common package' do
should contain_package('ceilometer-common').with( is_expected.to contain_package('ceilometer-common').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:common_package_name] :name => platform_params[:common_package_name]
) )
end end
it 'configures a cron' do it 'configures a cron' do
should contain_cron('ceilometer-expirer').with( is_expected.to contain_cron('ceilometer-expirer').with(
:command => 'ceilometer-expirer', :command => 'ceilometer-expirer',
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh', :environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
:user => 'ceilometer', :user => 'ceilometer',
@ -55,7 +55,7 @@ describe 'ceilometer::expirer' do
end end
it 'configures database section in ceilometer.conf' do 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
end end

View File

@ -67,17 +67,17 @@ describe 'ceilometer' do
shared_examples_for 'a ceilometer base installation' 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 it 'configures ceilometer group' do
should contain_group('ceilometer').with( is_expected.to contain_group('ceilometer').with(
:name => 'ceilometer', :name => 'ceilometer',
:require => 'Package[ceilometer-common]' :require => 'Package[ceilometer-common]'
) )
end end
it 'configures ceilometer user' do it 'configures ceilometer user' do
should contain_user('ceilometer').with( is_expected.to contain_user('ceilometer').with(
:name => 'ceilometer', :name => 'ceilometer',
:gid => 'ceilometer', :gid => 'ceilometer',
:system => true, :system => true,
@ -86,7 +86,7 @@ describe 'ceilometer' do
end end
it 'configures ceilometer configuration folder' do it 'configures ceilometer configuration folder' do
should contain_file('/etc/ceilometer/').with( is_expected.to contain_file('/etc/ceilometer/').with(
:ensure => 'directory', :ensure => 'directory',
:owner => 'ceilometer', :owner => 'ceilometer',
:group => 'ceilometer', :group => 'ceilometer',
@ -96,7 +96,7 @@ describe 'ceilometer' do
end end
it 'configures ceilometer configuration file' do 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', :owner => 'ceilometer',
:group => 'ceilometer', :group => 'ceilometer',
:mode => '0640', :mode => '0640',
@ -105,50 +105,50 @@ describe 'ceilometer' do
end end
it 'installs ceilometer common package' do it 'installs ceilometer common package' do
should contain_package('ceilometer-common').with( is_expected.to contain_package('ceilometer-common').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:common_package_name] :name => platform_params[:common_package_name]
) )
end end
it 'configures required metering_secret' do it 'configures required metering_secret' do
should contain_ceilometer_config('publisher/metering_secret').with_value('metering-s3cr3t') is_expected.to 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( params[:metering_secret] ).with_secret(true)
end end
context 'without the required metering_secret' do context 'without the required metering_secret' do
before { params.delete(:metering_secret) } before { params.delete(:metering_secret) }
it { expect { should raise_error(Puppet::Error) } } it { expect { is_expected.to raise_error(Puppet::Error) } }
end end
it 'configures debug and verbosity' do it 'configures debug and verbosity' do
should contain_ceilometer_config('DEFAULT/debug').with_value( params[:debug] ) is_expected.to 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/verbose').with_value( params[:verbose] )
end end
it 'configures logging directory by default' do 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 end
context 'with logging directory disabled' do context 'with logging directory disabled' do
before { params.merge!( :log_dir => false) } 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 end
it 'configures notification_topics' do 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 end
it 'configures syslog to be disabled by default' do 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 end
context 'with syslog enabled' do context 'with syslog enabled' do
before { params.merge!( :use_syslog => 'true' ) } before { params.merge!( :use_syslog => 'true' ) }
it { should contain_ceilometer_config('DEFAULT/use_syslog').with_value('true') } it { is_expected.to 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/syslog_log_facility').with_value('LOG_USER') }
end end
context 'with syslog enabled and custom settings' do context 'with syslog enabled and custom settings' do
@ -157,15 +157,15 @@ describe 'ceilometer' do
:log_facility => 'LOG_LOCAL0' :log_facility => 'LOG_LOCAL0'
) } ) }
it { should contain_ceilometer_config('DEFAULT/use_syslog').with_value('true') } it { is_expected.to 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/syslog_log_facility').with_value('LOG_LOCAL0') }
end end
context 'with overriden notification_topics parameter' do context 'with overriden notification_topics parameter' do
before { params.merge!( :notification_topics => ['notifications', 'custom']) } before { params.merge!( :notification_topics => ['notifications', 'custom']) }
it 'configures notification_topics' do 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 end
end end
@ -173,58 +173,58 @@ describe 'ceilometer' do
shared_examples_for 'rabbit without HA support (with backward compatibility)' do shared_examples_for 'rabbit without HA support (with backward compatibility)' do
it 'configures rabbit' do it 'configures rabbit' do
should contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] ) is_expected.to contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
should 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] )
should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true) is_expected.to 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_virtual_host').with_value( params[:rabbit_virtual_host] )
end end
it { should contain_ceilometer_config('DEFAULT/rabbit_host').with_value( params[:rabbit_host] ) } it { is_expected.to 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 { is_expected.to 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 { is_expected.to 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_ha_queues').with_value('false') }
end end
shared_examples_for 'rabbit without HA support (without backward compatibility)' do shared_examples_for 'rabbit without HA support (without backward compatibility)' do
it 'configures rabbit' do it 'configures rabbit' do
should contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] ) is_expected.to contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
should 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] )
should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true) is_expected.to 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_virtual_host').with_value( params[:rabbit_virtual_host] )
end end
it { should contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) } it { is_expected.to 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_ha_queues').with_value('false') }
end end
shared_examples_for 'rabbit with HA support' do shared_examples_for 'rabbit with HA support' do
it 'configures rabbit' do it 'configures rabbit' do
should contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] ) is_expected.to contain_ceilometer_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_userid] )
should 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] )
should contain_ceilometer_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true) is_expected.to 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_virtual_host').with_value( params[:rabbit_virtual_host] )
end end
it { should contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_host').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_port').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) } it { is_expected.to 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_ha_queues').with_value('true') }
end end
shared_examples_for 'rabbit with SSL support' do shared_examples_for 'rabbit with SSL support' do
context "with default parameters" do context "with default parameters" do
it { should contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('false') } it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('false') }
it { should contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') } it { is_expected.to 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/kombu_ssl_version').with_ensure('absent') }
end end
context "with SSL enabled with kombu" do context "with SSL enabled with kombu" do
@ -236,11 +236,11 @@ describe 'ceilometer' do
:kombu_ssl_version => 'TLSv1' :kombu_ssl_version => 'TLSv1'
) } ) }
it { should contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') } it { is_expected.to 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 { is_expected.to 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 { is_expected.to 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 { is_expected.to 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/kombu_ssl_version').with_value('TLSv1') }
end end
context "with SSL enabled without kombu" do context "with SSL enabled without kombu" do
@ -248,11 +248,11 @@ describe 'ceilometer' do
:rabbit_use_ssl => 'true' :rabbit_use_ssl => 'true'
) } ) }
it { should contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') } it { is_expected.to contain_ceilometer_config('DEFAULT/rabbit_use_ssl').with_value('true') }
it { should contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') } it { is_expected.to contain_ceilometer_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') }
it { should contain_ceilometer_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') } it { is_expected.to 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/kombu_ssl_version').with_value('TLSv1') }
end end
context "with SSL wrongly configured" do context "with SSL wrongly configured" do
@ -275,29 +275,29 @@ describe 'ceilometer' do
shared_examples_for 'qpid support' do shared_examples_for 'qpid support' do
context("with default parameters") do context("with default parameters") do
it { should contain_ceilometer_config('DEFAULT/qpid_reconnect').with_value(true) } it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect').with_value(true) }
it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_timeout').with_value('0') } it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_limit').with_value('0') } it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') } it { is_expected.to 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 { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { should contain_ceilometer_config('DEFAULT/qpid_reconnect_interval').with_value('0') } it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { should contain_ceilometer_config('DEFAULT/qpid_heartbeat').with_value('60') } it { is_expected.to contain_ceilometer_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { should contain_ceilometer_config('DEFAULT/qpid_protocol').with_value('tcp') } it { is_expected.to 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_tcp_nodelay').with_value(true) }
end end
context("with mandatory parameters set") do context("with mandatory parameters set") do
it { should contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_qpid') } it { is_expected.to 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 { is_expected.to 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 { is_expected.to 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 { is_expected.to 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 { is_expected.to 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/qpid_password').with_value( params[:qpid_password] ).with_secret(true) }
end end
context("failing if the rpc_backend is not present") do context("failing if the rpc_backend is not present") do
before { params.delete( :rpc_backend) } before { params.delete( :rpc_backend) }
it { expect { should raise_error(Puppet::Error) } } it { expect { is_expected.to raise_error(Puppet::Error) } }
end end
end end

View File

@ -23,7 +23,7 @@ describe 'ceilometer::keystone::auth' do
shared_examples_for 'ceilometer keystone auth' do shared_examples_for 'ceilometer keystone auth' do
context 'without the required password parameter' 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 end
let :params do let :params do
@ -32,7 +32,7 @@ describe 'ceilometer::keystone::auth' do
context 'with the required parameters' do context 'with the required parameters' do
it 'configures ceilometer user' 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', :ensure => 'present',
:password => params[:password], :password => params[:password],
:email => default_params[:email], :email => default_params[:email],
@ -41,14 +41,14 @@ describe 'ceilometer::keystone::auth' do
end end
it 'configures ceilometer user roles' do 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', :ensure => 'present',
:roles => ['admin','ResellerAdmin'] :roles => ['admin','ResellerAdmin']
) )
end end
it 'configures ceilometer service' do 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', :ensure => 'present',
:type => default_params[:service_type], :type => default_params[:service_type],
:description => 'Openstack Metering Service' :description => 'Openstack Metering Service'
@ -56,7 +56,7 @@ describe 'ceilometer::keystone::auth' do
end end
it 'configure ceilometer endpoints' do 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', :ensure => 'present',
:public_url => "#{default_params[:public_protocol]}://#{default_params[:public_address]}:#{default_params[:port]}", :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]}", :admin_url => "#{default_params[:admin_protocol]}://#{default_params[:admin_address]}:#{default_params[:port]}",
@ -84,7 +84,7 @@ describe 'ceilometer::keystone::auth' do
end end
it 'configures ceilometer user' do 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', :ensure => 'present',
:password => params[:password], :password => params[:password],
:email => params[:email], :email => params[:email],
@ -93,14 +93,14 @@ describe 'ceilometer::keystone::auth' do
end end
it 'configures ceilometer user roles' do 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', :ensure => 'present',
:roles => ['admin','ResellerAdmin'] :roles => ['admin','ResellerAdmin']
) )
end end
it 'configures ceilometer service' do 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', :ensure => 'present',
:type => params[:service_type], :type => params[:service_type],
:description => 'Openstack Metering Service' :description => 'Openstack Metering Service'
@ -108,7 +108,7 @@ describe 'ceilometer::keystone::auth' do
end end
it 'configure ceilometer endpoints' do 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', :ensure => 'present',
:public_url => "#{params[:public_protocol]}://#{params[:public_address]}:#{params[:port]}", :public_url => "#{params[:public_protocol]}://#{params[:public_address]}:#{params[:port]}",
:admin_url => "#{params[:admin_protocol]}://#{params[:admin_address]}:#{params[:port]}", :admin_url => "#{params[:admin_protocol]}://#{params[:admin_address]}:#{params[:port]}",
@ -125,7 +125,7 @@ describe 'ceilometer::keystone::auth' do
}) })
end end
it 'configure ceilometer endpoints' do 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', :ensure => 'present',
:public_url => params[:public_url], :public_url => params[:public_url],
:admin_url => params[:admin_url], :admin_url => params[:admin_url],
@ -138,7 +138,7 @@ describe 'ceilometer::keystone::auth' do
before do before do
params.delete!(:configure_endpoint) params.delete!(:configure_endpoint)
it 'does not configure ceilometer endpoints' do 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 end
end end
@ -151,16 +151,16 @@ describe 'ceilometer::keystone::auth' do
}) })
end end
it 'configures correct user name' do it 'configures correct user name' do
should contain_keystone_user('ceilometer') is_expected.to contain_keystone_user('ceilometer')
end end
it 'configures correct user role' do it 'configures correct user role' do
should contain_keystone_user_role('ceilometer@services') is_expected.to contain_keystone_user_role('ceilometer@services')
end end
it 'configures correct service name' do it 'configures correct service name' do
should contain_keystone_service('ceilometer_service') is_expected.to contain_keystone_service('ceilometer_service')
end end
it 'configures correct endpoint name' do it 'configures correct endpoint name' do
should contain_keystone_endpoint('RegionOne/ceilometer_service') is_expected.to contain_keystone_endpoint('RegionOne/ceilometer_service')
end end
end end
@ -169,10 +169,10 @@ describe 'ceilometer::keystone::auth' do
params.merge!( :configure_user => false ) params.merge!( :configure_user => false )
end end
it { should_not contain_keystone_user('ceilometer') } it { is_expected.to_not contain_keystone_user('ceilometer') }
it { should contain_keystone_user_role('ceilometer@services') } 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', :ensure => 'present',
:type => 'metering', :type => 'metering',
:description => 'Openstack Metering Service' :description => 'Openstack Metering Service'
@ -187,10 +187,10 @@ describe 'ceilometer::keystone::auth' do
) )
end end
it { should_not contain_keystone_user('ceilometer') } it { is_expected.to_not contain_keystone_user('ceilometer') }
it { should_not contain_keystone_user_role('ceilometer@services') } 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', :ensure => 'present',
:type => 'metering', :type => 'metering',
:description => 'Openstack Metering Service' :description => 'Openstack Metering Service'

View File

@ -42,36 +42,36 @@ describe 'ceilometer::logging' do
shared_examples_for 'logging params set' do shared_examples_for 'logging params set' do
it 'enables logging params' do it 'enables logging params' do
should contain_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') '%(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') '%(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') '%(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') '%(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') '/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) 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') '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) true)
should contain_ceilometer_config('DEFAULT/instance_format').with_value( is_expected.to contain_ceilometer_config('DEFAULT/instance_format').with_value(
'[instance: %(uuid)s] ') '[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] ') '[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') '%Y-%m-%d %H:%M:%S')
end end
end end
@ -84,7 +84,7 @@ describe 'ceilometer::logging' do
:default_log_levels, :fatal_deprecations, :default_log_levels, :fatal_deprecations,
:instance_format, :instance_uuid_format, :instance_format, :instance_uuid_format,
:log_date_format, ].each { |param| :log_date_format, ].each { |param|
it { should contain_ceilometer_config("DEFAULT/#{param}").with_ensure('absent') } it { is_expected.to contain_ceilometer_config("DEFAULT/#{param}").with_ensure('absent') }
} }
end end

View File

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

View File

@ -15,14 +15,14 @@ describe 'ceilometer::wsgi::apache' do
end end
shared_examples_for 'apache serving ceilometer with mod_wsgi' do shared_examples_for 'apache serving ceilometer with mod_wsgi' do
it { should contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) } it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
it { should contain_class('ceilometer::params') } it { is_expected.to contain_class('ceilometer::params') }
it { should contain_class('apache') } it { is_expected.to contain_class('apache') }
it { should contain_class('apache::mod::wsgi') } it { is_expected.to contain_class('apache::mod::wsgi') }
describe 'with default parameters' do 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', 'ensure' => 'directory',
'owner' => 'ceilometer', 'owner' => 'ceilometer',
'group' => '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', 'ensure' => 'file',
'path' => "#{platform_parameters[:wsgi_script_path]}/app", 'path' => "#{platform_parameters[:wsgi_script_path]}/app",
'source' => platform_parameters[:wsgi_script_source], 'source' => platform_parameters[:wsgi_script_source],
'owner' => 'ceilometer', 'owner' => 'ceilometer',
'group' => 'ceilometer', 'group' => 'ceilometer',
'mode' => '0644', 'mode' => '0644'
'require' => ["File[#{platform_parameters[:wsgi_script_path]}]"]
)} )}
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', 'servername' => 'some.host.tld',
'ip' => nil, 'ip' => nil,
'port' => '8777', 'port' => '8777',
@ -53,7 +53,7 @@ describe 'ceilometer::wsgi::apache' do
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" }, 'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'require' => 'File[ceilometer_wsgi]' '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
describe 'when overriding parameters using different ports' do describe 'when overriding parameters using different ports' do
@ -67,7 +67,7 @@ describe 'ceilometer::wsgi::apache' do
} }
end end
it { should contain_apache__vhost('ceilometer_wsgi').with( it { is_expected.to contain_apache__vhost('ceilometer_wsgi').with(
'servername' => 'dummy.host', 'servername' => 'dummy.host',
'ip' => '10.42.51.1', 'ip' => '10.42.51.1',
'port' => '12345', 'port' => '12345',
@ -81,7 +81,7 @@ describe 'ceilometer::wsgi::apache' do
'require' => 'File[ceilometer_wsgi]' '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
end end

View File

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