2018-06-21 14:19:13 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
require 'puppet/util/package'
|
|
|
|
describe 'nova::compute::libvirt_guests' do
|
|
|
|
|
|
|
|
shared_examples 'redhat-nova-compute-libvirt-guests' do
|
|
|
|
|
2022-06-01 14:54:21 +09:00
|
|
|
context 'with default parameters' do
|
2018-06-21 14:19:13 +02:00
|
|
|
|
|
|
|
it { is_expected.to contain_class('nova::params')}
|
|
|
|
|
2022-01-28 14:05:32 +01:00
|
|
|
it { is_expected.to contain_file('/etc/sysconfig/libvirt-guests').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:path => '/etc/sysconfig/libvirt-guests',
|
|
|
|
:tag => 'libvirt-guests-file',
|
|
|
|
) }
|
|
|
|
it { is_expected.to contain_file_line('/etc/sysconfig/libvirt-guests ON_BOOT').with(
|
|
|
|
:path => '/etc/sysconfig/libvirt-guests',
|
|
|
|
:line => 'ON_BOOT=ignore',
|
|
|
|
:tag => 'libvirt-guests-file_line'
|
|
|
|
) }
|
|
|
|
it { is_expected.to contain_file_line('/etc/sysconfig/libvirt-guests ON_SHUTDOWN').with(
|
|
|
|
:path => '/etc/sysconfig/libvirt-guests',
|
|
|
|
:line => "ON_SHUTDOWN=shutdown",
|
|
|
|
:tag => 'libvirt-guests-file_line'
|
|
|
|
) }
|
|
|
|
it { is_expected.to contain_file_line('/etc/sysconfig/libvirt-guests SHUTDOWN_TIMEOUT').with(
|
|
|
|
:path => '/etc/sysconfig/libvirt-guests',
|
|
|
|
:line => "SHUTDOWN_TIMEOUT=300",
|
|
|
|
:tag => 'libvirt-guests-file_line'
|
|
|
|
) }
|
2018-06-21 14:19:13 +02:00
|
|
|
|
|
|
|
it { is_expected.to contain_package('libvirt-guests').with(
|
|
|
|
:name => 'libvirt-client',
|
|
|
|
:ensure => 'present'
|
|
|
|
) }
|
|
|
|
|
2022-06-01 14:54:21 +09:00
|
|
|
it { is_expected.to_not contain_service('libvirt-guests')}
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with params' do
|
|
|
|
let :params do
|
|
|
|
{ :enabled=> true }
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to contain_package('libvirt-guests').with(
|
|
|
|
:name => 'libvirt-client',
|
|
|
|
:ensure => 'present'
|
|
|
|
) }
|
|
|
|
|
2018-06-21 14:19:13 +02:00
|
|
|
it { is_expected.to contain_service('libvirt-guests').with(
|
|
|
|
:name => 'libvirt-guests',
|
|
|
|
:enable => true,
|
|
|
|
:ensure => 'running',
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2019-10-22 10:57:05 +02:00
|
|
|
context 'while not managing service state' do
|
|
|
|
let :params do
|
2022-02-10 22:39:53 +09:00
|
|
|
{
|
|
|
|
:manage_service => false,
|
2019-10-22 10:57:05 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2022-02-10 22:39:53 +09:00
|
|
|
it { is_expected.to_not contain_service('libvirt-guests') }
|
2019-10-22 10:57:05 +02:00
|
|
|
end
|
|
|
|
|
2018-06-21 14:19:13 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
on_supported_os({
|
|
|
|
:supported_os => OSDefaults.get_supported_os
|
|
|
|
}).each do |os,facts|
|
|
|
|
context "on #{os}" do
|
|
|
|
|
|
|
|
case [:osfamily]
|
|
|
|
when 'RedHat'
|
|
|
|
it_behaves_like 'redhat-nova-compute-libvirt-guests'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|