puppet-magnum/spec/classes/magnum_conductor_spec.rb
Jake Yip 3a9c564885 Only manage service if manage_service is set
For magnum::api, the service is not managed by puppet when
manage_service is false. This should be the correct/intuitive behaviour.

Set magnum::conductor to be the same.

Change-Id: I190035142db4743128b73246a5886e12e8b4808f
2021-06-26 15:21:07 +00:00

81 lines
2.1 KiB
Ruby

#
# Unit tests for magnum::conductor
#
require 'spec_helper'
describe 'magnum::conductor' do
let :pre_condition do
['class { "magnum::keystone::authtoken": password => "secret", }',
'class { "magnum::keystone::keystone_auth": password => "secret", }',
]
end
shared_examples_for 'magnum-conductor' do
it { is_expected.to contain_package('magnum-conductor').with(
:name => platform_params[:conductor_package],
:ensure => 'present'
) }
it { is_expected.to contain_service('magnum-conductor').with(
:name => platform_params[:conductor_service],
:hasstatus => 'true',
:ensure => 'running'
) }
it {
is_expected.to contain_magnum_config('conductor/conductor_life_check_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('conductor/workers').with_value(facts[:os_workers])
}
context 'with conductor_life_check_timeout specified' do
let :params do
{ :conductor_life_check_timeout => '4' }
end
it { is_expected.to contain_magnum_config('conductor/conductor_life_check_timeout').with_value('4') }
end
context 'with manage_service as false' do
let :params do
{ :enabled => true,
:manage_service => false
}
end
it { is_expected.not_to contain_service('magnum-conductor') }
end
context 'with workers specified' do
let :params do
{ :workers => 10 }
end
it { is_expected.to contain_magnum_config('conductor/workers').with_value(10) }
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
if facts[:osfamily] == 'Debian'
{ :conductor_package => 'magnum-conductor',
:conductor_service => 'magnum-conductor' }
else
{ :conductor_package => 'openstack-magnum-conductor',
:conductor_service => 'openstack-magnum-conductor' }
end
end
it_configures 'magnum-conductor'
end
end
end