Add support for the [DEFAULT] event_alarm_cache_ttl parameter

Change-Id: I38389fffaf8128f5ac10b150332f546c609b7b9a
This commit is contained in:
Takashi Kajinami 2021-11-10 11:38:13 +09:00
parent 08fa7fd123
commit 09c0b80937
3 changed files with 28 additions and 12 deletions

View File

@ -21,6 +21,10 @@
# (optional) Period of evaluation cycle # (optional) Period of evaluation cycle
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*event_alarm_cache_ttl*]
# (optional) TTL of event alram caches, in seconds.
# Defaults to $::os_service_default.
#
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
# #
# [*coordination_url*] # [*coordination_url*]
@ -28,13 +32,14 @@
# Defaults to undef. # Defaults to undef.
# #
class aodh::evaluator ( class aodh::evaluator (
$manage_service = true, $manage_service = true,
$enabled = true, $enabled = true,
$package_ensure = 'present', $package_ensure = 'present',
$workers = $::os_workers, $workers = $::os_workers,
$evaluation_interval = $::os_service_default, $evaluation_interval = $::os_service_default,
$event_alarm_cache_ttl = $::os_service_default,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$coordination_url = undef, $coordination_url = undef,
) { ) {
include aodh::deps include aodh::deps
@ -46,8 +51,9 @@ class aodh::evaluator (
} }
aodh_config { aodh_config {
'DEFAULT/evaluation_interval' : value => $evaluation_interval; 'DEFAULT/evaluation_interval' : value => $evaluation_interval;
'evaluator/workers' : value => $workers; 'DEFAULT/event_alarm_cache_ttl': value => $event_alarm_cache_ttl;
'evaluator/workers' : value => $workers;
} }
package { 'aodh-evaluator': package { 'aodh-evaluator':

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``aodh::evaluator::event_alarm_cache_ttl`` parameter has been
added.

View File

@ -12,6 +12,7 @@ describe 'aodh::evaluator' do
it 'configures defaults' do it 'configures defaults' do
is_expected.to contain_aodh_config('evaluator/workers').with_value(4) is_expected.to contain_aodh_config('evaluator/workers').with_value(4)
is_expected.to contain_aodh_config('DEFAULT/evaluation_interval').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('DEFAULT/evaluation_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('DEFAULT/event_alarm_cache_ttl').with_value('<SERVICE DEFAULT>')
end end
end end
@ -25,12 +26,16 @@ describe 'aodh::evaluator' do
end end
end end
context 'with evaluation interval' do context 'with parameters defined' do
before do before do
params.merge!({ :evaluation_interval => '10' }) params.merge!({
:evaluation_interval => 10,
:event_alarm_cache_ttl => 60,
})
end end
it 'configures interval' do it 'configures parameters accordingly' do
is_expected.to contain_aodh_config('DEFAULT/evaluation_interval').with_value('10') is_expected.to contain_aodh_config('DEFAULT/evaluation_interval').with_value(10)
is_expected.to contain_aodh_config('DEFAULT/event_alarm_cache_ttl').with_value(60)
end end
end end