2015-09-10 15:51:52 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'swift::objectexpirer' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
|
2016-09-27 17:50:21 +10:00
|
|
|
let :pre_condition do
|
|
|
|
'class { "memcached": max_memory => 1 }'
|
|
|
|
end
|
2015-09-10 15:51:52 +02:00
|
|
|
|
2023-12-04 15:35:23 +09:00
|
|
|
shared_examples 'swift::objectexpirer' do
|
2016-09-27 17:50:21 +10:00
|
|
|
context 'with defaults' do
|
2024-06-10 22:05:44 +09:00
|
|
|
it { is_expected.to contain_file('/etc/swift/object-expirer.conf').with(
|
|
|
|
:ensure => 'file',
|
|
|
|
:owner => 'root',
|
|
|
|
:group => 'swift',
|
|
|
|
:mode => '0640',
|
|
|
|
)}
|
|
|
|
|
2016-09-27 17:50:21 +10:00
|
|
|
it 'configures object-expirer.conf' do
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'pipeline:main/pipeline').with_value('catch_errors proxy-logging cache proxy-server')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/concurrency').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/expiring_objects_account_name').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/interval').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/process').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/processes').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/reclaim_age').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/recon_cache_path').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/report_interval').with_value('<SERVICE DEFAULT>')
|
2024-02-20 11:32:35 +09:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'object-expirer/log_name').with_value('<SERVICE DEFAULT>')
|
2018-05-04 14:20:57 -04:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/log_level').with_value('INFO')
|
2018-05-04 14:20:57 -04:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'object-expirer/log_facility').with_value('LOG_LOCAL2')
|
2021-01-26 21:08:48 +09:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:35:23 +09:00
|
|
|
'filter:cache/memcache_servers').with_value('127.0.0.1:11211')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
2023-12-04 15:22:52 +09:00
|
|
|
'filter:cache/tls_enabled').with_value('<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_cafile').with_value('<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_certfile').with_value('<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_keyfile').with_value('<SERVICE DEFAULT>')
|
2016-09-27 17:50:21 +10:00
|
|
|
end
|
2015-09-10 15:51:52 +02:00
|
|
|
|
2016-09-27 17:50:21 +10:00
|
|
|
it 'configures object-expirer service' do
|
|
|
|
is_expected.to contain_service('swift-object-expirer').with(
|
2023-12-04 15:35:23 +09:00
|
|
|
:ensure => 'running',
|
2016-09-27 17:50:21 +10:00
|
|
|
:name => platform_params[:service_name],
|
|
|
|
:provider => platform_params[:service_provider],
|
2023-12-04 15:35:23 +09:00
|
|
|
:enable => true,
|
2016-09-27 17:50:21 +10:00
|
|
|
)
|
|
|
|
end
|
2015-09-10 15:51:52 +02:00
|
|
|
end
|
|
|
|
|
2022-06-27 16:56:49 +05:30
|
|
|
context 'when overriding parameters' do
|
2016-09-27 17:50:21 +10:00
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:interval => '600',
|
|
|
|
:reclaim_age => '10000',
|
|
|
|
:concurrency => '3',
|
|
|
|
)
|
|
|
|
end
|
2023-12-04 15:35:23 +09:00
|
|
|
it 'configures object-expirer.conf' do
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'object-expirer/concurrency').with_value('3')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'object-expirer/interval').with_value('600')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'object-expirer/reclaim_age').with_value('10000')
|
|
|
|
end
|
2015-09-10 15:51:52 +02:00
|
|
|
end
|
|
|
|
|
2021-01-26 21:08:48 +09:00
|
|
|
context 'when cache is not included in pipeline' do
|
2015-09-10 15:51:52 +02:00
|
|
|
before do
|
|
|
|
params.merge!(
|
2021-01-26 21:08:48 +09:00
|
|
|
:pipeline => ['catch_errors', 'proxy-logging', 'proxy-server'],
|
2015-09-10 15:51:52 +02:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2021-01-26 21:08:48 +09:00
|
|
|
it 'should not configure memcache servers' do
|
2023-12-04 15:40:24 +09:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'pipeline:main/pipeline').with_value('catch_errors proxy-logging proxy-server')
|
2022-04-06 10:37:58 +09:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/memcache_servers').with_ensure('absent')
|
2023-12-04 15:35:23 +09:00
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_enabled').with_ensure('absent')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_cafile').with_ensure('absent')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_certfile').with_ensure('absent')
|
|
|
|
is_expected.to contain_swift_object_expirer_config(
|
|
|
|
'filter:cache/tls_keyfile').with_ensure('absent')
|
2015-11-03 16:35:36 -05:00
|
|
|
end
|
|
|
|
end
|
2015-09-10 15:51:52 +02:00
|
|
|
end
|
|
|
|
|
2016-09-27 17:50:21 +10:00
|
|
|
on_supported_os({
|
|
|
|
:supported_os => OSDefaults.get_supported_os
|
|
|
|
}).each do |os,facts|
|
|
|
|
context "on #{os}" do
|
|
|
|
let (:facts) do
|
|
|
|
facts.merge!(OSDefaults.get_facts())
|
|
|
|
end
|
2015-09-10 15:51:52 +02:00
|
|
|
|
2016-09-27 17:50:21 +10:00
|
|
|
let(:platform_params) do
|
2023-03-02 12:49:54 +09:00
|
|
|
case facts[:os]['family']
|
2016-09-27 17:50:21 +10:00
|
|
|
when 'Debian'
|
2023-12-04 15:35:23 +09:00
|
|
|
{ :service_name => 'swift-object-expirer' }
|
2016-09-27 17:50:21 +10:00
|
|
|
when 'RedHat'
|
2023-12-04 15:35:23 +09:00
|
|
|
{ :service_name => 'openstack-swift-object-expirer' }
|
2015-09-10 15:51:52 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-04 15:35:23 +09:00
|
|
|
it_configures 'swift::objectexpirer'
|
2015-09-10 15:51:52 +02:00
|
|
|
end
|
2015-11-03 16:35:36 -05:00
|
|
|
|
2015-09-10 15:51:52 +02:00
|
|
|
end
|
|
|
|
end
|