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
(cherry picked from commit f99dfc5df0)

venv: create venv & run pip in exec

Tempest deleted the venv management scripts [1] so now, puppet-tempest
is able to deploy the venv & run pip by itself.

[1] https://review.openstack.org/#/c/270564/

Closes-Bug: #1570268
Change-Id: Iacfe61a14d69a8738a4cc4e2cfe29f7d54e91941
(cherry picked from commit e70aa88930)
This commit is contained in:
Denis Egorenko 2016-04-06 14:50:19 +03:00 committed by Emilien Macchi
parent 628b024d79
commit 0859567f8c
4 changed files with 37 additions and 49 deletions

View File

@ -292,7 +292,7 @@ class tempest(
if $setup_venv {
# virtualenv will be installed along with tox
exec { 'setup-venv':
command => "/usr/bin/python ${tempest_clone_path}/tools/install_venv.py",
command => "/usr/bin/virtualenv ${tempest_clone_path}/.venv && ${tempest_clone_path}/.venv/bin/pip install -U -r requirements.txt",
cwd => $tempest_clone_path,
unless => "/usr/bin/test -d ${tempest_clone_path}/.venv",
require => [

View File

@ -10,7 +10,7 @@ class tempest::params {
'openssl-devel',
'libffi-devel',
'patch',
'gcc',
'gcc'
]
$python_aodh_tests = 'python-aodh-tests'
$python_ceilometer_tests = 'python-ceilometer-tests'
@ -37,6 +37,7 @@ class tempest::params {
'libffi-dev',
'patch',
'gcc',
'python-virtualenv',
]
$python_aodh_tests = false
$python_ceilometer_tests = false

View File

@ -278,53 +278,40 @@ describe 'tempest' do
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :dev_packages => ['python-dev',
'libxslt1-dev',
'libxml2-dev',
'libssl-dev',
'libffi-dev',
'patch',
'gcc' ] }
end
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',
'libxslt-devel',
'libxml2-devel',
'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' }
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({
:concat_basedir => '/var/lib/puppet/concat',
:processorcount => 2
}))
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :dev_packages => ['python-dev',
'libxslt1-dev',
'libxml2-dev',
'libssl-dev',
'libffi-dev',
'patch',
'gcc',
'python-virtualenv' ] }
when 'RedHat'
{ :dev_packages => ['python-devel',
'libxslt-devel',
'libxml2-devel',
'openssl-devel',
'libffi-devel',
'patch',
'gcc' ] }
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

View File

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