Add support for Tempest plugin packages

This patch allows to install Tempest plugin packages provided by RDO.
Disabled by default, manage_tests_packages boolean if set to True will
install Python packages that are needed when a service is set as
available in ::tempest class.

Change-Id: Iac9a57c2ba006bb2a660d2b54ee05bbe68125abf
This commit is contained in:
Emilien Macchi 2016-03-14 19:06:23 -04:00
parent f908e62c10
commit d657b79046
4 changed files with 170 additions and 5 deletions

View File

@ -150,6 +150,8 @@
# Defaults to undef
# [*disable_ssl_validation*]
# Defaults to undef
# [*manage_tests_packages*]
# Defaults to false
#
class tempest(
$install_from_source = true,
@ -247,12 +249,13 @@ class tempest(
$run_service_broker_tests = false,
$ca_certificates_file = undef,
$disable_ssl_validation = undef,
$manage_tests_packages = false,
# scenario options
$img_dir = '/var/lib/tempest',
$img_file = 'cirros-0.3.4-x86_64-disk.img',
) {
include '::tempest::params'
include ::tempest::params
if $install_from_source {
ensure_packages([
@ -374,6 +377,107 @@ class tempest(
'service_broker/run_service_broker_tests': value => $run_service_broker_tests;
}
if $manage_tests_packages {
if $aodh_available and $::tempest::params::python_aodh_tests {
package { 'python-aodh-tests':
ensure => present,
name => $::tempest::params::python_aodh_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $ceilometer_available and $::tempest::params::python_ceilometer_tests {
package { 'python-ceilometer-tests':
ensure => present,
name => $::tempest::params::python_ceilometer_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $cinder_available and $::tempest::params::python_cinder_tests {
package { 'python-cinder-tests':
ensure => present,
name => $::tempest::params::python_cinder_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $glance_available and $::tempest::params::python_glance_tests {
package { 'python-glance-tests':
ensure => present,
name => $::tempest::params::python_glance_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $heat_available and $::tempest::params::python_heat_tests {
package { 'python-heat-tests':
ensure => present,
name => $::tempest::params::python_heat_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $ironic_available and $::tempest::params::python_ironic_tests {
package { 'python-ironic-tests':
ensure => present,
name => $::tempest::params::python_ironic_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $::tempest::params::python_keystone_tests {
package { 'python-keystone-tests':
ensure => present,
name => $::tempest::params::python_keystone_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $murano_available and $::tempest::params::python_murano_tests {
package { 'python-murano-tests':
ensure => present,
name => $::tempest::params::python_murano_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $neutron_available and $::tempest::params::python_neutron_tests {
package { 'python-neutron-tests':
ensure => present,
name => $::tempest::params::python_neutron_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $nova_available and $::tempest::params::python_nova_tests {
package { 'python-nova-tests':
ensure => present,
name => $::tempest::params::python_nova_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $sahara_available and $::tempest::params::python_sahara_tests {
package { 'python-sahara-tests':
ensure => present,
name => $::tempest::params::python_sahara_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $swift_available and $::tempest::params::python_swift_tests {
package { 'python-swift-tests':
ensure => present,
name => $::tempest::params::python_swift_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $trove_available and $::tempest::params::python_trove_tests {
package { 'python-trove-tests':
ensure => present,
name => $::tempest::params::python_trove_tests,
tag => ['openstack', 'tempest-package'],
}
}
if $zaqar_available and $::tempest::params::python_zaqar_tests {
package { 'python-zaqar-tests':
ensure => present,
name => $::tempest::params::python_zaqar_tests,
tag => ['openstack', 'tempest-package'],
}
}
}
if $configure_images {
if ! $image_ref and $image_name {
# If the image id was not provided, look it up via the image name

View File

@ -12,6 +12,20 @@ class tempest::params {
'patch',
'gcc',
]
$python_aodh_tests = 'python-aodh-tests'
$python_ceilometer_tests = 'python-ceilometer-tests'
$python_cinder_tests = 'python-cinder-tests'
$python_glance_tests = 'python-glance-tests'
$python_heat_tests = 'python-heat-tests'
$python_ironic_tests = 'python-ironic-tests'
$python_keystone_tests = 'python-keystone-tests'
$python_murano_tests = 'python-murano-tests'
$python_neutron_tests = 'python-neutron-tests'
$python_nova_tests = 'python-nova-tests'
$python_sahara_tests = 'python-sahara-tests'
$python_swift_tests = 'python-swift-tests'
$python_trove_tests = 'python-trove-tests'
$python_zaqar_tests = 'python-zaqar-tests'
}
'Debian': {
$pip_bin_path = '/usr/local/bin'
@ -24,6 +38,20 @@ class tempest::params {
'patch',
'gcc',
]
$python_aodh_tests = false
$python_ceilometer_tests = false
$python_cinder_tests = false
$python_glance_tests = false
$python_heat_tests = false
$python_ironic_tests = false
$python_keystone_tests = false
$python_murano_tests = false
$python_neutron_tests = false
$python_nova_tests = false
$python_sahara_tests = false
$python_swift_tests = false
$python_trove_tests = false
$python_zaqar_tests = false
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")

View File

@ -6,12 +6,14 @@ describe 'basic tempest' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
include ::openstack_integration
include ::openstack_integration::repos
class { '::tempest':
setup_venv => true,
configure_images => false,
configure_networks => false,
setup_venv => true,
configure_images => false,
configure_networks => false,
manage_tests_packages => true,
}
EOS

View File

@ -249,6 +249,36 @@ describe 'tempest' do
end
end
shared_examples 'tempest with plugins packages' do
let :pre_condition do
"include ::glance
class { 'neutron': rabbit_password => 'passw0rd' }"
end
context 'with when managing tests packages for keystone (required service)' do
let :params do
{ :manage_tests_packages => true }
end
describe "should install keystone tests package" do
it { expect { is_expected.to contain_package('python-keystone-tests') } }
it { expect { is_expected.to_not contain_package('python-aodh-tests') } }
end
end
context 'with when managing tests packages for aodh (optional service)' do
let :params do
{ :manage_tests_packages => true,
:aodh_available => true }
end
describe "should install keystone tests package" do
it { expect { is_expected.to contain_package('python-aodh-tests') } }
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
@ -284,6 +314,7 @@ describe 'tempest' do
end
it_behaves_like 'tempest'
it_behaves_like 'tempest with plugins packages'
end
context 'unsupported operating system' do