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,53 +298,39 @@ 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
end let (:facts) do
facts.merge!(OSDefaults.get_facts({
let :platform_params do :concat_basedir => '/var/lib/puppet/concat',
{ :dev_packages => ['python-dev', :processorcount => 2
'libxslt1-dev', }))
'libxml2-dev', end
'libssl-dev', let(:platform_params) do
'libffi-dev', case facts[:osfamily]
'patch', when 'Debian'
'gcc' ] } { :dev_packages => ['python-dev',
end 'libxslt1-dev',
'libxml2-dev',
it_behaves_like 'tempest' 'libssl-dev',
end 'libffi-dev',
'patch',
context 'on RedHat platforms' do 'gcc' ] }
let :facts do when 'RedHat'
{ :osfamily => 'RedHat', { :dev_packages => ['python-devel',
:operatingsystemrelease => '7' } 'libxslt-devel',
end 'libxml2-devel',
'openssl-devel',
let :platform_params do 'libffi-devel',
{ :dev_packages => ['python-devel', 'patch',
'libxslt-devel', 'gcc' ] }
'libxml2-devel', end
'openssl-devel',
'libffi-devel',
'patch',
'gcc' ] }
end
it_behaves_like 'tempest'
it_behaves_like 'tempest with plugins packages'
end
context 'unsupported operating system' do
describe 'tempest class without any parameters on Solaris/Nexenta' do
let :facts do
{ :osfamily => 'Solaris',
:operatingsystem => 'Nexenta' }
end end
it { expect { is_expected.to contain_package('tempest') }.to raise_error(Puppet::Error, /Unsupported osfamily: Solaris operatingsystem: Nexenta/) } it_behaves_like 'tempest'
it_behaves_like 'tempest with plugins packages'
end 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