diff --git a/manifests/api.pp b/manifests/api.pp index c606ad27..d54351bc 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -119,6 +119,26 @@ # (optional) CA certificate file to use to verify connecting clients # Defaults to false, not set # +# [*http_get_rate*] +# (optional) Default rate limit of GET request. +# Defaults to 200. +# +# [*http_post_rate*] +# (optional) Default rate limit of POST request. +# Defaults to 200. +# +# [*http_put_rate*] +# (optional) Default rate limit of PUT request. +# Defaults to 200. +# +# [*http_delete_rate*] +# (optional) Default rate limit of DELETE request. +# Defaults to 200. +# +# [*http_mgmt_post_rate*] +# (optional) Default rate limit of mgmt post request. +# Defaults to 200. +# class trove::api( $keystone_password, $verbose = false, @@ -142,6 +162,11 @@ class trove::api( $cert_file = false, $key_file = false, $ca_file = false, + $http_get_rate = 200, + $http_post_rate = 200, + $http_put_rate = 200, + $http_delete_rate = 200, + $http_mgmt_post_rate = 200, $manage_service = true, $ensure_package = 'present', ) inherits trove { @@ -272,6 +297,15 @@ class trove::api( } } + # rate limits + trove_config { + 'DEFAULT/http_get_rate': value => $http_get_rate; + 'DEFAULT/http_post_rate': value => $http_post_rate; + 'DEFAULT/http_put_rate': value => $http_put_rate; + 'DEFAULT/http_delete_rate': value => $http_delete_rate; + 'DEFAULT/http_mgmt_post_rate': value => $http_mgmt_post_rate; + } + resources { 'trove_config': purge => $purge_config, } diff --git a/spec/classes/trove_api_spec.rb b/spec/classes/trove_api_spec.rb index b0bce16c..c8f0972d 100644 --- a/spec/classes/trove_api_spec.rb +++ b/spec/classes/trove_api_spec.rb @@ -84,6 +84,32 @@ describe 'trove::api' do is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store') is_expected.to contain_trove_config('DEFAULT/heat_service_type').with_value('orchestration') is_expected.to contain_trove_config('DEFAULT/neutron_service_type').with_value('network') + is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('200') + end + + + context 'with overridden rate limit parameters' do + before :each do + params.merge!( + :http_get_rate => '1000', + :http_post_rate => '1000', + :http_put_rate => '1000', + :http_delete_rate => '1000', + :http_mgmt_post_rate => '2000', + ) + end + + it 'contains overrided rate limit values' do + is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('2000') + end end context 'when using a single RabbitMQ server' do