| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::compute::libvirt::networks' do |
| 4 |
|
| 5 |
shared_examples_for 'nova::compute::libvirt::networks' do |
| 6 |
|
| 7 |
context 'with defaults' do |
| 8 |
it { is_expected.to contain_exec('libvirt-default-net-disable-autostart').with( |
| 9 |
:command => 'virsh net-autostart default --disable', |
| 10 |
:path => ['/bin', '/usr/bin'], |
| 11 |
:onlyif => [ |
| 12 |
'virsh net-info default 2>/dev/null', |
| 13 |
'virsh net-info default 2>/dev/null | grep -i "^autostart:\s*yes"' |
| 14 |
] |
| 15 |
) } |
| 16 |
it { is_expected.to contain_exec('libvirt-default-net-destroy').with( |
| 17 |
:command => 'virsh net-destroy default', |
| 18 |
:path => ['/bin', '/usr/bin'], |
| 19 |
:onlyif => [ |
| 20 |
'virsh net-info default 2>/dev/null', |
| 21 |
'virsh net-info default 2>/dev/null | grep -i "^active:\s*yes"' |
| 22 |
] |
| 23 |
) } |
| 24 |
end |
| 25 |
|
| 26 |
context 'when not disabling the default network' do |
| 27 |
let :params do |
| 28 |
{ |
| 29 |
:disable_default_network => false |
| 30 |
} |
| 31 |
end |
| 32 |
it { is_expected.to_not contain_exec('libvirt-default-net-disable-autostart') } |
| 33 |
it { is_expected.to_not contain_exec('libvirt-default-net-destroy') } |
| 34 |
end |
| 35 |
end |
| 36 |
|
| 37 |
on_supported_os({ |
| 38 |
:supported_os => OSDefaults.get_supported_os |
| 39 |
}).each do |os,facts| |
| 40 |
context "on #{os}" do |
| 41 |
let (:facts) do |
| 42 |
facts.merge!(OSDefaults.get_facts()) |
| 43 |
end |
| 44 |
|
| 45 |
it_configures 'nova::compute::libvirt::networks' |
| 46 |
end |
| 47 |
end |
| 48 |
|
| 49 |
end |