1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
require 'spec_helper'
describe 'swift::objectexpirer' do
let :params do
{}
end
let :pre_condition do
'class { "memcached": max_memory => 1 }'
end
shared_examples 'swift::objectexpirer' do
context 'with defaults' do
it { is_expected.to contain_file('/etc/swift/object-expirer.conf').with(
:ensure => 'file',
:owner => 'root',
:group => 'swift',
:mode => '0640',
)}
it 'configures object-expirer.conf' do
is_expected.to contain_swift_object_expirer_config(
'pipeline:main/pipeline').with_value('catch_errors proxy-logging cache proxy-server')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/concurrency').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/expiring_objects_account_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/process').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/processes').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/reclaim_age').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/recon_cache_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/report_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/log_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/log_level').with_value('INFO')
is_expected.to contain_swift_object_expirer_config(
'object-expirer/log_facility').with_value('LOG_LOCAL2')
is_expected.to contain_swift_object_expirer_config(
'filter:cache/memcache_servers').with_value('127.0.0.1:11211')
is_expected.to contain_swift_object_expirer_config(
'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>')
end
it 'configures object-expirer service' do
is_expected.to contain_service('swift-object-expirer').with(
:ensure => 'running',
:name => platform_params[:service_name],
:provider => platform_params[:service_provider],
:enable => true,
)
end
end
context 'when overriding parameters' do
before do
params.merge!(
:interval => '600',
:reclaim_age => '10000',
:concurrency => '3',
)
end
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
end
context 'when cache is not included in pipeline' do
before do
params.merge!(
:pipeline => ['catch_errors', 'proxy-logging', 'proxy-server'],
)
end
it 'should not configure memcache servers' do
is_expected.to contain_swift_object_expirer_config(
'pipeline:main/pipeline').with_value('catch_errors proxy-logging proxy-server')
is_expected.to contain_swift_object_expirer_config(
'filter:cache/memcache_servers').with_ensure('absent')
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')
end
end
end
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
let(:platform_params) do
case facts[:os]['family']
when 'Debian'
{ :service_name => 'swift-object-expirer' }
when 'RedHat'
{ :service_name => 'openstack-swift-object-expirer' }
end
end
it_configures 'swift::objectexpirer'
end
end
end
|