Files
puppet-gnocchi/spec/classes/gnocchi_init_spec.rb
ZhongShengping 654cd9c862 Add hooks for external install & svc management
This adds defined anchor points for external modules to hook into the
software install, config and service dependency chain.  This allows
external modules to manage software installation (virtualenv,
containers, etc) and service management (pacemaker) without needing rely
on resources that may change or be renamed.

Change-Id: Idc43b06eab3f7103392da699e2a77bb55ce7344d
2016-12-05 11:44:08 +08:00

55 lines
1.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 logging class' do
is_expected.to contain_class('gnocchi::deps')
is_expected.to contain_class('gnocchi::logging')
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
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' }
when 'RedHat'
{ :gnocchi_common_package => 'openstack-gnocchi-common' }
end
end
it_behaves_like 'gnocchi'
end
end
end