Fix tests for concat 2.1.0

Depends-On: I8e3cd60fa50e04221aedf5c153c1ecb8a5bd97b5

Change-Id: I920479f9d5f0d94151c63a5fdc1445edf984a01a
Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
This commit is contained in:
Sergii Golovatiuk
2016-05-20 11:07:54 +02:00
parent 916943d5bb
commit a94df7b02a
25 changed files with 332 additions and 584 deletions

View File

@@ -22,19 +22,7 @@ require 'spec_helper'
describe 'swift::proxy::account_quotas' do describe 'swift::proxy::account_quotas' do
let :facts do it do
{} is_expected.to contain_concat_fragment('swift_account_quotas').with_content("\n[filter:account_quotas]\nuse = egg:swift#account_quotas\n")
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/80_swift_account_quotas"
end
it { is_expected.to contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) }
end end

View File

@@ -24,30 +24,25 @@ describe 'swift::proxy::authtoken' do
)} )}
end end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/22_swift_authtoken"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_authtoken').with_content('
[ [filter:authtoken]
'[filter:authtoken]', log_name = swift
'log_name = swift', signing_dir = /var/cache/swift
'signing_dir = /var/cache/swift', paste.filter_factory = keystonemiddleware.auth_token:filter_factory
'paste.filter_factory = keystonemiddleware.auth_token:filter_factory',
'auth_host = 127.0.0.1', auth_host = 127.0.0.1
'auth_port = 35357', auth_port = 35357
'auth_protocol = http', auth_protocol = http
'auth_uri = http://127.0.0.1:5000', auth_uri = http://127.0.0.1:5000
'admin_tenant_name = services', admin_tenant_name = services
'admin_user = swift', admin_user = swift
'admin_password = password', admin_password = password
'delay_auth_decision = 1', delay_auth_decision = 1
'cache = swift.cache', cache = swift.cache
'include_service_catalog = False' include_service_catalog = False
] ')
)
end end
end end
@@ -59,22 +54,7 @@ describe 'swift::proxy::authtoken' do
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_authtoken').with_content(/admin_token = ADMINTOKEN/)
[
'[filter:authtoken]',
'log_name = swift',
'signing_dir = /var/cache/swift',
'paste.filter_factory = keystonemiddleware.auth_token:filter_factory',
'auth_host = 127.0.0.1',
'auth_port = 35357',
'auth_protocol = http',
'auth_uri = http://127.0.0.1:5000',
'admin_token = ADMINTOKEN',
'delay_auth_decision = 1',
'cache = swift.cache',
'include_service_catalog = False'
]
)
end end
end end
@@ -95,25 +75,24 @@ describe 'swift::proxy::authtoken' do
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_authtoken').with_content('
[ [filter:authtoken]
'[filter:authtoken]', log_name = swift
'log_name = swift', signing_dir = /home/swift/keystone-signing
'signing_dir = /home/swift/keystone-signing', paste.filter_factory = keystonemiddleware.auth_token:filter_factory
'paste.filter_factory = keystonemiddleware.auth_token:filter_factory',
'auth_host = some.host', auth_host = some.host
'auth_port = 443', auth_port = 443
'auth_protocol = https', auth_protocol = https
'auth_admin_prefix = /keystone/admin', auth_admin_prefix = /keystone/admin
'auth_uri = https://some.host:5000', auth_uri = https://some.host:5000
'admin_tenant_name = admin', admin_tenant_name = admin
'admin_user = swiftuser', admin_user = swiftuser
'admin_password = swiftpassword', admin_password = swiftpassword
'delay_auth_decision = 0', delay_auth_decision = 0
'cache = foo', cache = foo
'include_service_catalog = False' include_service_catalog = False
] ')
)
end end
end end
@@ -122,7 +101,7 @@ describe 'swift::proxy::authtoken' do
{ :auth_uri => 'http://public.host/keystone/main' } { :auth_uri => 'http://public.host/keystone/main' }
end end
it { is_expected.to contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)} it { is_expected.to contain_concat_fragment('swift_authtoken').with_content(/auth_uri = http:\/\/public\.host\/keystone\/main/)}
end end
[ [
@@ -138,7 +117,7 @@ describe 'swift::proxy::authtoken' do
{ :auth_admin_prefix => auth_admin_prefix } { :auth_admin_prefix => auth_admin_prefix }
end end
it { expect { is_expected.to contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \ it { expect { is_expected.to contain_concat_fragment('swift_authtoken').with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \
raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) } raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
end end
end end
@@ -151,27 +130,10 @@ describe 'swift::proxy::authtoken' do
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_authtoken').with_content(/identity_uri = https:\/\/foo\.bar:35357\//)
[
'[filter:authtoken]',
'log_name = swift',
'signing_dir = /var/cache/swift',
'paste.filter_factory = keystonemiddleware.auth_token:filter_factory',
'auth_host = 127.0.0.1',
'auth_port = 35357',
'auth_protocol = http',
'auth_uri = http://127.0.0.1:5000',
'identity_uri = https://foo.bar:35357/',
'delay_auth_decision = 1',
'cache = swift.cache',
'include_service_catalog = False'
]
)
end end
end end
describe "when both auth_uri and identity_uri are set" do describe "when both auth_uri and identity_uri are set" do
let :params do let :params do
{ {
@@ -181,19 +143,8 @@ describe 'swift::proxy::authtoken' do
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_authtoken').with_content(/auth_uri = https:\/\/foo\.bar:5000\/v2\.0\//)
[ is_expected.to contain_concat_fragment('swift_authtoken').with_content(/identity_uri = https:\/\/foo\.bar:35357\//)
'[filter:authtoken]',
'log_name = swift',
'signing_dir = /var/cache/swift',
'paste.filter_factory = keystonemiddleware.auth_token:filter_factory',
'auth_uri = https://foo.bar:5000/v2.0/',
'identity_uri = https://foo.bar:35357/',
'delay_auth_decision = 1',
'cache = swift.cache',
'include_service_catalog = False'
]
)
end end
end end

View File

@@ -22,30 +22,16 @@ require 'spec_helper'
describe 'swift::proxy::bulk' do describe 'swift::proxy::bulk' do
let :facts do
{}
end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/21_swift_bulk"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_bulk').with_content('
[ [filter:bulk]
'[filter:bulk]', use = egg:swift#bulk
'use = egg:swift#bulk', max_containers_per_extraction = 10000
'max_containers_per_extraction = 10000', max_failed_extractions = 1000
'max_failed_extractions = 1000', max_deletes_per_request = 10000
'max_deletes_per_request = 10000', yield_frequency = 60
'yield_frequency = 60', ')
]
)
end end
end end
@@ -59,16 +45,14 @@ describe 'swift::proxy::bulk' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_bulk').with_content('
[ [filter:bulk]
'[filter:bulk]', use = egg:swift#bulk
'use = egg:swift#bulk', max_containers_per_extraction = 5000
'max_containers_per_extraction = 5000', max_failed_extractions = 500
'max_failed_extractions = 500', max_deletes_per_request = 5000
'max_deletes_per_request = 5000', yield_frequency = 10
'yield_frequency = 10', ')
]
)
end end
end end

View File

@@ -11,20 +11,15 @@ describe 'swift::proxy::cache' do
end end
let :pre_condition do let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": } 'class { "memcached": max_memory => 1 }'
class { "memcached": max_memory => 1 }'
end end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/23_swift_cache"
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:cache]/) } it { is_expected.to contain_concat_fragment('swift_cache').with_content(/\[filter:cache\]\nuse = egg:swift#memcache/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#memcache/) }
describe 'with defaults' do describe 'with defaults' do
it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) } it { is_expected.to contain_concat_fragment('swift_cache').with_content(/memcache_servers = 127\.0\.0\.1:11211/) }
end end
@@ -34,7 +29,7 @@ describe 'swift::proxy::cache' do
{:memcache_servers => '10.0.0.1:1'} {:memcache_servers => '10.0.0.1:1'}
end end
it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) } it { is_expected.to contain_concat_fragment('swift_cache').with_content(/memcache_servers = 10\.0\.0\.1:1/) }
end end
@@ -44,7 +39,7 @@ describe 'swift::proxy::cache' do
{:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']} {:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']}
end end
it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) } it { is_expected.to contain_concat_fragment('swift_cache').with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) }
end end

View File

@@ -10,11 +10,7 @@ describe 'swift::proxy::catch_errors' do
'concat { "/etc/swift/proxy-server.conf": }' 'concat { "/etc/swift/proxy-server.conf": }'
end end
let :fragment_file do it { is_expected.to contain_concat_fragment('swift_catch_errors').with_content(/[filter:catch_errors]/) }
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/24_swift_catch_errors" it { is_expected.to contain_concat_fragment('swift_catch_errors').with_content(/use = egg:swift#catch_errors/) }
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:catch_errors]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) }
end end

View File

@@ -15,19 +15,11 @@ describe 'swift::proxy::ceilometer' do
}' }'
end end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/33_swift_ceilometer"
end
describe "when using default parameters" do describe "when using default parameters" do
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/[filter:ceilometer]/) }
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/guest:guest@127.0.0.1:5672\//) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/url = rabbit:\/\/guest:guest@127.0.0.1:5672\//) }
if Puppet.version.to_f < 4.0
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[Ceilometer]')} it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[Ceilometer]')}
else
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[Ceilometer]')}
end
it { is_expected.to contain_user('swift').with_groups('ceilometer') } it { is_expected.to contain_user('swift').with_groups('ceilometer') }
it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') } it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
end end
@@ -48,12 +40,12 @@ describe 'swift::proxy::ceilometer' do
context 'with single rabbit host' do context 'with single rabbit host' do
it { is_expected.to contain_user('swift').with_groups('www-data') } it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/[filter:ceilometer]/) }
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/user_1:user_1_passw@1.1.1.1:5673\/rabbit/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/url = rabbit:\/\/user_1:user_1_passw@1.1.1.1:5673\/rabbit/) }
it { is_expected.to contain_file(fragment_file).with_content(/driver = messagingv2/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/driver = messagingv2/) }
it { is_expected.to contain_file(fragment_file).with_content(/topic = notifications/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/topic = notifications/) }
it { is_expected.to contain_file(fragment_file).with_content(/control_exchange = swift/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/control_exchange = swift/) }
end end
context 'with multiple rabbit hosts' do context 'with multiple rabbit hosts' do
@@ -62,12 +54,12 @@ describe 'swift::proxy::ceilometer' do
end end
it { is_expected.to contain_user('swift').with_groups('www-data') } it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/[filter:ceilometer]/) }
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/user_1:user_1_passw@127.0.0.1:5672,user_1:user_1_passw@127.0.0.2:5672\/rabbit/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/url = rabbit:\/\/user_1:user_1_passw@127.0.0.1:5672,user_1:user_1_passw@127.0.0.2:5672\/rabbit/) }
it { is_expected.to contain_file(fragment_file).with_content(/driver = messagingv2/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/driver = messagingv2/) }
it { is_expected.to contain_file(fragment_file).with_content(/topic = notifications/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/topic = notifications/) }
it { is_expected.to contain_file(fragment_file).with_content(/control_exchange = swift/) } it { is_expected.to contain_concat_fragment('swift_ceilometer').with_content(/control_exchange = swift/) }
end end
end end

View File

@@ -26,15 +26,7 @@ describe 'swift::proxy::container_quotas' do
{} {}
end end
let :pre_condition do it { is_expected.to contain_concat_fragment('swift_container_quotas').with_content(/\[filter:container_quotas\]/) }
'concat { "/etc/swift/proxy-server.conf": }' it { is_expected.to contain_concat_fragment('swift_container_quotas').with_content(/use = egg:swift#container_quotas/) }
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/81_swift_container_quotas"
end
it { is_expected.to contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) }
end end

View File

@@ -6,23 +6,13 @@ describe 'swift::proxy::crossdomain' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/35_swift_crossdomain"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_crossdomain').with_content('
[ [filter:crossdomain]
'[filter:crossdomain]', use = egg:swift#crossdomain
'use = egg:swift#crossdomain', cross_domain_policy = <allow-access-from domain="*" secure="false" />
'cross_domain_policy = <allow-access-from domain="*" secure="false" />', ')
]
)
end end
end end
@@ -34,14 +24,12 @@ describe 'swift::proxy::crossdomain' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_crossdomain').with_content('
[ [filter:crossdomain]
'[filter:crossdomain]', use = egg:swift#crossdomain
'use = egg:swift#crossdomain', cross_domain_policy = <allow-access-from domain="xml-fragment-in-ini-file.so.wrong" secure="true" />
'cross_domain_policy = <allow-access-from domain="xml-fragment-in-ini-file.so.wrong" secure="true" />', <allow-access-from domain="*" secure="false" />
'<allow-access-from domain="*" secure="false" />', ')
]
)
end end
end end

View File

@@ -6,21 +6,15 @@ describe 'swift::proxy::dlo' do
{} {}
end end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/36_swift_dlo"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_dlo').with_content('
[ [filter:dlo]
'[filter:dlo]', use = egg:swift#dlo
'use = egg:swift#dlo', rate_limit_after_segment = 10
'rate_limit_after_segment = 10', rate_limit_segments_per_sec = 1
'rate_limit_segments_per_sec = 1', max_get_time = 86400
'max_get_time = 86400', ')
]
)
end end
end end
@@ -33,15 +27,9 @@ describe 'swift::proxy::dlo' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_dlo').with_content(/rate_limit_after_segment = 30/)
[ is_expected.to contain_concat_fragment('swift_dlo').with_content(/rate_limit_segments_per_sec = 5/)
'[filter:dlo]', is_expected.to contain_concat_fragment('swift_dlo').with_content(/max_get_time = 6400/)
'use = egg:swift#dlo',
'rate_limit_after_segment = 30',
'rate_limit_segments_per_sec = 5',
'max_get_time = 6400',
]
)
end end
end end

View File

@@ -6,15 +6,7 @@ describe 'swift::proxy::formpost' do
{} {}
end end
let :pre_condition do it { is_expected.to contain_concat_fragment('swift-proxy-formpost').with_content(/[filter:formpost]/) }
'concat { "/etc/swift/proxy-server.conf": }' it { is_expected.to contain_concat_fragment('swift-proxy-formpost').with_content(/use = egg:swift#formpost/) }
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/31_swift-proxy-formpost"
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:formpost]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#formpost/) }
end end

View File

@@ -6,27 +6,17 @@ describe 'swift::proxy::gatekeeper' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/34_swift_gatekeeper"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_gatekeeper').with_content('
[ [filter:gatekeeper]
'[filter:gatekeeper]', use = egg:swift#gatekeeper
'use = egg:swift#gatekeeper', set log_name = gatekeeper
'set log_name = gatekeeper', set log_facility = LOG_LOCAL0
'set log_facility = LOG_LOCAL0', set log_level = INFO
'set log_level = INFO', set log_headers = false
'set log_headers = false', set log_address = /dev/log
'set log_address = /dev/log', ')
]
)
end end
end end
@@ -39,15 +29,9 @@ describe 'swift::proxy::gatekeeper' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_gatekeeper').with_content(/set log_name = newgatekeeper/)
[ is_expected.to contain_concat_fragment('swift_gatekeeper').with_content(/set log_facility = LOG_LOCAL2/)
'[filter:gatekeeper]', is_expected.to contain_concat_fragment('swift_gatekeeper').with_content(/set log_level = WARN/)
'use = egg:swift#gatekeeper',
'set log_name = newgatekeeper',
'set log_facility = LOG_LOCAL2',
'set log_level = WARN',
]
)
end end
end end

View File

@@ -6,15 +6,7 @@ describe 'swift::proxy::healthcheck' do
{} {}
end end
let :pre_condition do it { is_expected.to contain_concat_fragment('swift_healthcheck').with_content(/[filter:healthcheck]/) }
'concat { "/etc/swift/proxy-server.conf": }' it { is_expected.to contain_concat_fragment('swift_healthcheck').with_content(/use = egg:swift#healthcheck/) }
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/25_swift_healthcheck"
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:healthcheck]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) }
end end

View File

@@ -6,23 +6,17 @@ describe 'swift::proxy::keystone' do
{} {}
end end
let :fragment_file do
'/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/79_swift_keystone'
end
let :pre_condition do let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }' 'concat { "/etc/swift/proxy-server.conf": }'
end end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:keystone]/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/\[filter:keystone\]\nuse = egg:swift#keystoneauth/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) }
describe 'with defaults' do describe 'with defaults' do
it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/operator_roles = admin, SwiftOperator/) }
it { is_expected.to contain_file(fragment_file).with_content(/is_admin = true/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/is_admin = true/) }
it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/reseller_prefix = AUTH_/) }
end end
@@ -35,9 +29,9 @@ describe 'swift::proxy::keystone' do
:reseller_prefix => 'SWIFT_' :reseller_prefix => 'SWIFT_'
} }
it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = foo/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/operator_roles = foo/) }
it { is_expected.to contain_file(fragment_file).with_content(/is_admin = false/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/is_admin = false/) }
it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) } it { is_expected.to contain_concat_fragment('swift_keystone').with_content(/reseller_prefix = SWIFT_/) }
end end

View File

@@ -6,27 +6,17 @@ describe 'swift::proxy::ratelimit' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/26_swift_ratelimit"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_ratelimit').with_content('
[ [filter:ratelimit]
'[filter:ratelimit]', use = egg:swift#ratelimit
'use = egg:swift#ratelimit', clock_accuracy = 1000
'clock_accuracy = 1000', max_sleep_time_seconds = 60
'max_sleep_time_seconds = 60', log_sleep_time_seconds = 0
'log_sleep_time_seconds = 0', rate_buffer_seconds = 5
'rate_buffer_seconds = 5', account_ratelimit = 0
'account_ratelimit = 0', ')
]
)
end end
end end
@@ -41,17 +31,11 @@ describe 'swift::proxy::ratelimit' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_ratelimit').with_content(/clock_accuracy = 9436/)
[ is_expected.to contain_concat_fragment('swift_ratelimit').with_content(/max_sleep_time_seconds = 3600/)
'[filter:ratelimit]', is_expected.to contain_concat_fragment('swift_ratelimit').with_content(/log_sleep_time_seconds = 42/)
'use = egg:swift#ratelimit', is_expected.to contain_concat_fragment('swift_ratelimit').with_content(/rate_buffer_seconds = 51/)
'clock_accuracy = 9436', is_expected.to contain_concat_fragment('swift_ratelimit').with_content(/account_ratelimit = 69/)
'max_sleep_time_seconds = 3600',
'log_sleep_time_seconds = 42',
'rate_buffer_seconds = 51',
'account_ratelimit = 69',
]
)
end end
end end

View File

@@ -6,25 +6,15 @@ describe 'swift::proxy::s3token' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/28_swift_s3token"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_s3token').with_content('
[ [filter:s3token]
'[filter:s3token]', paste.filter_factory = keystonemiddleware.s3_token:filter_factory
'paste.filter_factory = keystonemiddleware.s3_token:filter_factory', auth_port = 35357
'auth_port = 35357', auth_protocol = http
'auth_protocol = http', auth_host = 127.0.0.1
'auth_host = 127.0.0.1' ')
]
)
end end
end end
@@ -37,15 +27,9 @@ describe 'swift::proxy::s3token' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_s3token').with_content(/auth_port = 4212/)
[ is_expected.to contain_concat_fragment('swift_s3token').with_content(/auth_protocol = https/)
'[filter:s3token]', is_expected.to contain_concat_fragment('swift_s3token').with_content(/auth_host = 1.2.3.4/)
'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
'auth_port = 4212',
'auth_protocol = https',
'auth_host = 1.2.3.4'
]
)
end end
end end

View File

@@ -6,28 +6,18 @@ describe 'swift::proxy::slo' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/35_swift_slo"
end
describe "when using default parameters" do describe "when using default parameters" do
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_slo').with_content('
[ [filter:slo]
'[filter:slo]', use = egg:swift#slo
'use = egg:swift#slo', max_manifest_segments = 1000
'max_manifest_segments = 1000', max_manifest_size = 2097152
'max_manifest_size = 2097152', min_segment_size = 1048576
'min_segment_size = 1048576', rate_limit_after_segment = 10
'rate_limit_after_segment = 10', rate_limit_segments_per_sec = 0
'rate_limit_segments_per_sec = 0', max_get_time = 86400
'max_get_time = 86400', ')
]
)
end end
end end
@@ -41,16 +31,10 @@ describe 'swift::proxy::slo' do
} }
end end
it 'should build the fragment with correct parameters' do it 'should build the fragment with correct parameters' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_slo').with_content(/max_manifest_segments = 2000/)
[ is_expected.to contain_concat_fragment('swift_slo').with_content(/max_manifest_size = 500000/)
'[filter:slo]', is_expected.to contain_concat_fragment('swift_slo').with_content(/rate_limit_after_segment = 30/)
'use = egg:swift#slo', is_expected.to contain_concat_fragment('swift_slo').with_content(/max_get_time = 6400/)
'max_manifest_segments = 2000',
'max_manifest_size = 500000',
'rate_limit_after_segment = 30',
'max_get_time = 6400',
]
)
end end
end end

View File

@@ -16,10 +16,6 @@ describe 'swift::proxy' do
} }
end end
let :fragment_path do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/00_swift_proxy"
end
describe 'with proper dependencies' do describe 'with proper dependencies' do
let :pre_condition do let :pre_condition do
@@ -50,37 +46,42 @@ describe 'swift::proxy' do
:tag => 'swift-service', :tag => 'swift-service',
} }
)} )}
it { is_expected.to contain_file('/etc/swift/proxy-server.conf').with(
{:ensure => 'present',
:owner => 'swift',
:group => 'swift',
}
)}
it 'should build the header file with all of the default contents' do it 'should build the header file with all of the default contents' do
verify_contents(catalogue, fragment_path, is_expected.to contain_concat_fragment('swift_proxy').with_content('# This file is managed by puppet. Do not edit
[ #
'[DEFAULT]', [DEFAULT]
'bind_port = 8080', bind_port = 8080
"workers = #{facts[:processorcount]}",
'user = swift', bind_ip = 127.0.0.1
'log_name = proxy-server',
'log_level = INFO', workers = 1
'log_headers = False', user = swift
'log_address = /dev/log', log_name = proxy-server
'[pipeline:main]', log_facility = LOG_LOCAL1
'pipeline = healthcheck cache tempauth proxy-server', log_level = INFO
'[app:proxy-server]', log_headers = False
'use = egg:swift#proxy', log_address = /dev/log
'set log_name = proxy-server',
'set log_facility = LOG_LOCAL1',
'set log_level = INFO',
'set log_address = /dev/log', [pipeline:main]
'log_handoffs = true', pipeline = healthcheck cache tempauth proxy-server
'allow_account_management = true',
'account_autocreate = true' [app:proxy-server]
] use = egg:swift#proxy
) set log_name = proxy-server
set log_facility = LOG_LOCAL1
set log_level = INFO
set log_address = /dev/log
log_handoffs = true
allow_account_management = true
account_autocreate = true
')
end end
it { is_expected.to contain_concat__fragment('swift_proxy').with_before( it { is_expected.to contain_concat__fragment('swift_proxy').with_before(
@@ -120,26 +121,41 @@ describe 'swift::proxy' do
} }
end end
it 'should build the header file with provided values' do it 'should build the header file with provided values' do
verify_contents(catalogue, fragment_path, is_expected.to contain_concat_fragment('swift_proxy').with_content('# This file is managed by puppet. Do not edit
[ #
'[DEFAULT]', [DEFAULT]
'bind_port = 80', bind_port = 80
"workers = 3",
'user = swift', bind_ip = 10.0.0.2
'log_level = DEBUG',
'[pipeline:main]', workers = 3
'pipeline = swauth proxy-server', user = swift
'[app:proxy-server]', log_name = swift-proxy-server
'use = egg:swift#proxy', log_facility = LOG_LOCAL1
'set log_name = swift-proxy-server', log_level = DEBUG
'allow_account_management = false', log_headers = False
'account_autocreate = false', log_address = /dev/log
'read_affinity = r1z1=100, r1=200',
'write_affinity = r1',
'write_affinity_node_count = 2 * replicas',
'node_timeout = 20' [pipeline:main]
] pipeline = swauth proxy-server
)
[app:proxy-server]
use = egg:swift#proxy
set log_name = swift-proxy-server
set log_facility = LOG_LOCAL1
set log_level = DEBUG
set log_address = /dev/log
log_handoffs = true
allow_account_management = false
account_autocreate = false
sorting_method = affinity
read_affinity = r1z1=100, r1=200
write_affinity = r1
write_affinity_node_count = 2 * replicas
node_timeout = 20
')
end end
if Puppet.version.to_f < 4.0 if Puppet.version.to_f < 4.0
it { is_expected.to contain_concat__fragment('swift_proxy').with_before('Class[Swift::Proxy::Swauth]')} it { is_expected.to contain_concat__fragment('swift_proxy').with_before('Class[Swift::Proxy::Swauth]')}
@@ -188,28 +204,42 @@ describe 'swift::proxy' do
} }
end end
it 'should build the header file with provided values' do it 'should build the header file with provided values' do
verify_contents(catalogue, fragment_path, is_expected.to contain_concat_fragment('swift_proxy').with_content('# This file is managed by puppet. Do not edit
[ #
'[DEFAULT]', [DEFAULT]
'bind_port = 80', bind_port = 80
"workers = 3",
'user = swift', bind_ip = 10.0.0.2
'log_level = DEBUG',
'log_udp_host = 127.0.0.1', workers = 3
'log_udp_port = 514', user = swift
'[pipeline:main]', log_name = swift-proxy-server
'pipeline = swauth proxy-server', log_facility = LOG_LOCAL1
'[app:proxy-server]', log_level = DEBUG
'use = egg:swift#proxy', log_headers = False
'set log_name = swift-proxy-server', log_address = /dev/log
'allow_account_management = false', # If set, log_udp_host will override log_address
'account_autocreate = false', log_udp_host = 127.0.0.1
'read_affinity = r1z1=100, r1=200', log_udp_port = 514
'write_affinity = r1',
'write_affinity_node_count = 2 * replicas', [pipeline:main]
'node_timeout = 20' pipeline = swauth proxy-server
]
) [app:proxy-server]
use = egg:swift#proxy
set log_name = swift-proxy-server
set log_facility = LOG_LOCAL1
set log_level = DEBUG
set log_address = /dev/log
log_handoffs = true
allow_account_management = false
account_autocreate = false
sorting_method = affinity
read_affinity = r1z1=100, r1=200
write_affinity = r1
write_affinity_node_count = 2 * replicas
node_timeout = 20
')
end end
end end
end end

View File

@@ -6,15 +6,7 @@ describe 'swift::proxy::staticweb' do
{} {}
end end
let :pre_condition do it { is_expected.to contain_concat_fragment('swift-proxy-staticweb').with_content(/[filter:staticweb]/) }
'concat { "/etc/swift/proxy-server.conf": }' it { is_expected.to contain_concat_fragment('swift-proxy-staticweb').with_content(/use = egg:swift#staticweb/) }
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/32_swift-proxy-staticweb"
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:staticweb]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) }
end end

View File

@@ -6,23 +6,15 @@ describe 'swift::proxy::swauth' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/20_swift_proxy_swauth"
end
it { is_expected.to contain_package('python-swauth').with_ensure('present') } it { is_expected.to contain_package('python-swauth').with_ensure('present') }
it { is_expected.to contain_file(fragment_file).with_content(/[filter:swauth]/) } it { is_expected.to contain_concat_fragment('swift_proxy_swauth').with_content(/[filter:swauth]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) } it { is_expected.to contain_concat_fragment('swift_proxy_swauth').with_content(/use = egg:swauth#swauth/) }
describe 'with defaults' do describe 'with defaults' do
it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) } it { is_expected.to contain_concat_fragment('swift_proxy_swauth').with_content(/default_swift_cluster = local#127\.0\.0\.1/) }
it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) } it { is_expected.to contain_concat_fragment('swift_proxy_swauth').with_content(/super_admin_key = swauthkey/) }
end end
@@ -34,8 +26,8 @@ describe 'swift::proxy::swauth' do
:package_ensure => 'latest' } :package_ensure => 'latest' }
end end
it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) } it { is_expected.to contain_concat_fragment('swift_proxy_swauth').with_content(/default_swift_cluster = local#10\.0\.0\.1/) }
it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = foo/) } it { is_expected.to contain_concat_fragment('swift_proxy_swauth').with_content(/super_admin_key = foo/) }
it { is_expected.to contain_package('python-swauth').with_ensure('latest') } it { is_expected.to contain_package('python-swauth').with_ensure('latest') }
end end

View File

@@ -15,7 +15,7 @@ describe 'swift::proxy::swift3' do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/27_swift_swift3" "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/27_swift_swift3"
end end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:swift3]/) } it { is_expected.to contain_concat_fragment('swift_swift3').with_content(/[filter:swift3]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) } it { is_expected.to contain_concat_fragment('swift_swift3').with_content(/use = egg:swift3#swift3/) }
end end

View File

@@ -19,20 +19,13 @@ describe 'swift::proxy::tempauth' do
'concat { "/etc/swift/proxy-server.conf": }' 'concat { "/etc/swift/proxy-server.conf": }'
end end
let :fragment_file do it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/\[filter:tempauth\]\nuse = egg:swift#tempauth/) }
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/01_swift-proxy-swauth"
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:tempauth]/) } it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/reseller_prefix/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#tempauth/) } it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/token_life/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/auth_prefix/) }
it { is_expected.to_not contain_file(fragment_file).with_content(/reseller_prefix/) } it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/storage_url_scheme/) }
it { is_expected.to_not contain_file(fragment_file).with_content(/token_life/) } it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/user_admin_admin = admin \.admin \.reseller_admin/) }
it { is_expected.to_not contain_file(fragment_file).with_content(/auth_prefix/) }
it { is_expected.to_not contain_file(fragment_file).with_content(/storage_url_scheme/) }
it { is_expected.to contain_file(fragment_file).with_content(
/user_admin_admin = admin \.admin \.reseller_admin/
) }
context 'declaring two users' do context 'declaring two users' do
let :params do { let :params do {
@@ -51,10 +44,10 @@ describe 'swift::proxy::tempauth' do
}, },
] ]
} end } end
it { is_expected.to contain_file(fragment_file).with_content( it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(
/user_admin_admin = admin \.admin \.reseller_admin/ /user_admin_admin = admin \.admin \.reseller_admin/
) } ) }
it { is_expected.to contain_file(fragment_file).with_content( it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(
/user_bar_foo = pass \.reseller_admin/ /user_bar_foo = pass \.reseller_admin/
) } ) }
end end
@@ -70,9 +63,7 @@ describe 'swift::proxy::tempauth' do
}, },
] ]
} end } end
it { is_expected.to contain_file(fragment_file).with_content( it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/user_admin_admin = admin $/) }
/user_admin_admin = admin $/
) }
end end
@@ -85,10 +76,10 @@ describe 'swift::proxy::tempauth' do
}.merge(default_params) }.merge(default_params)
end end
it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = AUTH/) } it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/reseller_prefix = AUTH/) }
it { is_expected.to contain_file(fragment_file).with_content(/token_life = 81600/) } it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/token_life = 81600/) }
it { is_expected.to contain_file(fragment_file).with_content(/auth_prefix = \/auth\//) } it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/auth_prefix = \/auth\//) }
it { is_expected.to contain_file(fragment_file).with_content(/storage_url_scheme = http/) } it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/storage_url_scheme = http/) }
describe "invalid params" do describe "invalid params" do
['account_user_list', 'token_life', 'auth_prefix', 'storage_url_scheme'].each do |param| ['account_user_list', 'token_life', 'auth_prefix', 'storage_url_scheme'].each do |param|

View File

@@ -10,19 +10,14 @@ describe 'swift::proxy::tempurl' do
'concat { "/etc/swift/proxy-server.conf": }' 'concat { "/etc/swift/proxy-server.conf": }'
end end
let :fragment_file do it { is_expected.to contain_concat_fragment('swift-proxy-tempurl').with_content(/\[filter:tempurl\]\nuse = egg:swift#tempurl/) }
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/29_swift-proxy-tempurl"
end
it { is_expected.to contain_file(fragment_file).with_content(/[filter:tempurl]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) }
['methods', ['methods',
'incoming_remove_headers', 'incoming_remove_headers',
'incoming_allow_headers', 'incoming_allow_headers',
'outgoing_remove_headers', 'outgoing_remove_headers',
'outgoing_allow_headers' ].each do |h| 'outgoing_allow_headers' ].each do |h|
it { is_expected.to_not contain_file(fragment_file).with_content(/#{h}/) } it { is_expected.to_not contain_concat_fragment('swift-proxy-tempurl').with_content(/#{h}/) }
end end
context "when params are set" do context "when params are set" do
@@ -34,12 +29,12 @@ describe 'swift::proxy::tempurl' do
'outgoing_allow_headers' => ['x-foo','x-bar-*'], 'outgoing_allow_headers' => ['x-foo','x-bar-*'],
} end } end
it { is_expected.to contain_file(fragment_file).with_content(/methods = GET HEAD PUT/) } it { is_expected.to contain_concat_fragment('swift-proxy-tempurl').with_content(/methods = GET HEAD PUT/) }
['incoming_remove_headers', ['incoming_remove_headers',
'incoming_allow_headers', 'incoming_allow_headers',
'outgoing_remove_headers', 'outgoing_remove_headers',
'outgoing_allow_headers' ].each do |h| 'outgoing_allow_headers' ].each do |h|
it { is_expected.to contain_file(fragment_file).with_content(/#{h} = x-foo x-bar-*/) } it { is_expected.to contain_concat_fragment('swift-proxy-tempurl').with_content(/#{h} = x-foo x-bar-*/) }
end end
describe 'when params are not array' do describe 'when params are not array' do
@@ -51,12 +46,12 @@ describe 'swift::proxy::tempurl' do
'outgoing_allow_headers' => 'x-foo x-bar-*', 'outgoing_allow_headers' => 'x-foo x-bar-*',
} end } end
it { is_expected.to contain_file(fragment_file).with_content(/methods = GET HEAD PUT/) } it { is_expected.to contain_concat_fragment('swift-proxy-tempurl').with_content(/methods = GET HEAD PUT/) }
['incoming_remove_headers', ['incoming_remove_headers',
'incoming_allow_headers', 'incoming_allow_headers',
'outgoing_remove_headers', 'outgoing_remove_headers',
'outgoing_allow_headers' ].each do |h| 'outgoing_allow_headers' ].each do |h|
it { is_expected.to contain_file(fragment_file).with_content(/#{h} = x-foo x-bar-*/) } it { is_expected.to contain_concat_fragment('swift-proxy-tempurl').with_content(/#{h} = x-foo x-bar-*/) }
end end
end end
end end

View File

@@ -9,21 +9,11 @@ describe 'swift::storage::filter::healthcheck' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/dummy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_dummy-server.conf/fragments/25_swift_healthcheck_dummy"
end
it 'should build the fragment with correct content' do it 'should build the fragment with correct content' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_healthcheck_dummy').with_content('
[ [filter:healthcheck]
'[filter:healthcheck]', use = egg:swift#healthcheck
'use = egg:swift#healthcheck' ')
]
)
end end
end end

View File

@@ -9,23 +9,13 @@ describe 'swift::storage::filter::recon' do
{} {}
end end
let :pre_condition do
'concat { "/etc/swift/dummy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_dummy-server.conf/fragments/35_swift_recon_dummy"
end
describe 'when passing default parameters' do describe 'when passing default parameters' do
it 'should build the fragment with correct content' do it 'should build the fragment with correct content' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_recon_dummy').with_content('
[ [filter:recon]
'[filter:recon]', use = egg:swift#recon
'use = egg:swift#recon', recon_cache_path = /var/cache/swift
'recon_cache_path = /var/cache/swift' ')
]
)
end end
end end
@@ -36,13 +26,7 @@ describe 'swift::storage::filter::recon' do
} }
end end
it 'should build the fragment with correct content' do it 'should build the fragment with correct content' do
verify_contents(catalogue, fragment_file, is_expected.to contain_concat_fragment('swift_recon_dummy').with_content(/recon_cache_path = \/some\/other\/path/)
[
'[filter:recon]',
'use = egg:swift#recon',
'recon_cache_path = /some/other/path'
]
)
end end
end end

View File

@@ -58,9 +58,6 @@ describe 'swift::storage::server' do
:enable => true, :enable => true,
:hasstatus => true, :hasstatus => true,
)} )}
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_#{t}-server.conf/fragments/00_swift-#{t}-#{title}"
end
describe 'when parameters are overridden' do describe 'when parameters are overridden' do
{ {
@@ -72,11 +69,7 @@ describe 'swift::storage::server' do
}.each do |k,v| }.each do |k,v|
describe "when #{k} is set" do describe "when #{k} is set" do
let :params do req_params.merge({k => v}) end let :params do req_params.merge({k => v}) end
it { is_expected.to contain_file(fragment_file) \ it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^#{k.to_s}\s*=\s*#{v.is_a?(Array) ? v.join(' ') : v}\s*$/) }
.with_content(
/^#{k.to_s}\s*=\s*#{v.is_a?(Array) ? v.join(' ') : v}\s*$/
)
}
end end
end end
describe "when pipeline is passed an array" do describe "when pipeline is passed an array" do
@@ -93,29 +86,23 @@ describe 'swift::storage::server' do
describe "when replicator_concurrency is set" do describe "when replicator_concurrency is set" do
let :params do req_params.merge({:replicator_concurrency => 42}) end let :params do req_params.merge({:replicator_concurrency => 42}) end
it { is_expected.to contain_file(fragment_file) \ it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m) }
.with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m)
}
end end
if t != 'account' if t != 'account'
describe "when updater_concurrency is set" do describe "when updater_concurrency is set" do
let :params do req_params.merge({:updater_concurrency => 73}) end let :params do req_params.merge({:updater_concurrency => 73}) end
it { is_expected.to contain_file(fragment_file) \ it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m) }
.with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m)
}
end end
else else
describe "when reaper_concurrency is set" do describe "when reaper_concurrency is set" do
let :params do req_params.merge({:reaper_concurrency => 4682}) end let :params do req_params.merge({:reaper_concurrency => 4682}) end
it { is_expected.to contain_file(fragment_file) \ it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m) }
.with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m)
}
end end
end end
if t == 'container' if t == 'container'
describe "when allow_versioning is set" do describe "when allow_versioning is set" do
let :params do req_params.merge({ :allow_versions => false, }) end let :params do req_params.merge({ :allow_versions => false, }) end
it { is_expected.to contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)} it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m) }
end end
end end
describe "when log_udp_port is set" do describe "when log_udp_port is set" do
@@ -128,8 +115,8 @@ describe 'swift::storage::server' do
{ :log_udp_host => '127.0.0.1', { :log_udp_host => '127.0.0.1',
:log_udp_port => '514'}) :log_udp_port => '514'})
end end
it { is_expected.to contain_file(fragment_file).with_content(/^log_udp_host\s*=\s*127\.0\.0\.1\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^log_udp_host\s*=\s*127\.0\.0\.1\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^log_udp_port\s*=\s*514\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^log_udp_port\s*=\s*514\s*$/) }
end end
end end
@@ -145,9 +132,7 @@ describe 'swift::storage::server' do
end end
describe "when log_requests is turned off" do describe "when log_requests is turned off" do
let :params do req_params.merge({:log_requests => false}) end let :params do req_params.merge({:log_requests => false}) end
it { is_expected.to contain_file(fragment_file) \ it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_requests\s*=\s*false\s*$/) }
.with_content(/^set log_requests\s*=\s*false\s*$/)
}
end end
end end
@@ -168,19 +153,20 @@ describe 'swift::storage::server' do
)} )}
# verify template lines # verify template lines
it { is_expected.to contain_file(fragment_file).with_content(/^devices\s*=\s*\/srv\/node\s*$/) } it { is_expected.to contain_concat("/etc/swift/#{t}-server.conf") }
it { is_expected.to contain_file(fragment_file).with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^devices\s*=\s*\/srv\/node\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^bind_port\s*=\s*#{title}\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^mount_check\s*=\s*true\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^bind_port\s*=\s*#{title}\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^user\s*=\s*swift\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^mount_check\s*=\s*true\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_name\s*=\s*#{t}-server\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^user\s*=\s*swift\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_name\s*=\s*#{t}-server\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_level\s*=\s*INFO\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_level\s*=\s*INFO\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_requests\s*=\s*true\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^workers\s*=\s*1\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_requests\s*=\s*true\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^concurrency\s*=\s*1\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^workers\s*=\s*1\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^pipeline\s*=\s*#{t}-server\s*$/) } it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^concurrency\s*=\s*1\s*$/) }
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^pipeline\s*=\s*#{t}-server\s*$/) }
end end
end end
end end