Browse Source

Fix ignored unit test cases for nova::migration::libvirt

Change-Id: I6b1e8ad45d5e3f42529665616ae7cb28b3c27acb
(cherry picked from commit 079ab8d663)
(cherry picked from commit 50005cfa58)
(cherry picked from commit b7eff71306)
changes/20/758020/1
Takashi Kajinami 3 months ago
parent
commit
53620af2ca
1 changed files with 54 additions and 20 deletions
  1. +54
    -20
      spec/classes/nova_migration_libvirt_spec.rb

+ 54
- 20
spec/classes/nova_migration_libvirt_spec.rb View File

@@ -240,32 +240,60 @@ describe 'nova::migration::libvirt' do
end

shared_examples_for 'nova migration with libvirt in Debian' do
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(:line => 'libvirtd_opts="-l"') }
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(
:path => '/etc/default/libvirtd',
:line => 'libvirtd_opts="-l"',
:match => 'libvirtd_opts=',
:tag => 'libvirt-file_line',
) }
end

shared_examples_for 'nova migration with libvirt in RedHat' do
context 'with tls transport' do
let(:params) do
{ :transport => 'tls' }
end

it { is_expected.to contain_service('libvirtd-tls').with(
:name => 'libvirtd-tls.socket',
:ensure => 'running',
:enable => true,
)}
context 'with libvirt < 5.6' do
let :params do
{ :transport => 'tls',
:libvirt_version => '4.5' }
end

it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(
:path => '/etc/sysconfig/libvirtd',
:line => 'LIBVIRTD_ARGS="--listen"',
:match => '^LIBVIRTD_ARGS=',
:tag => 'libvirt-file_line',
)}
it { is_expected.to_not contain_service('libvirtd-tls') }
it { is_expected.to_not contain_service('libvirtd-tcp') }
end

context 'with tls transport' do
let(:params) do
{ :transport => 'tcp' }
context 'with libvirt >= 5.6' do

context 'with tls transport' do
let :params do
{ :transport => 'tls',
:libvirt_version => '5.6' }
end

it { is_expected.to_not contain_file_line('/etc/sysconfig/libvirtd libvirtd args') }
it { is_expected.to contain_service('libvirtd-tls').with(
:name => 'libvirtd-tls.socket',
:ensure => 'running',
:enable => true,
)}
end

it { is_expected.to contain_service('libvirtd-tcp').with(
:name => 'libvirtd-tcp.socket',
:ensure => 'running',
:enable => true,
)}
context 'with tcp transport' do
let :params do
{ :transport => 'tcp',
:libvirt_version => '5.6' }
end

it { is_expected.to_not contain_file_line('/etc/sysconfig/libvirtd libvirtd args') }
it { is_expected.to contain_service('libvirtd-tcp').with(
:name => 'libvirtd-tcp.socket',
:ensure => 'running',
:enable => true,
)}
end
end
end

@@ -277,7 +305,13 @@ describe 'nova::migration::libvirt' do
facts.merge!(OSDefaults.get_facts({ :os_workers => 5 }))
end

it_configures 'nova migration with libvirt'
it_behaves_like 'nova migration with libvirt'
case facts[:osfamily]
when 'Debian'
it_behaves_like 'nova migration with libvirt in Debian'
when 'RedHat'
it_behaves_like 'nova migration with libvirt in RedHat'
end
end
end
end

Loading…
Cancel
Save