Support [api] operation_timeout

Change-Id: Iccc6b6f0632c7b20b0e2385467ae0cd459928128
This commit is contained in:
Takashi Kajinami 2022-03-22 17:07:32 +09:00
parent d4416af168
commit 04301ef449
3 changed files with 36 additions and 9 deletions

View File

@ -39,7 +39,12 @@
#
# [*paste_config*]
# (Optional) Path to API paste configuration.
# Defaults to $:;os_service_default
# Defaults to $::os_service_default.
#
# [*operation_timeout*]
# (Optional) Number of seconds before timeout when attempting to do some
# operations.
# Defaults to $::os_service_default.
#
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
@ -65,6 +70,7 @@ class gnocchi::api (
$sync_db = false,
$auth_strategy = 'keystone',
$paste_config = $::os_service_default,
$operation_timeout = $::os_service_default,
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
# DEPRECATED PARAMETERS
@ -125,9 +131,10 @@ standalone service, or httpd for being run by a httpd server")
}
gnocchi_config {
'api/max_limit': value => $max_limit;
'api/auth_mode': value => $auth_strategy;
'api/paste_config': value => $paste_config;
'api/max_limit': value => $max_limit;
'api/auth_mode': value => $auth_strategy;
'api/paste_config': value => $paste_config;
'api/operation_timeout': value => $operation_timeout;
}
oslo::middleware { 'gnocchi_config':

View File

@ -0,0 +1,4 @@
---
features:
- |
The ``gnochi::api::operation_timeout`` parameter has been added.

View File

@ -11,10 +11,9 @@ describe 'gnocchi::api' do
end
let :params do
{ :enabled => true,
:manage_service => true,
:package_ensure => 'latest',
:max_limit => '1000',
{ :enabled => true,
:manage_service => true,
:package_ensure => 'latest',
}
end
@ -58,9 +57,10 @@ describe 'gnocchi::api' do
end
it 'configures gnocchi-api' do
is_expected.to contain_gnocchi_config('api/max_limit').with_value( params[:max_limit] )
is_expected.to contain_gnocchi_config('api/max_limit').with_value(1000)
is_expected.to contain_gnocchi_config('api/auth_mode').with_value('keystone')
is_expected.to contain_gnocchi_config('api/paste_config').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('api/operation_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('gnocchi_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
@ -149,6 +149,14 @@ describe 'gnocchi::api' do
it_raises 'a Puppet::Error', /Invalid service_name/
end
context 'with max_limit' do
before do
params.merge!({:max_limit => 1001 })
end
it { is_expected.to contain_gnocchi_config('api/max_limit').with_value(1001) }
end
context 'with paste_config' do
before do
params.merge!({:paste_config => 'api-paste.ini' })
@ -157,6 +165,14 @@ describe 'gnocchi::api' do
it { is_expected.to contain_gnocchi_config('api/paste_config').with_value('api-paste.ini') }
end
context 'with operation_timeout' do
before do
params.merge!({:operation_timeout => 10 })
end
it { is_expected.to contain_gnocchi_config('api/operation_timeout').with_value(10) }
end
context 'with enable_proxy_headers_parsing' do
before do
params.merge!({:enable_proxy_headers_parsing => true })