From 68315770395197a3df03247de4ba1d11313084fb Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 16 Jun 2022 00:50:47 +0900 Subject: [PATCH] Fix missing parameters for heat-tempest-plugin heat-tempest-plugin requires a few parameters in the dedicated [heat_plugin] section. This change adds initial support for these parameters so that heat-tempest-plugin tests can be executed properly. Closes-Bug: #1963659 Change-Id: I003f421726f3285a8cca7949896eb63cb6025169 --- manifests/init.pp | 92 +++++++++++++++++-- .../notes/bug-1963659-5da35fe19165c268.yaml | 4 + spec/classes/tempest_init_spec.rb | 46 +++++++++- 3 files changed, 129 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/bug-1963659-5da35fe19165c268.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 063cbd5c..2c0d946e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -213,8 +213,6 @@ # Defaults to undef # [*disable_ssl_validation*] # Defaults to undef -# [*designate_nameservers*] -# Defaults to $::os_service_default # [*manage_tests_packages*] # Defaults to false # [*attach_encrypted_volume*] @@ -227,12 +225,22 @@ # Defaults to undef # [*db_flavor_name*] # Defaults to undef +# [*designate_nameservers*] +# Defaults to $::os_service_default +# [*ec2api_tester_roles*] +# Defaults to ['Member'] +# [*heat_image_ref*] +# Defaults to undef +# [*heat_image_name*] +# Defaults to undef +# [*heat_flavor_ref*] +# Defaults to undef +# [*heat_flavor_name*] +# Defaults to undef # [*baremetal_driver*] # Defaults to 'fake' # [*baremetal_enabled_hardware_types*] # Defaults to 'ipmi' -# [*ec2api_tester_roles*] -# Defaults to 'Member' # [*load_balancer_member_role*] # Defaults to $::os_service_default # [*load_balancer_admin_role*] @@ -390,11 +398,16 @@ class tempest( $img_disk_format = $::os_service_default, # designate options $designate_nameservers = $::os_service_default, + # ec2api options + $ec2api_tester_roles = ['Member'], + # heat options + $heat_image_ref = undef, + $heat_image_name = undef, + $heat_flavor_ref = undef, + $heat_flavor_name = undef, # ironic options $baremetal_driver = 'fake', $baremetal_enabled_hardware_types = 'ipmi', - # ec2api options - $ec2api_tester_roles = ['Member'], # octavia options $load_balancer_member_role = $::os_service_default, $load_balancer_admin_role = $::os_service_default, @@ -600,11 +613,33 @@ class tempest( 'scenario/img_file': value => $img_file; 'scenario/img_disk_format': value => $img_disk_format; 'service_broker/run_service_broker_tests': value => $run_service_broker_tests; - 'dns/nameservers': value => join(any2array($designate_nameservers), ','); 'compute-feature-enabled/attach_encrypted_volume': value => $attach_encrypted_volume; 'compute-feature-enabled/resize': value => $resize_available; + # designate-tempest-plugin + 'dns/nameservers': value => join(any2array($designate_nameservers), ','); + # heat-tempest-plugin + 'heat_plugin/auth_url': value => $identity_uri_v3; + # TODO(tkajinam): auth_version does not affect vN format (eg v3) and + # the heading v should be removed. + 'heat_plugin/auth_version': value => regsubst($auth_version, '^v(\\d+)$', '\\1'); + 'heat_plugin/admin_username': value => $admin_username; + 'heat_plugin/admin_password': value => $admin_password, secret => true; + 'heat_plugin/admin_project_name': value => $admin_project_name; + 'heat_plugin/admin_user_domain_name': value => $admin_user_domain_name; + 'heat_plugin/admin_project_domain_name': value => $admin_project_domain_name; + 'heat_plugin/username': value => $username; + 'heat_plugin/password': value => $password, secret => true; + 'heat_plugin/project_name': value => $project_name; + 'heat_plugin/user_domain_name': value => $user_domain_name; + 'heat_plugin/project_domain_name': value => $project_domain_name; + 'heat_plugin/image_ref': value => $heat_image_ref; + 'heat_plugin/instance_type': value => $heat_flavor_ref; + 'heat_plugin/minimal_image_ref': value => $image_ref; + 'heat_plugin/minimal_instance_type': value => $flavor_ref; + # ironic-tempest-plugin 'baremetal/driver': value => $baremetal_driver; 'baremetal/enabled_hardware_types': value => $baremetal_enabled_hardware_types; + # octavia-tempest-plugin 'load_balancer/member_role': value => $load_balancer_member_role; 'load_balancer/admin_role': value => $load_balancer_admin_role; 'load_balancer/observer_role': value => $load_balancer_observer_role; @@ -795,6 +830,14 @@ class tempest( } Tempest_config<||> -> Tempest_flavor_id_setter['compute/flavor_ref'] Keystone_user_role<||> -> Tempest_flavor_id_setter['compute/flavor_ref'] + + tempest_flavor_id_setter { 'heat_plugin/minimal_instance_type': + ensure => present, + tempest_conf_path => $tempest_conf, + flavor_name => $flavor_name, + } + Tempest_config<||> -> Tempest_flavor_id_setter['heat_plugin/minimal_instance_type'] + Keystone_user_role<||> -> Tempest_flavor_id_setter['heat_plugin/minimal_instance_type'] } elsif ($flavor_name and $flavor_ref) { fail('flavor_ref and flavor_name are both set: please set only one of them') } @@ -823,6 +866,18 @@ class tempest( fail('db_flavor_ref and db_flavor_name are both set: please set only one of them') } + if !$heat_flavor_ref and $heat_flavor_name { + tempest_flavor_id_setter { 'heat_plugin/instance_type': + ensure => present, + tempest_conf_path => $tempest_conf, + flavor_name => $heat_flavor_name, + } + Tempest_config<||> -> Tempest_flavor_id_setter['heat_plugin/instance_type'] + Keystone_user_role<||> -> Tempest_flavor_id_setter['heat_plugin/instance_type'] + } elsif ($heat_flavor_name and $heat_flavor_ref) { + fail('heat_flavor_ref and heat_flavor_name are both set: please set only one of them') + } + if $configure_images { if ! $image_ref and $image_name { # If the image id was not provided, look it up via the image name @@ -834,9 +889,17 @@ class tempest( } Tempest_config<||> -> Tempest_glance_id_setter['compute/image_ref'] Keystone_user_role<||> -> Tempest_glance_id_setter['compute/image_ref'] + tempest_glance_id_setter { 'heat_plugin/minimal_image_ref': + ensure => present, + tempest_conf_path => $tempest_conf, + image_name => $image_name, + } + Tempest_config<||> -> Tempest_glance_id_setter['heat_plugin/minimal_image_ref'] + Keystone_user_role<||> -> Tempest_glance_id_setter['heat_plugin/minimal_image_ref'] } elsif ($image_name and $image_ref) or (! $image_name and ! $image_ref) { fail('A value for either image_name or image_ref must be provided.') } + if ! $image_ref_alt and $image_name_alt { tempest_glance_id_setter { 'compute/image_ref_alt': ensure => present, @@ -846,8 +909,19 @@ class tempest( Tempest_config<||> -> Tempest_glance_id_setter['compute/image_ref_alt'] Keystone_user_role<||> -> Tempest_glance_id_setter['compute/image_ref_alt'] } elsif ($image_name_alt and $image_ref_alt) or (! $image_name_alt and ! $image_ref_alt) { - fail('A value for either image_name_alt or image_ref_alt must \ -be provided.') + fail('A value for either image_name_alt or image_ref_alt must be provided.') + } + + if ! $heat_image_ref and $heat_image_name { + tempest_glance_id_setter { 'heat_plugin/image_ref': + ensure => present, + tempest_conf_path => $tempest_conf, + image_name => $heat_image_name, + } + Tempest_config<||> -> Tempest_glance_id_setter['heat_plugin/image_ref'] + Keystone_user_role<||> -> Tempest_glance_id_setter['heat_plugin/image_ref'] + } elsif ($heat_image_name and $heat_image_ref) { + fail('heat_image_ref and heat_image_name are both set: please set only one of them') } } diff --git a/releasenotes/notes/bug-1963659-5da35fe19165c268.yaml b/releasenotes/notes/bug-1963659-5da35fe19165c268.yaml new file mode 100644 index 00000000..379e6b81 --- /dev/null +++ b/releasenotes/notes/bug-1963659-5da35fe19165c268.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The ``tempest`` class now supports heat-tempest-plugin parameters. diff --git a/spec/classes/tempest_init_spec.rb b/spec/classes/tempest_init_spec.rb index 9ede2225..8fad0129 100644 --- a/spec/classes/tempest_init_spec.rb +++ b/spec/classes/tempest_init_spec.rb @@ -32,6 +32,7 @@ describe 'tempest' do it 'configures image_ref' do is_expected.to contain_tempest_config('compute/image_ref').with_value('4c423fc6-87f7-4e6d-9d3c-abc13058ae5b') + is_expected.to contain_tempest_config('heat_plugin/minimal_image_ref').with_value('4c423fc6-87f7-4e6d-9d3c-abc13058ae5b') end end @@ -43,6 +44,7 @@ describe 'tempest' do it 'uses a resource to configure image_ref from image_name' do is_expected.to contain_tempest_glance_id_setter('compute/image_ref').with_image_name('cirros') + is_expected.to contain_tempest_glance_id_setter('heat_plugin/minimal_image_ref').with_image_name('cirros') end end @@ -149,6 +151,7 @@ describe 'tempest' do { :configure_images => true, :image_name => 'image name', :image_name_alt => 'image name alt', + :heat_image_name => 'heat image name', :public_network_name => 'network name', :neutron_available => true, :install_from_source => true, @@ -205,7 +208,6 @@ describe 'tempest' do is_expected.to contain_tempest_config('auth/admin_system').with(:value => '') is_expected.to contain_tempest_config('auth/tempest_roles').with(:value => '') is_expected.to contain_tempest_config('auth/use_dynamic_credentials').with(:value => nil) - is_expected.to contain_tempest_config('dns/nameservers').with(:value => '') is_expected.to contain_tempest_config('compute/flavor_ref').with(:value => nil) is_expected.to contain_tempest_config('compute/flavor_ref_alt').with(:value => nil) is_expected.to contain_tempest_config('compute/image_ref').with(:value => nil) @@ -213,8 +215,6 @@ describe 'tempest' do is_expected.to contain_tempest_config('compute/build_interval').with(:value => nil) is_expected.to contain_tempest_config('compute-feature-enabled/attach_encrypted_volume').with(:value => false) is_expected.to contain_tempest_config('compute-feature-enabled/resize').with(:value => false) - is_expected.to contain_tempest_config('baremetal/driver').with(:value => 'fake') - is_expected.to contain_tempest_config('baremetal/enabled_hardware_types').with(:value => 'ipmi') is_expected.to contain_tempest_config('validation/image_ssh_user').with(:value => nil) is_expected.to contain_tempest_config('validation/image_alt_ssh_user').with(:value => nil) is_expected.to contain_tempest_config('validation/run_validation').with(:value => false) @@ -278,6 +278,24 @@ describe 'tempest' do is_expected.to contain_tempest_config('identity-feature-enabled/enforce_scope').with(:value => '') is_expected.to contain_tempest_config('enforce_scope/neutron').with(:value => '') is_expected.to contain_tempest_config('enforce_scope/nova').with(:value => '') + is_expected.to contain_tempest_config('dns/nameservers').with(:value => '') + is_expected.to contain_tempest_config('heat_plugin/auth_url').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/auth_version').with(:value => '3') + is_expected.to contain_tempest_config('heat_plugin/admin_password').with_secret( true ) + is_expected.to contain_tempest_config('heat_plugin/admin_project_name').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/admin_username').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/admin_project_domain_name').with(:value => '') + is_expected.to contain_tempest_config('heat_plugin/admin_user_domain_name').with(:value => '') + is_expected.to contain_tempest_config('heat_plugin/password').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/password').with_secret( true ) + is_expected.to contain_tempest_config('heat_plugin/project_name').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/username').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/image_ref').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/instance_type').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/minimal_image_ref').with(:value => nil) + is_expected.to contain_tempest_config('heat_plugin/minimal_instance_type').with(:value => nil) + is_expected.to contain_tempest_config('baremetal/driver').with(:value => 'fake') + is_expected.to contain_tempest_config('baremetal/enabled_hardware_types').with(:value => 'ipmi') is_expected.to contain_tempest_config('load_balancer/member_role').with(:value => '') is_expected.to contain_tempest_config('load_balancer/admin_role').with(:value => '') is_expected.to contain_tempest_config('load_balancer/observer_role').with(:value => '') @@ -307,12 +325,21 @@ describe 'tempest' do :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', :image_name => 'image name', ) - is_expected.to contain_tempest_glance_id_setter('compute/image_ref_alt').with( :ensure => 'present', :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', :image_name => 'image name alt', ) + is_expected.to contain_tempest_glance_id_setter('heat_plugin/image_ref').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :image_name => 'heat image name', + ) + is_expected.to contain_tempest_glance_id_setter('heat_plugin/minimal_image_ref').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :image_name => 'image name', + ) end it 'neutron net id' do @@ -392,6 +419,7 @@ describe 'tempest' do :flavor_name => 'm1.tiny', :flavor_name_alt => 'm1.nano', :db_flavor_name => 'm1.micro', + :heat_flavor_name => 'm1.small', } end @@ -411,6 +439,16 @@ describe 'tempest' do :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', :flavor_name => 'm1.micro', ) + is_expected.to contain_tempest_flavor_id_setter('heat_plugin/instance_type').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :flavor_name => 'm1.small', + ) + is_expected.to contain_tempest_flavor_id_setter('heat_plugin/minimal_instance_type').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :flavor_name => 'm1.tiny', + ) end end end