| 1 |
# Unit tests for nova::compute::libvirt::virtstoraged class |
| 2 |
# |
| 3 |
require 'spec_helper' |
| 4 |
|
| 5 |
describe 'nova::compute::libvirt::virtstoraged' do |
| 6 |
|
| 7 |
shared_examples_for 'nova-compute-libvirt-virtstoraged' do |
| 8 |
|
| 9 |
context 'with default parameters' do |
| 10 |
let :params do |
| 11 |
{} |
| 12 |
end |
| 13 |
|
| 14 |
it { is_expected.to contain_class('nova::deps')} |
| 15 |
|
| 16 |
it { is_expected.to contain_virtstoraged_config('log_level').with_value('<SERVICE DEFAULT>')} |
| 17 |
it { is_expected.to contain_virtstoraged_config('log_outputs').with_value('<SERVICE DEFAULT>').with_quote(true)} |
| 18 |
it { is_expected.to contain_virtstoraged_config('log_filters').with_value('<SERVICE DEFAULT>').with_quote(true)} |
| 19 |
it { is_expected.to contain_virtstoraged_config('ovs_timeout').with_value('<SERVICE DEFAULT>')} |
| 20 |
end |
| 21 |
|
| 22 |
context 'with specified parameters' do |
| 23 |
let :params do |
| 24 |
{ :log_level => 3, |
| 25 |
:log_outputs => '3:syslog', |
| 26 |
:log_filters => '1:logging 4:object 4:json 4:event 1:util', |
| 27 |
:ovs_timeout => 10, |
| 28 |
} |
| 29 |
end |
| 30 |
|
| 31 |
it { is_expected.to contain_class('nova::deps')} |
| 32 |
|
| 33 |
it { is_expected.to contain_virtstoraged_config('log_level').with_value(params[:log_level])} |
| 34 |
it { is_expected.to contain_virtstoraged_config('log_outputs').with_value(params[:log_outputs]).with_quote(true)} |
| 35 |
it { is_expected.to contain_virtstoraged_config('log_filters').with_value(params[:log_filters]).with_quote(true)} |
| 36 |
it { is_expected.to contain_virtstoraged_config('ovs_timeout').with_value(params[:ovs_timeout])} |
| 37 |
end |
| 38 |
|
| 39 |
context 'with array values' do |
| 40 |
let :params do |
| 41 |
{ |
| 42 |
:log_outputs => ['3:syslog', '3:stderr'], |
| 43 |
:log_filters => ['1:logging', '4:object', '4:json', '4:event', '1:util'], |
| 44 |
} |
| 45 |
end |
| 46 |
|
| 47 |
it { is_expected.to contain_virtstoraged_config('log_outputs').with_value('3:syslog 3:stderr').with_quote(true)} |
| 48 |
it { is_expected.to contain_virtstoraged_config('log_filters').with_value('1:logging 4:object 4:json 4:event 1:util').with_quote(true)} |
| 49 |
end |
| 50 |
end |
| 51 |
|
| 52 |
on_supported_os({ |
| 53 |
:supported_os => OSDefaults.get_supported_os |
| 54 |
}).each do |os,facts| |
| 55 |
context "on #{os}" do |
| 56 |
let (:facts) do |
| 57 |
facts.merge!(OSDefaults.get_facts()) |
| 58 |
end |
| 59 |
|
| 60 |
it_configures 'nova-compute-libvirt-virtstoraged' |
| 61 |
end |
| 62 |
end |
| 63 |
|
| 64 |
end |