Add support for testing magnum
Note: This uses a different layout than what has been done until now by moving service-specific configuration to it's own class. Change-Id: Ie7def5893bfdd3313b0434777e926dd0b078a36f
This commit is contained in:
parent
a13bad76bf
commit
132bf33cca
134
manifests/magnum.pp
Normal file
134
manifests/magnum.pp
Normal file
@ -0,0 +1,134 @@
|
||||
# class: tempest::magnum
|
||||
#
|
||||
# Configures Tempest in order to be able to test the Magnum container service.
|
||||
# Sane defaults are used where possible in order to provide a working testing
|
||||
# configuration.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*tempest_config_file*]
|
||||
# Defaults to '/var/lib/tempest/etc/tempest.conf'
|
||||
#
|
||||
# [*provision_image*]
|
||||
# (Optional) If ::tempest::magnum should configure the testing image
|
||||
# Defaults to true
|
||||
#
|
||||
# [*image_source*]
|
||||
# (Optional) If provision_image is true, the location of the image
|
||||
# Defaults to 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2'
|
||||
#
|
||||
# [*image_os_distro*]
|
||||
# (Optional) If provision_image is true, the os_distro propery of the image
|
||||
# Defaults to fedora-atomic-latest
|
||||
#
|
||||
# [*image_name*]
|
||||
# (Optional) The name of the image to be used for ClusterTemplate
|
||||
# Defaults to 'fedora-atomic-latest'
|
||||
#
|
||||
# [*provision_flavors*]
|
||||
# (Optional) If ::tempest::magnum should configure the testing flavors
|
||||
# Defaults to true
|
||||
#
|
||||
# [*flavor_id*]
|
||||
# (Optional) The name of the flavor to be used for ClusterTemplate
|
||||
# Defaults to 's1.magnum'
|
||||
#
|
||||
# [*master_flavor_id*]
|
||||
# (Optional) The name of the master flavor to be used for ClusterTemplate
|
||||
# Defaults to 'm1.magnum'
|
||||
#
|
||||
# [*provision_keypair*]
|
||||
# (Optional) If ::tempest::magnum should configure the testing keypair
|
||||
# Defaults to false (not yet supported, will be true when implemented)
|
||||
#
|
||||
# [*keypair_id*]
|
||||
# (Optional) The keypair_id parameter used in Magnum tempest configuration
|
||||
# Defaults to 'default'
|
||||
#
|
||||
# [*nic_id*]
|
||||
# (Optional) The nic_id parameter used in Magnum tempest configuration
|
||||
# Defaults to 'public'
|
||||
#
|
||||
# [*magnum_url*]
|
||||
# (Optional) Bypass URL for Magnum to skip service catalog lookup
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*copy_logs*]
|
||||
# (Optional) Whether to copy nova server logs on failure
|
||||
# Defaults to true
|
||||
#
|
||||
# [*dns_nameserver*]
|
||||
# (Optional) DNS nameserver to use for ClusterTemplate
|
||||
# Defaults to '8.8.8.8'
|
||||
#
|
||||
class tempest::magnum (
|
||||
$tempest_config_file = '/var/lib/tempest/etc/tempest.conf',
|
||||
$provision_image = true,
|
||||
$image_source = 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
|
||||
$image_name = 'fedora-atomic-latest',
|
||||
$image_os_distro = 'fedora-atomic',
|
||||
$provision_flavors = true,
|
||||
$flavor_id = 's1.magnum',
|
||||
$master_flavor_id = 'm1.magnum',
|
||||
$provision_keypair = false,
|
||||
$keypair_id = 'default',
|
||||
$nic_id = 'public',
|
||||
$magnum_url = undef,
|
||||
$copy_logs = true,
|
||||
$dns_nameserver = '8.8.8.8',
|
||||
) {
|
||||
include ::tempest::params
|
||||
|
||||
if $provision_image {
|
||||
$image_properties = { 'os_distro' => $image_os_distro }
|
||||
glance_image { $image_name:
|
||||
ensure => present,
|
||||
container_format => 'bare',
|
||||
disk_format => 'qcow2',
|
||||
is_public => 'yes',
|
||||
source => $image_source,
|
||||
properties => $image_properties,
|
||||
}
|
||||
}
|
||||
|
||||
if $provision_flavors {
|
||||
nova_flavor { $flavor_id:
|
||||
ensure => present,
|
||||
id => '200',
|
||||
ram => '512',
|
||||
disk => '10',
|
||||
vcpus => '1',
|
||||
}
|
||||
|
||||
nova_flavor { $master_flavor_id:
|
||||
ensure => present,
|
||||
id => '100',
|
||||
ram => '1024',
|
||||
disk => '10',
|
||||
vcpus => '1',
|
||||
}
|
||||
}
|
||||
|
||||
if $::tempest::params::python_magnum_tests {
|
||||
package { 'python-magnum-tests':
|
||||
ensure => present,
|
||||
name => $::tempest::params::python_magnum_tests,
|
||||
tag => ['openstack', 'tempest-package'],
|
||||
}
|
||||
}
|
||||
|
||||
Tempest_config {
|
||||
path => $tempest_config_file,
|
||||
}
|
||||
|
||||
tempest_config {
|
||||
'magnum/image_id': value => $image_name;
|
||||
'magnum/nic_id': value => $nic_id;
|
||||
'magnum/keypair_id': value => $keypair_id;
|
||||
'magnum/flavor_id': value => $flavor_id;
|
||||
'magnum/master_flavor_id': value => $master_flavor_id;
|
||||
'magnum/magnum_url': value => $magnum_url;
|
||||
'magnum/copy_logs': value => $copy_logs;
|
||||
'magnum/dns_nameserver': value => $dns_nameserver;
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ class tempest::params {
|
||||
$python_horizon_tests = 'python-horizon-tests-tempest'
|
||||
$python_ironic_tests = 'python-ironic-tests'
|
||||
$python_keystone_tests = 'python-keystone-tests'
|
||||
$python_magnum_tests = 'python-magnum-tests'
|
||||
$python_mistral_tests = 'python-mistral-tests'
|
||||
$python_vitrage_tests = 'python-vitrage-tests'
|
||||
$python_murano_tests = 'python-murano-tests'
|
||||
@ -66,6 +67,7 @@ class tempest::params {
|
||||
$python_ironic_tests = false
|
||||
$python_keystone_tests = false
|
||||
$python_l2gw_tests = false
|
||||
$python_magnum_tests = false
|
||||
$python_mistral_tests = false
|
||||
$python_vitrage_tests = false
|
||||
$python_murano_tests = false
|
||||
|
@ -278,6 +278,8 @@ describe 'tempest' do
|
||||
is_expected.to contain_tempest_config('scenario/img_dir').with(:value => '/var/lib/tempest')
|
||||
is_expected.to contain_tempest_config('scenario/img_file').with(:value => 'cirros-0.3.4-x86_64-disk.img')
|
||||
is_expected.to contain_tempest_config('service_broker/run_service_broker_tests').with(:value => false)
|
||||
|
||||
is_expected.not_to contain_tempest_config('magnum/keypair_id').with_value('default')
|
||||
end
|
||||
|
||||
it 'set glance id' do
|
||||
|
79
spec/classes/tempest_magnum_spec.rb
Normal file
79
spec/classes/tempest_magnum_spec.rb
Normal file
@ -0,0 +1,79 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'tempest::magnum' do
|
||||
let :params do
|
||||
{ :nic_id => 'b2e6021a-4956-4a1f-8329-790b9add05a9', }
|
||||
end
|
||||
|
||||
shared_examples 'tempest magnum' do
|
||||
context 'with default parameters' do
|
||||
it 'provisions resources and configures tempest for magnum' do
|
||||
is_expected.to contain_glance_image('fedora-atomic-latest').with(
|
||||
:ensure => 'present',
|
||||
:source => 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
|
||||
:properties => '{"os_distro"=>"fedora-atomic"}'
|
||||
)
|
||||
is_expected.to contain_nova_flavor('s1.magnum').with_ensure('present')
|
||||
is_expected.to contain_nova_flavor('m1.magnum').with_ensure('present')
|
||||
|
||||
is_expected.to contain_tempest_config('magnum/image_id').with_value('fedora-atomic-latest')
|
||||
is_expected.to contain_tempest_config('magnum/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9')
|
||||
is_expected.to contain_tempest_config('magnum/keypair_id').with_value('default')
|
||||
is_expected.to contain_tempest_config('magnum/flavor_id').with_value('s1.magnum')
|
||||
is_expected.to contain_tempest_config('magnum/master_flavor_id').with_value('m1.magnum')
|
||||
is_expected.to contain_tempest_config('magnum/copy_logs').with_value('true')
|
||||
is_expected.to contain_tempest_config('magnum/dns_nameserver').with_value('8.8.8.8')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:provision_image => false,
|
||||
:image_name => 'coreos',
|
||||
:provision_flavors => 'false',
|
||||
:flavor_id => 's1.tempest',
|
||||
:master_flavor_id => 'm1.tempest',
|
||||
:keypair_id => 'magnum',
|
||||
:provision_keypair => false,
|
||||
:magnum_url => 'http://magnum/',
|
||||
:copy_logs => false,
|
||||
:dns_nameserver => '7.7.7.7'
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures tempest for magnum' do
|
||||
is_expected.to contain_tempest_config('magnum/image_id').with_value('coreos')
|
||||
is_expected.to contain_tempest_config('magnum/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9')
|
||||
is_expected.to contain_tempest_config('magnum/keypair_id').with_value('magnum')
|
||||
is_expected.to contain_tempest_config('magnum/flavor_id').with_value('s1.tempest')
|
||||
is_expected.to contain_tempest_config('magnum/master_flavor_id').with_value('m1.tempest')
|
||||
is_expected.to contain_tempest_config('magnum/magnum_url').with_value('http://magnum/')
|
||||
is_expected.to contain_tempest_config('magnum/copy_logs').with_value('false')
|
||||
is_expected.to contain_tempest_config('magnum/dns_nameserver').with_value('7.7.7.7')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'installs test packages' do
|
||||
describe 'with default parameters installing' do
|
||||
it { is_expected.to contain_package('python-magnum-tests').with_ensure('present') }
|
||||
end
|
||||
end
|
||||
|
||||
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())
|
||||
end
|
||||
it_configures 'tempest magnum'
|
||||
|
||||
case facts[:osfamily]
|
||||
when 'RedHat'
|
||||
it_configures 'installs test packages'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user