Files
puppet-gnocchi/spec/classes/gnocchi_init_spec.rb
Takashi Kajinami 271ccb6103 Deprecate parameters under gnocchi::storage
coordination_url[1] and metric_processing_delay[2] under storage
section are both deprecated, so deprecate parameters under
gnocchi::storage and migrate these parameters to appropriate
classes, gnocchi and gnocchi::metricd .

[1] 70b9ca427b
[2] 72fdba704d
Change-Id: I88dff282df4ce477e543dd2fcf5052a9ac472b84
2020-03-20 22:06:53 +09:00

84 lines
2.2 KiB
Ruby

require 'spec_helper'
describe 'gnocchi' do
shared_examples 'gnocchi' do
context 'with default parameters' do
let :params do
{ :purge_config => false }
end
it 'contains the deps class' do
is_expected.to contain_class('gnocchi::deps')
end
it 'installs packages' do
is_expected.to contain_package('gnocchi').with(
:name => platform_params[:gnocchi_common_package],
:ensure => 'present',
:tag => ['openstack', 'gnocchi-package']
)
end
it 'passes purge to resource' do
is_expected.to contain_resources('gnocchi_config').with({
:purge => false
})
end
it 'does not configure coordination_url' do
is_expected.not_to contain_gnocchi_config('DEFAUTL/coordination_url')
is_expected.not_to contain_package('python-redis')
end
end
context 'with overriden parameters' do
let :params do
{ :purge_config => true,
:coordination_url => 'redis://localhost:6379', }
end
it 'purges gnocchi config' do
is_expected.to contain_resources('gnocchi_config').with({
:purge => true
})
end
it 'cnfigures coordination' do
is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('redis://localhost:6379')
is_expected.to contain_package('python-redis').with(
:name => platform_params[:redis_package_name],
:ensure => 'present',
:tag => 'openstack'
)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :gnocchi_common_package => 'gnocchi-common',
:redis_package_name => 'python3-redis'
}
when 'RedHat'
{ :gnocchi_common_package => 'gnocchi-common',
:redis_package_name => 'python-redis'
}
end
end
it_behaves_like 'gnocchi'
end
end
end