Do not hard-code defaults of [filter:slo] parameters

... but use the default values defined in swift itself.

Change-Id: Ic140589cf76c8d8f0a82ba259b4940f565cabaa5
This commit is contained in:
Takashi Kajinami 2021-12-19 23:48:58 +09:00
parent 7017388604
commit cbf5c60e80
2 changed files with 30 additions and 28 deletions

View File

@ -9,11 +9,11 @@
#
# [*max_manifest_segments*]
# (Optional) Max manifest segments.
# Defaults to 1000.
# Defaults to $::os_service_default.
#
# [*max_manifest_size*]
# (Optional) Max manifest size.
# Defaults to 8388608.
# Defaults to $::os_service_default.
#
# [*rate_limit_under_size*]
# (Optional) Rate limiting applies only to segments smaller than this size.
@ -22,16 +22,16 @@
# [*rate_limit_after_segment*]
# (Optional) Start rate-limiting SLO segment serving after the Nth segment of
# a segmented object.
# Defaults to 10.
# Defaults to $::os_service_default.
#
# [*rate_limit_segments_per_sec*]
# (Optional) Once segment rate-limiting kicks in for an object, limit segments
# served to N per second. 0 means no rate-limiting.
# Defaults to 1.
# Defaults to $::os_service_default.
#
# [*max_get_time*]
# (Optional) Time limit on GET requests (seconds).
# Defaults to 86400.
# Defaults to $::os_service_default.
#
# [*concurrency*]
# (Optional) Limit how many subrequests may be executed concurrently.
@ -68,12 +68,12 @@
# Copyright 2014 UnitedStack licensing@unitedstack.com
#
class swift::proxy::slo (
$max_manifest_segments = '1000',
$max_manifest_size = '8388608',
$max_manifest_segments = $::os_service_default,
$max_manifest_size = $::os_service_default,
$rate_limit_under_size = $::os_service_default,
$rate_limit_after_segment = '10',
$rate_limit_segments_per_sec = '1',
$max_get_time = '86400',
$rate_limit_after_segment = $::os_service_default,
$rate_limit_segments_per_sec = $::os_service_default,
$max_get_time = $::os_service_default,
$concurrency = $::os_service_default,
$delete_concurrency = $::os_service_default,
$yield_frequency = $::os_service_default,

View File

@ -4,12 +4,12 @@ describe 'swift::proxy::slo' do
shared_examples 'swift::proxy::slo' do
describe "when using default parameters" do
it { is_expected.to contain_swift_proxy_config('filter:slo/use').with_value('egg:swift#slo') }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value('1000') }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value('8388608') }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_under_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value('10') }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_segments_per_sec').with_value('1') }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('86400') }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_segments_per_sec').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/concurrency').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/delete_concurrency').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_swift_proxy_config('filter:slo/yield_frequency').with_value('<SERVICE DEFAULT>') }
@ -19,11 +19,12 @@ describe 'swift::proxy::slo' do
describe "when overriding default parameters" do
let :params do
{
:max_manifest_segments => 2000,
:max_manifest_size => 500000,
:max_manifest_segments => 1000,
:max_manifest_size => 8388608,
:rate_limit_under_size => 1048576,
:rate_limit_after_segment => 30,
:max_get_time => 6400,
:rate_limit_after_segment => 10,
:rate_limit_segments_per_sec => 1,
:max_get_time => 86400,
:concurrency => 2,
:delete_concurrency => 4,
:yield_frequency => 10,
@ -31,11 +32,12 @@ describe 'swift::proxy::slo' do
}
end
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value(2000) }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value(500000) }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value(1000) }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value(8388608) }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_under_size').with_value(1048576) }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value(30) }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value(6400) }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value(10) }
it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_segments_per_sec').with_value(1) }
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value(86400) }
it { is_expected.to contain_swift_proxy_config('filter:slo/concurrency').with_value(2) }
it { is_expected.to contain_swift_proxy_config('filter:slo/delete_concurrency').with_value(4) }
it { is_expected.to contain_swift_proxy_config('filter:slo/yield_frequency').with_value(10) }