From 40baa334f071ba1dc10634ed3b7a1351bb27e74d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 27 Apr 2021 23:12:33 +0900 Subject: [PATCH] Add unit tests for nova::compute::libvirt::config Change-Id: I0c217a9a2e0641971d234cbb472567cecf9444e7 --- .../nova_compute_libvirt_config_spec.rb | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 spec/classes/nova_compute_libvirt_config_spec.rb diff --git a/spec/classes/nova_compute_libvirt_config_spec.rb b/spec/classes/nova_compute_libvirt_config_spec.rb new file mode 100644 index 000000000..73095b5d3 --- /dev/null +++ b/spec/classes/nova_compute_libvirt_config_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +describe 'nova::compute::libvirt::config' do + shared_examples 'nova::compute::libvirt::config' do + let :params do + { + :libvirtd_config => { + 'foo' => { 'value' => 'fooValue' }, + 'bar' => { 'value' => 'barValue' }, + 'baz' => { 'ensure' => 'absent' } + }, + :virtlogd_config => { + 'foo2' => { 'value' => 'fooValue' }, + 'bar2' => { 'value' => 'barValue' }, + 'baz2' => { 'ensure' => 'absent' } + } + } + end + + context 'with specified configs' do + it { should contain_class('nova::deps') } + + it { + should contain_libvirtd_config('foo').with_value('fooValue') + should contain_libvirtd_config('bar').with_value('barValue') + should contain_libvirtd_config('baz').with_ensure('absent') + } + + it { + should contain_virtlogd_config('foo2').with_value('fooValue') + should contain_virtlogd_config('bar2').with_value('barValue') + should contain_virtlogd_config('baz2').with_ensure('absent') + } + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'nova::compute::libvirt::config' + end + end +end