puppet-ceilometer/spec/classes/ceilometer_dispatcher_gnocchi_spec.rb
Emilien Macchi f47c52f26d Implement Gnocchi dispatcher
* Add dispatcher options to ceilometer::collector.
* Create ceilometer::dispatcher::gnocchi class, with current upstream options.
* Add an example of manifest.
* Unit & functional tests.

Note:
This patch implement os_service_defaults only for the new class.
For collector, it will be updated in one patch in another patchset.

Change-Id: Id9364e1e1337708b1e0254b4c6268f1a0b1a42ad
2015-12-01 11:45:04 -05:00

55 lines
2.1 KiB
Ruby

require 'spec_helper'
describe 'ceilometer::dispatcher::gnocchi' do
let :pre_condition do
"class { 'ceilometer': metering_secret => 's3cr3t' }"
end
let :params do
{}
end
shared_examples_for 'ceilometer-gnocchi-dispatcher' do
it 'configures gnocchi dispatcher' do
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_service_activity').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_project').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/archive_policy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/resources_definition_file').with_value('<SERVICE DEFAULT>')
end
context 'when overriding parameters' do
before do
params.merge!(:filter_service_activity => false,
:filter_project => true,
:url => 'http://foo',
:archive_policy => 'high',
:resources_definition_file => 'foo')
end
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_service_activity').with_value('false') }
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_project').with_value('true') }
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/url').with_value('http://foo') }
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/archive_policy').with_value('high') }
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/resources_definition_file').with_value('foo') }
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'ceilometer-gnocchi-dispatcher'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'ceilometer-gnocchi-dispatcher'
end
end