Browse Source

Merge "Fix ignored test cases for nova::compute::libvirt"

tags/17.4.0
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
d66a4fe877
2 changed files with 18 additions and 53 deletions
  1. +1
    -1
      manifests/compute/libvirt.pp
  2. +17
    -52
      spec/classes/nova_compute_libvirt_spec.rb

+ 1
- 1
manifests/compute/libvirt.pp View File

@@ -361,7 +361,7 @@ class nova::compute::libvirt (
}
}

if $libvirt_cpu_mode_real != 'none' {
if $libvirt_cpu_mode_real != 'none' and $libvirt_cpu_model_extra_flags {
validate_legacy(String, 'validate_string', $libvirt_cpu_model_extra_flags)
nova_config {
'libvirt/cpu_model_extra_flags': value => $libvirt_cpu_model_extra_flags;


+ 17
- 52
spec/classes/nova_compute_libvirt_spec.rb View File

@@ -14,9 +14,7 @@ describe 'nova::compute::libvirt' do
describe 'with default parameters' do

let :params do
{
:libvirt_cpu_model_extra_flags => 'pcid,pdpe1gb',
}
{}
end

it { is_expected.to contain_class('nova::params')}
@@ -32,7 +30,7 @@ describe 'nova::compute::libvirt' do

it {
is_expected.to contain_package('libvirt').with(
:name => 'libvirtd',
:name => 'libvirt-bin',
:ensure => 'present'
)
is_expected.to contain_package('libvirt').that_requires('Anchor[nova::install::begin]')
@@ -52,8 +50,8 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('kvm')}
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-model')}
it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_ensure('pcid,pdpe1gb')}
it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/disk_cachemodes').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/inject_password').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/inject_key').with_value(false)}
@@ -65,13 +63,13 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/rx_queue_size').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/tx_queue_size').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_ensure('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/pmem_namespaces').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_libvirtd_config('log_outputs').with_ensure('absent')}
it { is_expected.to contain_libvirtd_config('log_filters').with_ensure('absent')}
it { is_expected.to contain_libvirtd_config('tls_priority').with_ensure('absent')}
it { is_expected.to contain_libvirtd_config('pmem_namespaces').with_ensure('<SERVICE DEFAULT>')}
end

describe 'with params' do
@@ -117,8 +115,8 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('qemu')}
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')}
it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_ensure('pcid')}
it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('pcid')}
it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_value('raw')}
it { is_expected.to contain_nova_config('libvirt/disk_cachemodes').with_value('file=directsync,block=none')}
it { is_expected.to contain_nova_config('libvirt/hw_disk_discard').with_value('unmap')}
it { is_expected.to contain_nova_config('libvirt/hw_machine_type').with_value('x86_64=machinetype1,armv7l=machinetype2')}
@@ -134,9 +132,9 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_value(16)}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
it { is_expected.to contain_nova_config('libvirt/pmem_namespaces').with_value("128G:ns0|ns1|ns2|ns3")}
it { is_expected.to contain_libvirtd_config('log_filters').with_value("\"#{params[:log_filters]}\"")}
it { is_expected.to contain_libvirtd_config('tls_priority').with_value("\"#{params[:tls_priority]}\"")}
it { is_expected.to contain_libvirtd_config('pmem_namespaces').with_value("128G:ns0|ns1|ns2|ns3")}
it {
is_expected.to contain_service('libvirt').with(
:name => 'custom_service',
@@ -197,10 +195,6 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_class('nova::migration::libvirt')}
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('0.0.0.0')}
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(:line => libvirt_options) }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls').with(:line => "listen_tls = 0") }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tcp').with(:line => "listen_tcp = 1") }
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf auth_tls')}
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf auth_tcp').with(:line => "auth_tcp = \"none\"") }
end

context 'with vncserver_listen set to ::0' do
@@ -212,10 +206,6 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_class('nova::migration::libvirt')}
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('::0')}
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(:line => libvirt_options) }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls').with(:line => "listen_tls = 0") }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tcp').with(:line => "listen_tcp = 1") }
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf auth_tls')}
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf auth_tcp').with(:line => "auth_tcp = \"none\"") }
end

context 'with custom libvirt service name on Debian platforms' do
@@ -278,7 +268,7 @@ describe 'nova::compute::libvirt' do
:ensure => 'running',
:enable => true,
:before => ['Service[libvirt]'],
:name => 'messagebus'
:name => 'dbus'
) }

describe 'on rhel 7' do
@@ -305,7 +295,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_ensure('absent')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('<SERVICE DEFAULT>')}
end

describe 'with params' do
@@ -346,10 +336,6 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_class('nova::migration::libvirt')}
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('0.0.0.0')}
it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(:line => 'LIBVIRTD_ARGS="--listen"') }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls').with(:line => "listen_tls = 0") }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tcp').with(:line => "listen_tcp = 1") }
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf auth_tls')}
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf auth_tcp').with(:line => "auth_tcp = \"none\"") }
end

context 'with vncserver_listen set to ::0' do
@@ -361,10 +347,6 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_class('nova::migration::libvirt')}
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('::0')}
it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(:line => 'LIBVIRTD_ARGS="--listen"') }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls').with(:line => "listen_tls = 0") }
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tcp').with(:line => "listen_tcp = 1") }
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf auth_tls')}
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf auth_tcp').with(:line => "auth_tcp = \"none\"") }
end

end
@@ -420,31 +402,14 @@ describe 'nova::compute::libvirt' do
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end

case [:osfamily]
case facts[:osfamily]
when 'Debian'

case [:operatingsystem]
when 'Debian'
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:os_package_family => 'debian',
:operatingsystemmajrelease => '8'}))
end
it_behaves_like 'debian-nova-compute-libvirt'
when 'Ubuntu'
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:os_package_family => 'ubuntu',
:operatingsystemmajrelease => '16.04'}))
end
it_behaves_like 'debian-nova-compute-libvirt'
end

it_behaves_like 'debian-nova-compute-libvirt'
when 'RedHat'
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :os_package_type => 'rpm' }))
end
it_behaves_like 'redhat-nova-compute-libvirt'
end
end


Loading…
Cancel
Save