Update spec tests for Tempest

Improvments:
- use default_facts variable for spec tests;
- use different name for 'file name' parameter in validate_file function.

Change-Id: I03513eaf2a40feb594b8746bae6dbd1e1b1b6bc5
This commit is contained in:
Denis Egorenko 2016-04-06 14:50:19 +03:00
parent af1bac396e
commit f99dfc5df0
2 changed files with 33 additions and 47 deletions

View File

@ -298,13 +298,19 @@ describe 'tempest' do
end end
end end
on_supported_os({
context 'on Debian platforms' do :supported_os => OSDefaults.get_supported_os
let :facts do }).each do |os,facts|
{ :osfamily => 'Debian' } context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:concat_basedir => '/var/lib/puppet/concat',
:processorcount => 2
}))
end end
let(:platform_params) do
let :platform_params do case facts[:osfamily]
when 'Debian'
{ :dev_packages => ['python-dev', { :dev_packages => ['python-dev',
'libxslt1-dev', 'libxslt1-dev',
'libxml2-dev', 'libxml2-dev',
@ -312,18 +318,7 @@ describe 'tempest' do
'libffi-dev', 'libffi-dev',
'patch', 'patch',
'gcc' ] } 'gcc' ] }
end when 'RedHat'
it_behaves_like 'tempest'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemrelease => '7' }
end
let :platform_params do
{ :dev_packages => ['python-devel', { :dev_packages => ['python-devel',
'libxslt-devel', 'libxslt-devel',
'libxml2-devel', 'libxml2-devel',
@ -332,19 +327,10 @@ describe 'tempest' do
'patch', 'patch',
'gcc' ] } 'gcc' ] }
end end
end
it_behaves_like 'tempest' it_behaves_like 'tempest'
it_behaves_like 'tempest with plugins packages' it_behaves_like 'tempest with plugins packages'
end end
context 'unsupported operating system' do
describe 'tempest class without any parameters on Solaris/Nexenta' do
let :facts do
{ :osfamily => 'Solaris',
:operatingsystem => 'Nexenta' }
end
it { expect { is_expected.to contain_package('tempest') }.to raise_error(Puppet::Error, /Unsupported osfamily: Solaris operatingsystem: Nexenta/) }
end
end end
end end

View File

@ -17,8 +17,8 @@ describe 'Providers' do
end end
end end
def validate_file(expected_content, tmpfile = tmpfile) def validate_file(expected_content, file = tmpfile)
expect(File.read(tmpfile)).to eq(expected_content) expect(File.read(file)).to eq(expected_content)
end end
let(:glance_params) do let(:glance_params) do