Added manifests to install tempest from package
* Install tempest from distro package * Create tempest workspace Closes-Bug: #1549366 Change-Id: I9eef83bd56cd3b3a890dbdde34e1c317d4afa0e2
This commit is contained in:
parent
34f7293e2b
commit
4303ee2e7b
@ -55,4 +55,8 @@ Puppet::Type.newtype(:tempest_config) do
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'tempest'
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -5,6 +5,11 @@
|
||||
# Note that only parameters for which values are provided will be
|
||||
# managed in tempest.conf.
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) The state of tempest packages
|
||||
# Defaults to 'present'
|
||||
# [*tempest_workspace*]
|
||||
# Deafults to '/var/lib/tempest'
|
||||
# [*install_from_source*]
|
||||
# Defaults to true
|
||||
# [*git_clone*]
|
||||
@ -200,6 +205,8 @@
|
||||
# Defaults to undef
|
||||
#
|
||||
class tempest(
|
||||
$ensure_package = 'present',
|
||||
$tempest_workspace = '/var/lib/tempest',
|
||||
$install_from_source = true,
|
||||
$git_clone = true,
|
||||
$tempest_config_file = '/var/lib/tempest/etc/tempest.conf',
|
||||
@ -431,6 +438,31 @@ class tempest(
|
||||
}
|
||||
}
|
||||
|
||||
if ! $install_from_source {
|
||||
package { 'tempest':
|
||||
ensure => $ensure_package,
|
||||
name => $::tempest::params::package_name,
|
||||
tag => ['openstack', 'tempest-package'],
|
||||
}
|
||||
|
||||
$tempest_conf = "${tempest_workspace}/etc/tempest.conf"
|
||||
|
||||
# Create tempest workspace by running tempest init.
|
||||
# It will generate etc/tempest.conf, logs and tempest_lock folder
|
||||
# in tempest workspace
|
||||
exec {'tempest-workspace':
|
||||
command => "tempest init ${tempest_workspace}",
|
||||
cwd => $tempest_workspace,
|
||||
path => ['/bin', '/usr/bin'],
|
||||
refreshonly => true,
|
||||
require => Package['tempest'],
|
||||
}
|
||||
|
||||
Package['tempest'] ~> Exec['tempest-workspace']
|
||||
Exec['tempest-workspace'] -> Tempest_config<||>
|
||||
}
|
||||
|
||||
|
||||
tempest_config {
|
||||
'auth/admin_domain_name': value => $admin_domain_name;
|
||||
'auth/admin_password': value => $admin_password, secret => true;
|
||||
|
@ -37,6 +37,7 @@ class tempest::params {
|
||||
$python_zaqar_tests = 'python-zaqar-tests'
|
||||
$python_congress_tests = 'python-congress-tests'
|
||||
$python_panko_tests = 'python-panko-tests'
|
||||
$package_name = 'openstack-tempest'
|
||||
}
|
||||
'Debian': {
|
||||
$dev_packages = [
|
||||
@ -71,6 +72,7 @@ class tempest::params {
|
||||
$python_zaqar_tests = false
|
||||
$python_congress_tests = false
|
||||
$python_panko_tests = false
|
||||
$package_name = 'tempest'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- Added manifests to install tempest from package
|
@ -307,6 +307,46 @@ describe 'tempest' do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'install Tempest from package' do
|
||||
let :params do
|
||||
{:install_from_source => false,
|
||||
:image_name => 'image name',
|
||||
:image_name_alt => 'image name alt'}
|
||||
end
|
||||
|
||||
it 'checks for tempest package' do
|
||||
is_expected.to contain_package('tempest').with(
|
||||
:ensure => 'present',
|
||||
:name => platform_params[:package_name],
|
||||
:tag => ['openstack', 'tempest-package'],
|
||||
)
|
||||
end
|
||||
it 'creates tempest workspace' do
|
||||
is_expected.to contain_exec('tempest-workspace').with(
|
||||
:command => 'tempest init /var/lib/tempest',
|
||||
:cwd => '/var/lib/tempest',
|
||||
:path => ['/bin', '/usr/bin'],
|
||||
:refreshonly => true,
|
||||
:require => 'Package[tempest]'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'tempest workspace customization' do
|
||||
let :params do
|
||||
{:tempest_workspace => '/tmp/tempest',
|
||||
:image_name => 'image name',
|
||||
:image_name_alt => 'image name alt',
|
||||
:install_from_source => false}
|
||||
end
|
||||
|
||||
it 'supports customizes tempest workspace' do
|
||||
is_expected.to contain_exec('tempest-workspace').with(
|
||||
:command => 'tempest init /tmp/tempest',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'tempest with plugins packages' do
|
||||
@ -383,7 +423,8 @@ describe 'tempest' do
|
||||
'libffi-dev',
|
||||
'patch',
|
||||
'gcc',
|
||||
'python-virtualenv' ] }
|
||||
'python-virtualenv' ],
|
||||
:package_name => 'tempest'}
|
||||
when 'RedHat'
|
||||
{ :dev_packages => ['python-devel',
|
||||
'libxslt-devel',
|
||||
@ -391,7 +432,8 @@ describe 'tempest' do
|
||||
'openssl-devel',
|
||||
'libffi-devel',
|
||||
'patch',
|
||||
'gcc'] }
|
||||
'gcc'],
|
||||
:package_name => 'openstack-tempest'}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -50,4 +50,14 @@ describe 'Puppet::Type.type(:tempest_config)' do
|
||||
@tempest_config[:ensure] = :latest
|
||||
}.to raise_error(Puppet::Error, /Invalid value/)
|
||||
end
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'tempest')
|
||||
catalog.add_resource package, @tempest_config
|
||||
dependency = @tempest_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@tempest_config)
|
||||
expect(dependency[0].source).to eq(package)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user