drac: Improve parameter coverage

Change-Id: I4eb6ebd277e2edb15a2d13f5ffd204d9f9265159
This commit is contained in:
Takashi Kajinami 2024-09-26 22:44:44 +09:00
parent fc5ca834f3
commit 24eaa3ce04
3 changed files with 93 additions and 11 deletions

View File

@ -18,13 +18,56 @@
# (optional) The state of the sushy-oem-idrac package
# Defaults to 'present'
#
# [*query_raid_config_job_status_interval*]
# (optional) Interval (in seconds) between periodic RAID job status checks.
# Defaults to $facts['os_service_default']
#
# [*boot_device_job_status_timeout*]
# (optional) Maximum amount of time (in seconds) to wait for the boot device
# configuration.
# Defaults to $facts['os_service_default']
#
# [*config_job_max_retries*]
# (optional) Maximum number of retries for the configuration job to
# complete successfully
# Defaults to $facts['os_service_default']
#
# [*query_import_config_job_status_interval*]
# (optional) Number of seconds to wait between checking for completed
# import configuration task.
# Defaults to $facts['os_service_default']
#
# [*bios_factory_reset_timeout*]
# (optional) Maximum time (in seconds) to wait for factory reset of BIOS
# settings to complete.
# Defaults to $facts['os_service_default']
#
# [*raid_job_timeout*]
# (optional) Maximum time (in seconds) to wait for RAID job to complete.
# Defaults to $facts['os_service_default']
#
class ironic::drivers::drac (
$package_ensure = 'present',
$package_ensure = 'present',
$query_raid_config_job_status_interval = $facts['os_service_default'],
$boot_device_job_status_timeout = $facts['os_service_default'],
$config_job_max_retries = $facts['os_service_default'],
$query_import_config_job_status_interval = $facts['os_service_default'],
$bios_factory_reset_timeout = $facts['os_service_default'],
$raid_job_timeout = $facts['os_service_default'],
) {
include ironic::deps
include ironic::params
ironic_config {
'drac/query_raid_config_job_status_interval': value => $query_raid_config_job_status_interval;
'drac/boot_device_job_status_timeout': value => $boot_device_job_status_timeout;
'drac/config_job_max_retries': value => $config_job_max_retries;
'drac/query_import_config_job_status_interval': value => $query_import_config_job_status_interval;
'drac/bios_factory_reset_timeout': value => $bios_factory_reset_timeout;
'drac/raid_job_timeout': value => $raid_job_timeout;
}
package { 'python-sushy-oem-idrac':
ensure => $package_ensure,
name => $::ironic::params::sushy_oem_idrac_package_name,

View File

@ -0,0 +1,11 @@
---
features:
- |
The ``ironic::drivers::drac`` class now supports the following parameters.
- ``query_raid_config_job_status_interval``
- ``boot_device_job_status_timeout``
- ``config_job_max_retries``
- ``query_import_config_job_status_interval``
- ``bios_factory_reset_timeout``
- ``raid_job_timeout``

View File

@ -17,18 +17,46 @@ require 'spec_helper'
describe 'ironic::drivers::drac' do
let :params do
{}
end
shared_examples_for 'ironic drac driver' do
context 'with defaults' do
it 'configures drac options' do
is_expected.to contain_ironic_config('drac/query_raid_config_job_status_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('drac/boot_device_job_status_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('drac/config_job_max_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('drac/query_import_config_job_status_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('drac/bios_factory_reset_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('drac/raid_job_timeout').with_value('<SERVICE DEFAULT>')
end
it 'installs sushy-oem-idrac package' do
is_expected.to contain_package('python-sushy-oem-idrac').with(
:ensure => 'present',
:name => platform_params[:sushy_oem_idrac_package_name],
:tag => ['openstack', 'ironic-package'],
)
it 'installs sushy-oem-idrac package' do
is_expected.to contain_package('python-sushy-oem-idrac').with(
:ensure => 'present',
:name => platform_params[:sushy_oem_idrac_package_name],
:tag => ['openstack', 'ironic-package'],
)
end
end
context 'with parameters' do
let :params do
{
:query_raid_config_job_status_interval => 120,
:boot_device_job_status_timeout => 30,
:config_job_max_retries => 240,
:query_import_config_job_status_interval => 0,
:bios_factory_reset_timeout => 600,
:raid_job_timeout => 300,
}
end
it 'configures drac options' do
is_expected.to contain_ironic_config('drac/query_raid_config_job_status_interval').with_value(120)
is_expected.to contain_ironic_config('drac/boot_device_job_status_timeout').with_value(30)
is_expected.to contain_ironic_config('drac/config_job_max_retries').with_value(240)
is_expected.to contain_ironic_config('drac/query_import_config_job_status_interval').with_value(0)
is_expected.to contain_ironic_config('drac/bios_factory_reset_timeout').with_value(600)
is_expected.to contain_ironic_config('drac/raid_job_timeout').with_value(300)
end
end
end