Fix rspec-puppet-facts testing
Moves all spec tests over to using rspec-puppet-facts and runs the tests for all our supported operating systems. Change-Id: Ie2d60acac835affaf46a5276c9755640a723bca4
This commit is contained in:
parent
ca7070a567
commit
e7d670b13a
|
@ -25,70 +25,80 @@ describe 'swift::bench' do
|
|||
"class { 'swift': swift_hash_path_suffix => 'string' }"
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian'
|
||||
})
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
default_params
|
||||
end
|
||||
|
||||
shared_examples 'swift::bench' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
describe 'with defaults' do
|
||||
it 'configures swift-bench.conf' do
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth').with_value(params[:auth_url])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/user').with_value(params[:swift_user])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/key').with_value(params[:swift_key])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth_version').with_value(params[:auth_version])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/log-level').with_value(params[:log_level])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/timeout').with_value(params[:test_timeout])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/put_concurrency').with_value(params[:put_concurrency])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/get_concurrency').with_value(params[:get_concurrency])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/get_concurrency').with_value(params[:get_concurrency])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/lower_object_size').with_value(params[:lower_object_size])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/upper_object_size').with_value(params[:upper_object_size])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/object_size').with_value(params[:object_size])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_objects').with_value(params[:num_objects])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_gets').with_value(params[:num_gets])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_containers').with_value(params[:num_containers])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/delete').with_value(params[:delete])
|
||||
end
|
||||
end
|
||||
|
||||
it 'configures swift-bench.conf' do
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth').with_value(p[:auth_url])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/user').with_value(p[:swift_user])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/key').with_value(p[:swift_key])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth_version').with_value(p[:auth_version])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/log-level').with_value(p[:log_level])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/timeout').with_value(p[:test_timeout])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/put_concurrency').with_value(p[:put_concurrency])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/get_concurrency').with_value(p[:get_concurrency])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/get_concurrency').with_value(p[:get_concurrency])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/lower_object_size').with_value(p[:lower_object_size])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/upper_object_size').with_value(p[:upper_object_size])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/object_size').with_value(p[:object_size])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_objects').with_value(p[:num_objects])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_gets').with_value(p[:num_gets])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_containers').with_value(p[:num_containers])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/delete').with_value(p[:delete])
|
||||
describe 'with overriden' do
|
||||
before do
|
||||
params.merge!(
|
||||
:auth_url => 'http://127.0.0.1:8080/auth/v1.0',
|
||||
:swift_user => 'admin:admin',
|
||||
:swift_key => 'admin',
|
||||
:put_concurrency => '20'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures swift-bench.conf' do
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth').with_value(params[:auth_url])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/user').with_value(params[:swift_user])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/key').with_value(params[:swift_key])
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/put_concurrency').with_value(params[:put_concurrency])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with defaults' do
|
||||
include_examples 'swift::bench'
|
||||
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
|
||||
|
||||
describe 'when overridding' do
|
||||
before do
|
||||
params.merge!(
|
||||
:auth_url => 'http://127.0.0.1:8080/auth/v1.0',
|
||||
:swift_user => 'admin:admin',
|
||||
:swift_key => 'admin',
|
||||
:put_concurrency => '20'
|
||||
)
|
||||
it_configures 'swift::bench'
|
||||
end
|
||||
|
||||
include_examples 'swift::bench'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ describe 'swift::client' do
|
|||
{ :package_ensure => 'present' }
|
||||
end
|
||||
|
||||
shared_examples_for 'swift client' do
|
||||
shared_examples 'swift::client' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ describe 'swift::client' do
|
|||
end
|
||||
end
|
||||
|
||||
it_configures 'swift client'
|
||||
it_configures 'swift::client'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::config' do
|
||||
|
||||
let :params do
|
||||
{ :swift_config => {
|
||||
'DEFAULT/foo' => { 'value' => 'fooValue' },
|
||||
|
@ -16,15 +15,29 @@ describe 'swift::config' do
|
|||
}
|
||||
end
|
||||
|
||||
it 'configures arbitrary swift configurations' do
|
||||
is_expected.to contain_swift_config('DEFAULT/foo').with_value('fooValue')
|
||||
is_expected.to contain_swift_config('DEFAULT/bar').with_value('barValue')
|
||||
is_expected.to contain_swift_config('DEFAULT/baz').with_ensure('absent')
|
||||
end
|
||||
it 'configures arbitrary swift proxy configurations' do
|
||||
is_expected.to contain_swift_proxy_config('DEFAULT/foo').with_value('fooValue')
|
||||
is_expected.to contain_swift_proxy_config('DEFAULT/bar').with_value('barValue')
|
||||
is_expected.to contain_swift_proxy_config('DEFAULT/baz').with_ensure('absent')
|
||||
shared_examples 'swift::config' do
|
||||
it 'configures arbitrary swift configurations' do
|
||||
is_expected.to contain_swift_config('DEFAULT/foo').with_value('fooValue')
|
||||
is_expected.to contain_swift_config('DEFAULT/bar').with_value('barValue')
|
||||
is_expected.to contain_swift_config('DEFAULT/baz').with_ensure('absent')
|
||||
end
|
||||
|
||||
it 'configures arbitrary swift proxy configurations' do
|
||||
is_expected.to contain_swift_proxy_config('DEFAULT/foo').with_value('fooValue')
|
||||
is_expected.to contain_swift_proxy_config('DEFAULT/bar').with_value('barValue')
|
||||
is_expected.to contain_swift_proxy_config('DEFAULT/baz').with_ensure('absent')
|
||||
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
|
||||
|
||||
it_configures 'swift::config'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ describe 'swift::containerreconciler' do
|
|||
'class { "memcached": max_memory => 1 }'
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-container-reconciler' do
|
||||
shared_examples 'swift::container::reconciler' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
|
||||
context 'with defaults' do
|
||||
|
@ -101,7 +101,7 @@ describe 'swift::containerreconciler' do
|
|||
end
|
||||
end
|
||||
|
||||
it_configures 'swift-container-reconciler'
|
||||
it_configures 'swift::container::reconciler'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,79 +20,83 @@ describe 'swift::dispersion' do
|
|||
"class { 'swift': swift_hash_path_suffix => 'string' }"
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({ :osfamily => 'Debian' })
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_file('/etc/swift/dispersion.conf').with(
|
||||
:ensure => 'file',
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
:mode => '0640',)
|
||||
}
|
||||
|
||||
shared_examples 'swift::dispersion' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
describe 'with default' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
|
||||
it 'configures dispersion.conf' do
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_url').with_value(p[:auth_url])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_version').with_value(p[:auth_version])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_user').with_value("#{p[:auth_tenant]}:#{p[:auth_user]}")
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_key').with_value(p[:auth_pass])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/endpoint_type').with_value(p[:endpoint_type])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/swift_dir').with_value(p[:swift_dir])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/dispersion_coverage').with_value(p[:coverage])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/retries').with_value(p[:retries])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/concurrency').with_value(p[:concurrency])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/dump_json').with_value(p[:dump_json])
|
||||
it { should contain_file('/etc/swift/dispersion.conf').with(
|
||||
:ensure => 'file',
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
:mode => '0640',
|
||||
)}
|
||||
|
||||
it 'configures dispersion.conf' do
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_url').with_value(p[:auth_url])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_version').with_value(p[:auth_version])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_user').with_value("#{p[:auth_tenant]}:#{p[:auth_user]}")
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_key').with_value(p[:auth_pass])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/endpoint_type').with_value(p[:endpoint_type])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/swift_dir').with_value(p[:swift_dir])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/dispersion_coverage').with_value(p[:coverage])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/retries').with_value(p[:retries])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/concurrency').with_value(p[:concurrency])
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/dump_json').with_value(p[:dump_json])
|
||||
end
|
||||
|
||||
it 'triggers swift-dispersion-populate' do
|
||||
is_expected.to contain_exec('swift-dispersion-populate').with(
|
||||
:path => ['/bin', '/usr/bin'],
|
||||
:subscribe => 'File[/etc/swift/dispersion.conf]',
|
||||
:onlyif => "swift -A #{p[:auth_url]} --os-username #{p[:auth_user]} --os-project-name #{p[:auth_tenant]} --os-password #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '",
|
||||
:unless => "swift -A #{p[:auth_url]} --os-username #{p[:auth_user]} --os-project-name #{p[:auth_tenant]} --os-password #{p[:auth_pass]} -V #{p[:auth_version]} list | grep dispersion_",
|
||||
:require => 'Package[swiftclient]'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
it 'triggers swift-dispersion-populate' do
|
||||
is_expected.to contain_exec('swift-dispersion-populate').with(
|
||||
:path => ['/bin', '/usr/bin'],
|
||||
:subscribe => 'File[/etc/swift/dispersion.conf]',
|
||||
:onlyif => "swift -A #{p[:auth_url]} --os-username #{p[:auth_user]} --os-project-name #{p[:auth_tenant]} --os-password #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '",
|
||||
:unless => "swift -A #{p[:auth_url]} --os-username #{p[:auth_user]} --os-project-name #{p[:auth_tenant]} --os-password #{p[:auth_pass]} -V #{p[:auth_version]} list | grep dispersion_",
|
||||
:require => 'Package[swiftclient]'
|
||||
)
|
||||
describe 'with override' do
|
||||
before do
|
||||
params.merge!(
|
||||
:auth_url => 'https://10.0.0.10:7000/auth/v8.0/',
|
||||
:auth_user => 'foo',
|
||||
:auth_tenant => 'bar',
|
||||
:auth_pass => 'dummy',
|
||||
:auth_version => '1.0',
|
||||
:endpoint_type => 'internalURL',
|
||||
:swift_dir => '/usr/local/etc/swift',
|
||||
:coverage => 42,
|
||||
:retries => 51,
|
||||
:concurrency => 4682,
|
||||
:dump_json => 'yes'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
include_examples 'swift::dispersion'
|
||||
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({ :puppetversion => '4.8.0' }))
|
||||
end
|
||||
|
||||
describe 'when parameters are overridden' do
|
||||
before do
|
||||
params.merge!(
|
||||
:auth_url => 'https://10.0.0.10:7000/auth/v8.0/',
|
||||
:auth_user => 'foo',
|
||||
:auth_tenant => 'bar',
|
||||
:auth_pass => 'dummy',
|
||||
:auth_version => '1.0',
|
||||
:endpoint_type => 'internalURL',
|
||||
:swift_dir => '/usr/local/etc/swift',
|
||||
:coverage => 42,
|
||||
:retries => 51,
|
||||
:concurrency => 4682,
|
||||
:dump_json => 'yes'
|
||||
)
|
||||
it_configures 'swift::dispersion'
|
||||
end
|
||||
|
||||
include_examples 'swift::dispersion'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,32 +1,41 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::keymaster' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/api_class').with_value('castellan.key_manager.barbican_key_manager.BarbicanKeyManager') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/username').with_value('swift') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_name').with_value('service') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/user_domain_id').with_value('default') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:key_id => 'dummy_key_id',
|
||||
:password => 'fake_password',
|
||||
:auth_endpoint => 'http://127.0.0.1:5000',
|
||||
:project_name => 'barbican_swift_service',
|
||||
}
|
||||
shared_examples 'swift::keymaster' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/api_class').with_value('castellan.key_manager.barbican_key_manager.BarbicanKeyManager') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/username').with_value('swift') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_name').with_value('service') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/user_domain_id').with_value('default') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:key_id => 'dummy_key_id',
|
||||
:password => 'fake_password',
|
||||
:auth_endpoint => 'http://127.0.0.1:5000',
|
||||
:project_name => 'barbican_swift_service',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/key_id').with_value('dummy_key_id') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/password').with_value('fake_password') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/auth_endpoint').with_value('http://127.0.0.1:5000') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_name').with_value('barbican_swift_service') }
|
||||
end
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/key_id').with_value('dummy_key_id') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/password').with_value('fake_password') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/auth_endpoint').with_value('http://127.0.0.1:5000') }
|
||||
it { is_expected.to contain_swift_keymaster_config('kms_keymaster/project_name').with_value('barbican_swift_service') }
|
||||
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
|
||||
|
||||
it_configures 'swift::keymaster'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::keystone::auth' do
|
||||
|
||||
let :params do
|
||||
{ }
|
||||
end
|
||||
|
@ -25,9 +24,9 @@ describe 'swift::keystone::auth' do
|
|||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'swift keystone auth' do
|
||||
shared_examples 'swift::keystone::auth' do
|
||||
context 'with default class parameters' do
|
||||
it_configures 'keystone auth configuration'
|
||||
it_configures 'keystone::auth::configuration'
|
||||
|
||||
['admin', 'SwiftOperator'].each do |role_name|
|
||||
it { is_expected.to contain_keystone_role(role_name).with_ensure('present') }
|
||||
|
@ -52,7 +51,7 @@ describe 'swift::keystone::auth' do
|
|||
})
|
||||
end
|
||||
|
||||
it_configures 'keystone auth configuration'
|
||||
it_configures 'keystone::auth::configuration'
|
||||
|
||||
['admin', 'SwiftOperator', 'Gopher'].each do |role_name|
|
||||
it { is_expected.to contain_keystone_role(role_name).with_ensure('present') }
|
||||
|
@ -90,9 +89,35 @@ describe 'swift::keystone::auth' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when overriding service name' do
|
||||
before do
|
||||
params.merge!({
|
||||
:service_name => 'swift_service',
|
||||
:service_name_s3 => 'swift_service_s3',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures correct user name' do
|
||||
is_expected.to contain_keystone_user('swift')
|
||||
end
|
||||
|
||||
it 'configures correct user role' do
|
||||
is_expected.to contain_keystone_user_role('swift@services')
|
||||
end
|
||||
|
||||
it 'configures correct service name' do
|
||||
is_expected.to contain_keystone_service('swift_service::object-store')
|
||||
is_expected.to contain_keystone_service('swift_service_s3::s3')
|
||||
end
|
||||
|
||||
it 'configures correct endpoint name' do
|
||||
is_expected.to contain_keystone_endpoint('RegionOne/swift_service::object-store')
|
||||
is_expected.to contain_keystone_endpoint('RegionOne/swift_service_s3::s3')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'keystone auth configuration' do
|
||||
shared_examples 'keystone::auth::configuration' do
|
||||
let :p do
|
||||
default_params.merge( params )
|
||||
end
|
||||
|
@ -157,43 +182,15 @@ describe 'swift::keystone::auth' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
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
|
||||
|
||||
it_configures 'swift keystone auth'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
it_configures 'swift keystone auth'
|
||||
end
|
||||
|
||||
context 'when overriding service name' do
|
||||
before do
|
||||
params.merge!({
|
||||
:service_name => 'swift_service',
|
||||
:service_name_s3 => 'swift_service_s3',
|
||||
})
|
||||
end
|
||||
it 'configures correct user name' do
|
||||
is_expected.to contain_keystone_user('swift')
|
||||
end
|
||||
it 'configures correct user role' do
|
||||
is_expected.to contain_keystone_user_role('swift@services')
|
||||
end
|
||||
it 'configures correct service name' do
|
||||
is_expected.to contain_keystone_service('swift_service::object-store')
|
||||
is_expected.to contain_keystone_service('swift_service_s3::s3')
|
||||
end
|
||||
it 'configures correct endpoint name' do
|
||||
is_expected.to contain_keystone_endpoint('RegionOne/swift_service::object-store')
|
||||
is_expected.to contain_keystone_endpoint('RegionOne/swift_service_s3::s3')
|
||||
it_configures 'swift::keystone::auth'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,40 +1,49 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::keystone::dispersion' do
|
||||
shared_examples 'swift::keystone::dispersion' do
|
||||
describe 'with default class parameters' do
|
||||
it { is_expected.to contain_keystone_user('dispersion').with(
|
||||
:ensure => 'present',
|
||||
:password => 'dispersion_password',
|
||||
:email => 'swift@localhost',
|
||||
) }
|
||||
|
||||
describe 'with default class parameters' do
|
||||
|
||||
it { is_expected.to contain_keystone_user('dispersion').with(
|
||||
:ensure => 'present',
|
||||
:password => 'dispersion_password',
|
||||
:email => 'swift@localhost',
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('dispersion@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => 'admin',
|
||||
) }
|
||||
end
|
||||
|
||||
describe 'when overriding parameters' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:auth_user => 'bar',
|
||||
:auth_pass => 'foo',
|
||||
:email => 'bar@example.com',
|
||||
:tenant => 'dummyTenant'
|
||||
}
|
||||
it { is_expected.to contain_keystone_user_role('dispersion@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => 'admin',
|
||||
) }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('bar').with(
|
||||
:ensure => 'present',
|
||||
:password => 'foo',
|
||||
:email => 'bar@example.com',
|
||||
) }
|
||||
describe 'when overriding parameters' do
|
||||
let :params do
|
||||
{
|
||||
:auth_user => 'bar',
|
||||
:auth_pass => 'foo',
|
||||
:email => 'bar@example.com',
|
||||
:tenant => 'dummyTenant'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('bar@dummyTenant') }
|
||||
it { is_expected.to contain_keystone_user('bar').with(
|
||||
:ensure => 'present',
|
||||
:password => 'foo',
|
||||
:email => 'bar@example.com',
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('bar@dummyTenant') }
|
||||
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
|
||||
|
||||
it_configures 'swift::keystone::dispersion'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ describe 'swift::objectexpirer' do
|
|||
'class { "memcached": max_memory => 1 }'
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-object-expirer' do
|
||||
shared_examples 'swift::object::expirer' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
|
||||
context 'with defaults' do
|
||||
|
@ -103,7 +103,6 @@ describe 'swift::objectexpirer' do
|
|||
platform_params.merge!({ :service_provider => 'swiftinit' })
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
@ -125,7 +124,7 @@ describe 'swift::objectexpirer' do
|
|||
end
|
||||
end
|
||||
|
||||
it_configures 'swift-object-expirer'
|
||||
it_configures 'swift::object::expirer'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -21,8 +21,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::account_quotas' do
|
||||
shared_examples 'swift::proxy::account_quotas' do
|
||||
it { should contain_swift_proxy_config('filter:account_quotas/use').with_value('egg:swift#account_quotas') }
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to contain_swift_proxy_config('filter:account_quotas/use').with_value('egg:swift#account_quotas')
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::account_quotas'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,101 +1,107 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::authtoken' do
|
||||
shared_examples 'swift::proxy::authtoken' do
|
||||
describe 'when using the default signing directory' do
|
||||
let :file_defaults do
|
||||
{
|
||||
:mode => '0700',
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe 'when using the default signing directory' do
|
||||
let :file_defaults do
|
||||
{
|
||||
:mode => '0700',
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
}
|
||||
end
|
||||
it {is_expected.to contain_file('/var/cache/swift').with(
|
||||
{:ensure => 'directory',
|
||||
:selinux_ignore_defaults => true}.merge(file_defaults)
|
||||
)}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/log_name').with_value('swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/signing_dir').with_value('/var/cache/swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/paste.filter_factory').with_value('keystonemiddleware.auth_token:filter_factory') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('http://127.0.0.1:35357') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_plugin').with_value('password') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/user_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_name').with_value('services') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/username').with_value('swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/password').with_value('password') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/delay_auth_decision').with_value('1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/cache').with_value('swift.cache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/include_service_catalog').with_value('false') }
|
||||
|
||||
end
|
||||
|
||||
|
||||
describe "when overriding parameters" do
|
||||
let :params do
|
||||
{
|
||||
:admin_tenant_name => 'admin',
|
||||
:admin_user => 'swiftuser',
|
||||
:admin_password => 'swiftpassword',
|
||||
:cache => 'foo',
|
||||
:delay_auth_decision => '0',
|
||||
:signing_dir => '/home/swift/keystone-signing'
|
||||
}
|
||||
it {is_expected.to contain_file('/var/cache/swift').with(
|
||||
{:ensure => 'directory',
|
||||
:selinux_ignore_defaults => true}.merge(file_defaults)
|
||||
)}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/log_name').with_value('swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/signing_dir').with_value('/home/swift/keystone-signing') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/paste.filter_factory').with_value('keystonemiddleware.auth_token:filter_factory') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('http://127.0.0.1:35357') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_plugin').with_value('password') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/user_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_name').with_value('admin') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/username').with_value('swiftuser') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/password').with_value('swiftpassword') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/delay_auth_decision').with_value('0') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/cache').with_value('foo') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/include_service_catalog').with_value('false') }
|
||||
|
||||
end
|
||||
|
||||
describe 'when overriding auth_uri' do
|
||||
let :params do
|
||||
{ :auth_uri => 'http://public.host/keystone/main' }
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/log_name').with_value('swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/signing_dir').with_value('/var/cache/swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/paste.filter_factory').with_value('keystonemiddleware.auth_token:filter_factory') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('http://127.0.0.1:35357') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_plugin').with_value('password') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/user_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_name').with_value('services') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/username').with_value('swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/password').with_value('password') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/delay_auth_decision').with_value('1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/cache').with_value('swift.cache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/include_service_catalog').with_value('false') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('http://public.host/keystone/main') }
|
||||
end
|
||||
describe "when overriding parameters" do
|
||||
let :params do
|
||||
{
|
||||
:admin_tenant_name => 'admin',
|
||||
:admin_user => 'swiftuser',
|
||||
:admin_password => 'swiftpassword',
|
||||
:cache => 'foo',
|
||||
:delay_auth_decision => '0',
|
||||
:signing_dir => '/home/swift/keystone-signing'
|
||||
}
|
||||
end
|
||||
|
||||
describe "when identity_uri is set" do
|
||||
let :params do
|
||||
{
|
||||
:identity_uri => 'https://foo.bar:35357/'
|
||||
}
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/log_name').with_value('swift') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/signing_dir').with_value('/home/swift/keystone-signing') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/paste.filter_factory').with_value('keystonemiddleware.auth_token:filter_factory') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('http://127.0.0.1:35357') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_plugin').with_value('password') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/user_domain_id').with_value('default') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/project_name').with_value('admin') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/username').with_value('swiftuser') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/password').with_value('swiftpassword') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/delay_auth_decision').with_value('0') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/cache').with_value('foo') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/include_service_catalog').with_value('false') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('https://foo.bar:35357/') }
|
||||
end
|
||||
describe 'when overriding auth_uri' do
|
||||
let :params do
|
||||
{ :auth_uri => 'http://public.host/keystone/main' }
|
||||
end
|
||||
|
||||
describe "when both auth_uri and identity_uri are set" do
|
||||
let :params do
|
||||
{
|
||||
:auth_uri => 'https://foo.bar:5000/v2.0/',
|
||||
:identity_uri => 'https://foo.bar:35357/'
|
||||
}
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('http://public.host/keystone/main') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('https://foo.bar:5000/v2.0/') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('https://foo.bar:35357/') }
|
||||
describe "when identity_uri is set" do
|
||||
let :params do
|
||||
{
|
||||
:identity_uri => 'https://foo.bar:35357/'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('https://foo.bar:35357/') }
|
||||
end
|
||||
|
||||
describe "when both auth_uri and identity_uri are set" do
|
||||
let :params do
|
||||
{
|
||||
:auth_uri => 'https://foo.bar:5000/v2.0/',
|
||||
:identity_uri => 'https://foo.bar:35357/'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/www_authenticate_uri').with_value('https://foo.bar:5000/v2.0/') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:authtoken/auth_url').with_value('https://foo.bar:35357/') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::authtoken'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,30 +21,42 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::bulk' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/use').with_value('egg:swift#bulk') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_containers_per_extraction').with_value('10000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_failed_extractions').with_value('1000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_deletes_per_request').with_value('10000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/yield_frequency').with_value('60') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:max_containers_per_extraction => 5000,
|
||||
:max_failed_extractions => 500,
|
||||
:max_deletes_per_request => 5000,
|
||||
:yield_frequency => 10
|
||||
}
|
||||
shared_examples 'swift::proxy::bulk' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/use').with_value('egg:swift#bulk') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_containers_per_extraction').with_value('10000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_failed_extractions').with_value('1000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_deletes_per_request').with_value('10000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/yield_frequency').with_value('60') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/use').with_value('egg:swift#bulk') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_containers_per_extraction').with_value('5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_failed_extractions').with_value('500') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_deletes_per_request').with_value('5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/yield_frequency').with_value('10') }
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:max_containers_per_extraction => 5000,
|
||||
:max_failed_extractions => 500,
|
||||
:max_deletes_per_request => 5000,
|
||||
:yield_frequency => 10
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/use').with_value('egg:swift#bulk') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_containers_per_extraction').with_value('5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_failed_extractions').with_value('500') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/max_deletes_per_request').with_value('5000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:bulk/yield_frequency').with_value('10') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::bulk'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,51 +1,55 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::cache' do
|
||||
shared_examples 'swift::proxy::cache' do
|
||||
describe 'with defaults' do
|
||||
let :pre_condition do
|
||||
'class { "memcached": max_memory => 1 }'
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:os_workers => 1,
|
||||
:processorcount => 1,
|
||||
}
|
||||
end
|
||||
it 'should have the required classes' do
|
||||
is_expected.to contain_class('swift::deps')
|
||||
is_expected.to contain_class('swift::proxy::cache')
|
||||
end
|
||||
|
||||
describe 'with defaults' do
|
||||
let :pre_condition do
|
||||
'class { "memcached": max_memory => 1 }'
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('127.0.0.1:11211') }
|
||||
end
|
||||
|
||||
it 'should have the required classes' do
|
||||
is_expected.to contain_class('swift::deps')
|
||||
is_expected.to contain_class('swift::proxy::cache')
|
||||
describe 'without memcached being included' do
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('127.0.0.1:11211') }
|
||||
end
|
||||
|
||||
describe 'without memcached being included' do
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
describe 'with overridden memcache server' do
|
||||
let :params do
|
||||
{:memcache_servers => '10.0.0.1:1'}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('10.0.0.1:1') }
|
||||
end
|
||||
|
||||
describe 'with overridden memcache server array' do
|
||||
let :params do
|
||||
{:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('10.0.0.1:1,10.0.0.2:2') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with overridden memcache server' do
|
||||
let :params do
|
||||
{:memcache_servers => '10.0.0.1:1'}
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::cache'
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('10.0.0.1:1') }
|
||||
end
|
||||
|
||||
describe 'with overridden memcache server array' do
|
||||
let :params do
|
||||
{:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('10.0.0.1:1,10.0.0.2:2') }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::catch_errors' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
shared_examples 'swift::proxy::catch_errors' do
|
||||
it { should contain_swift_proxy_config('filter:catch_errors/use').with_value('egg:swift#catch_errors') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:catch_errors/use').with_value('egg:swift#catch_errors') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::catch_errors'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,8 +8,7 @@ describe 'swift::proxy::ceilometer' do
|
|||
}'
|
||||
end
|
||||
|
||||
shared_examples 'swift-proxy-ceilometer' do
|
||||
|
||||
shared_examples 'swift::proxy::ceilometer' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://guest:guest@127.0.0.1:5672//') }
|
||||
|
@ -122,7 +121,7 @@ describe 'swift::proxy::ceilometer' do
|
|||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
it_behaves_like 'swift-proxy-ceilometer'
|
||||
it_behaves_like 'swift::proxy::ceilometer'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -21,11 +21,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::container_quotas' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
shared_examples 'swift::proxy::container_quotas' do
|
||||
it { should contain_swift_proxy_config('filter:container_quotas/use').with_value('egg:swift#container_quotas') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:container_quotas/use').with_value('egg:swift#container_quotas') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::container_quotas'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,11 +6,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::container_sync' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
shared_examples 'swift::proxy::container_sync' do
|
||||
it { should contain_swift_proxy_config('filter:container_sync/use').with_value('egg:swift#container_sync') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:container_sync/use').with_value('egg:swift#container_sync') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::container_sync'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::copy' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:copy/use').with_value('egg:swift#copy') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:copy/object_post_as_copy').with_value('true') }
|
||||
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:object_post_as_copy => false,
|
||||
}
|
||||
shared_examples 'swift::proxy::copy' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:copy/use').with_value('egg:swift#copy') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:copy/object_post_as_copy').with_value('true') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:object_post_as_copy => false,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:copy/object_post_as_copy').with_value('false') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:copy/object_post_as_copy').with_value('false') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::copy'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,25 +1,33 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::crossdomain' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/use').with_value('egg:swift#crossdomain') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/cross_domain_policy').with_value('<allow-access-from domain="*" secure="false" />') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:cross_domain_policy => '<allow-access-from domain="xml-fragment-in-ini-file.so.wrong" secure="true" /><allow-access-from domain="*" secure="false" />',
|
||||
}
|
||||
shared_examples 'swift::proxy::crossdomain' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/use').with_value('egg:swift#crossdomain') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/cross_domain_policy').with_value('<allow-access-from domain="*" secure="false" />') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/use').with_value('egg:swift#crossdomain') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/cross_domain_policy').with_value('<allow-access-from domain="xml-fragment-in-ini-file.so.wrong" secure="true" /><allow-access-from domain="*" secure="false" />') }
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:cross_domain_policy => '<allow-access-from domain="xml-fragment-in-ini-file.so.wrong" secure="true" /><allow-access-from domain="*" secure="false" />',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/use').with_value('egg:swift#crossdomain') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:crossdomain/cross_domain_policy').with_value('<allow-access-from domain="xml-fragment-in-ini-file.so.wrong" secure="true" /><allow-access-from domain="*" secure="false" />') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::crossdomain'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,29 +1,38 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::dlo' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/use').with_value('egg:swift#dlo') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_after_segment').with_value('10') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_segments_per_sec').with_value('1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/max_get_time').with_value('86400') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:rate_limit_after_segment => '30',
|
||||
:rate_limit_segments_per_sec => '5',
|
||||
:max_get_time => '6400',
|
||||
}
|
||||
shared_examples 'swift::proxy::dlo' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/use').with_value('egg:swift#dlo') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_after_segment').with_value('10') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_segments_per_sec').with_value('1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/max_get_time').with_value('86400') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:rate_limit_after_segment => '30',
|
||||
:rate_limit_segments_per_sec => '5',
|
||||
:max_get_time => '6400',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_after_segment').with_value('30') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_segments_per_sec').with_value('5') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/max_get_time').with_value('6400') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_after_segment').with_value('30') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/rate_limit_segments_per_sec').with_value('5') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:dlo/max_get_time').with_value('6400') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::dlo'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::encryption' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:encryption/use').with_value('egg:swift#encryption') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:encryption/disable_encryption').with_value('false') }
|
||||
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:disable_encryption => true,
|
||||
}
|
||||
shared_examples 'swift::proxy::encryption' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:encryption/use').with_value('egg:swift#encryption') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:encryption/disable_encryption').with_value('false') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:disable_encryption => true,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:encryption/disable_encryption').with_value('true') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:encryption/disable_encryption').with_value('true') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::encryption'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::formpost' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
shared_examples 'swift::proxy::formpost' do
|
||||
it { should contain_swift_proxy_config('filter:formpost/use').with_value('egg:swift#formpost') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:formpost/use').with_value('egg:swift#formpost') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::formpost'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,31 +1,40 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::gatekeeper' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/use').with_value('egg:swift#gatekeeper') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('gatekeeper') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL2') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('INFO') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_headers').with_value('false') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_address').with_value('/dev/log') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:log_name => 'newgatekeeper',
|
||||
:log_facility => 'LOG_LOCAL3',
|
||||
:log_level => 'WARN',
|
||||
}
|
||||
shared_examples 'swift::proxy::gatekeeper' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/use').with_value('egg:swift#gatekeeper') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('gatekeeper') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL2') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('INFO') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_headers').with_value('false') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_address').with_value('/dev/log') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:log_name => 'newgatekeeper',
|
||||
:log_facility => 'LOG_LOCAL3',
|
||||
:log_level => 'WARN',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('newgatekeeper') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL3') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('WARN') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('newgatekeeper') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL3') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('WARN') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::gatekeeper'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::healthcheck' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
shared_examples 'swift::proxy::healthcheck' do
|
||||
it { should contain_swift_proxy_config('filter:healthcheck/use').with_value('egg:swift#healthcheck') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:healthcheck/use').with_value('egg:swift#healthcheck') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::healthcheck'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,35 +1,38 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::keystone' do
|
||||
shared_examples 'swift::proxy::keystone' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/use').with_value('egg:swift#keystoneauth') }
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/use').with_value('egg:swift#keystoneauth') }
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/operator_roles').with_value('admin, SwiftOperator') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/reseller_prefix').with_value('AUTH_') }
|
||||
|
||||
end
|
||||
|
||||
describe 'with parameter overrides' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:operator_roles => 'foo',
|
||||
:reseller_prefix => 'SWIFT_',
|
||||
:reseller_admin_role => 'ResellerAdmin'
|
||||
}
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/operator_roles').with_value('foo') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/reseller_prefix').with_value('SWIFT_') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/reseller_admin_role').with_value('ResellerAdmin') }
|
||||
|
||||
describe 'with defaults' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/operator_roles').with_value('admin, SwiftOperator') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/reseller_prefix').with_value('AUTH_') }
|
||||
end
|
||||
|
||||
describe 'with parameter overrides' do
|
||||
let :params do
|
||||
{
|
||||
:operator_roles => 'foo',
|
||||
:reseller_prefix => 'SWIFT_',
|
||||
:reseller_admin_role => 'ResellerAdmin'
|
||||
}
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/operator_roles').with_value('foo') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/reseller_prefix').with_value('SWIFT_') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:keystone/reseller_admin_role').with_value('ResellerAdmin') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::keystone'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::kms_keymaster' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:kms_keymaster/use').with_value('egg:swift#kms_keymaster') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:kms_keymaster/keymaster_config_path').with_value('/etc/swift/keymaster.conf') }
|
||||
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:keymaster_config_path => '/tmp/keymaster.conf',
|
||||
}
|
||||
shared_examples 'swift::proxy::kms_keymaster' do
|
||||
describe "when using default parameters" do
|
||||
it { should contain_swift_proxy_config('filter:kms_keymaster/use').with_value('egg:swift#kms_keymaster') }
|
||||
it { should contain_swift_proxy_config('filter:kms_keymaster/keymaster_config_path').with_value('/etc/swift/keymaster.conf') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:keymaster_config_path => '/tmp/keymaster.conf',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_swift_proxy_config('filter:kms_keymaster/keymaster_config_path').with_value('/tmp/keymaster.conf') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:kms_keymaster/keymaster_config_path').with_value('/tmp/keymaster.conf') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::kms_keymaster'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,35 +1,44 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::ratelimit' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/use').with_value('egg:swift#ratelimit') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/clock_accuracy').with_value('1000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/max_sleep_time_seconds').with_value('60') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/log_sleep_time_seconds').with_value('0') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/rate_buffer_seconds').with_value('5') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/account_ratelimit').with_value('0') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:clock_accuracy => 9436,
|
||||
:max_sleep_time_seconds => 3600,
|
||||
:log_sleep_time_seconds => 42,
|
||||
:rate_buffer_seconds => 51,
|
||||
:account_ratelimit => 69
|
||||
}
|
||||
shared_examples 'swift::proxy::ratelimit' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/use').with_value('egg:swift#ratelimit') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/clock_accuracy').with_value('1000') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/max_sleep_time_seconds').with_value('60') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/log_sleep_time_seconds').with_value('0') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/rate_buffer_seconds').with_value('5') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/account_ratelimit').with_value('0') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:clock_accuracy => 9436,
|
||||
:max_sleep_time_seconds => 3600,
|
||||
:log_sleep_time_seconds => 42,
|
||||
:rate_buffer_seconds => 51,
|
||||
:account_ratelimit => 69
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/clock_accuracy').with_value('9436') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/max_sleep_time_seconds').with_value('3600') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/log_sleep_time_seconds').with_value('42') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/rate_buffer_seconds').with_value('51') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/account_ratelimit').with_value('69') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/clock_accuracy').with_value('9436') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/max_sleep_time_seconds').with_value('3600') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/log_sleep_time_seconds').with_value('42') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/rate_buffer_seconds').with_value('51') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:ratelimit/account_ratelimit').with_value('69') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::ratelimit'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::s3api' do
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
})
|
||||
shared_examples 'swift::proxy::s3api' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3api/use').with_value('egg:swift#s3api') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3api/auth_pipeline_check').with_value('false') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3api/use').with_value('egg:swift#s3api') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3api/auth_pipeline_check').with_value('false') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::s3api'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,34 +1,44 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::s3token' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/use').with_value('egg:swift#s3token') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://127.0.0.1:35357') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:auth_protocol => 'https',
|
||||
:auth_host => '192.168.4.2',
|
||||
:auth_port => '3452'
|
||||
}
|
||||
shared_examples 'swift::proxy::s3token' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/use').with_value('egg:swift#s3token') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://127.0.0.1:35357') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('https://192.168.4.2:3452') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:auth_uri => 'http://192.168.24.11:35357'
|
||||
}
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:auth_protocol => 'https',
|
||||
:auth_host => '192.168.4.2',
|
||||
:auth_port => '3452'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('https://192.168.4.2:3452') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:auth_uri => 'http://192.168.24.11:35357'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://192.168.24.11:35357') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://192.168.24.11:35357') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::s3token'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,34 +1,43 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::slo' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
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('2097152') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:slo/min_segment_size').with_value('1048576') }
|
||||
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('0') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('86400') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:max_manifest_segments => '2000',
|
||||
:max_manifest_size => '500000',
|
||||
:rate_limit_after_segment => '30',
|
||||
:max_get_time => '6400',
|
||||
}
|
||||
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('2097152') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:slo/min_segment_size').with_value('1048576') }
|
||||
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('0') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('86400') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:max_manifest_segments => '2000',
|
||||
:max_manifest_size => '500000',
|
||||
:rate_limit_after_segment => '30',
|
||||
:max_get_time => '6400',
|
||||
}
|
||||
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/rate_limit_after_segment').with_value('30') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('6400') }
|
||||
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/rate_limit_after_segment').with_value('30') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('6400') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::slo'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,265 +1,255 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy' do
|
||||
|
||||
describe 'without memcached being included' do
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
# set os so memcache will not fail
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:os_workers => 1,
|
||||
:processorcount => 1,
|
||||
})
|
||||
end
|
||||
|
||||
describe 'with proper dependencies' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
include ::swift::proxy::healthcheck
|
||||
include ::swift::proxy::cache
|
||||
include ::swift::proxy::tempauth"
|
||||
shared_examples 'swift::proxy' do
|
||||
describe 'without memcached being included' do
|
||||
it { should raise_error(Puppet::Error) }
|
||||
end
|
||||
|
||||
|
||||
describe 'without the proxy local network ip address being specified' do
|
||||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
|
||||
it_raises 'a Puppet::Error', /expects a value for parameter 'proxy_local_net_ip'/
|
||||
else
|
||||
it_raises 'a Puppet::Error', /Must pass proxy_local_net_ip/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when proxy_local_net_ip is set' do
|
||||
|
||||
let :params do
|
||||
{:proxy_local_net_ip => '127.0.0.1'}
|
||||
describe 'with proper dependencies' do
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
include ::swift::proxy::healthcheck
|
||||
include ::swift::proxy::cache
|
||||
include ::swift::proxy::tempauth"
|
||||
end
|
||||
|
||||
|
||||
it 'passes purge to swift_proxy_config resource' do
|
||||
is_expected.to contain_resources('swift_proxy_config').with({
|
||||
:purge => false
|
||||
})
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('swift-proxy').that_requires('Anchor[swift::install::begin]')
|
||||
is_expected.to contain_package('swift-proxy').that_notifies('Anchor[swift::install::end]') }
|
||||
|
||||
it { is_expected.to contain_service('swift-proxy-server').with(
|
||||
{:ensure => 'running',
|
||||
:provider => nil,
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:tag => 'swift-service',
|
||||
}
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_service('swift-proxy-server').that_subscribes_to('Anchor[swift::service::begin]')}
|
||||
it { is_expected.to contain_service('swift-proxy-server').that_notifies('Anchor[swift::service::end]')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_port').with_value('8080')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_ip').with_value('127.0.0.1')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/workers').with_value('1')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/user').with_value('swift')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_name').with_value('proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_facility').with_value('LOG_LOCAL2')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_level').with_value('INFO')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_headers').with_value('False')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_address').with_value('/dev/log')}
|
||||
it { is_expected.to contain_swift_proxy_config('pipeline:main/pipeline').with_value('healthcheck cache tempauth proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/use').with_value('egg:swift#proxy')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_name').with_value('proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_level').with_value('INFO')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('true')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('true')}
|
||||
|
||||
|
||||
it { is_expected.to contain_service('swift-proxy-server').with_require(
|
||||
[
|
||||
'Class[Swift::Proxy::Healthcheck]',
|
||||
'Class[Swift::Proxy::Cache]',
|
||||
'Class[Swift::Proxy::Tempauth]'
|
||||
]
|
||||
)}
|
||||
|
||||
describe "when using swift_proxy_config resource" do
|
||||
let :pre_condition do
|
||||
"
|
||||
class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
swift_proxy_config { 'foo/bar': value => 'foo' }
|
||||
include ::swift::proxy::healthcheck
|
||||
include ::swift::proxy::cache
|
||||
include ::swift::proxy::tempauth
|
||||
"
|
||||
describe 'without the proxy local network ip address being specified' do
|
||||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
|
||||
it_raises 'a Puppet::Error', /expects a value for parameter 'proxy_local_net_ip'/
|
||||
else
|
||||
it_raises 'a Puppet::Error', /Must pass proxy_local_net_ip/
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('foo/bar').with_value('foo').that_notifies('Anchor[swift::config::end]')}
|
||||
end
|
||||
|
||||
describe 'when more parameters are set' do
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
include ::swift::proxy::swauth"
|
||||
end
|
||||
|
||||
describe 'when proxy_local_net_ip is set' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '10.0.0.2',
|
||||
:port => '80',
|
||||
:workers => 3,
|
||||
:pipeline => ['swauth', 'proxy-server'],
|
||||
:allow_account_management => false,
|
||||
:account_autocreate => false,
|
||||
:log_level => 'DEBUG',
|
||||
:log_name => 'swift-proxy-server',
|
||||
:read_affinity => 'r1z1=100, r1=200',
|
||||
:write_affinity => 'r1',
|
||||
:write_affinity_node_count => '2 * replicas',
|
||||
:node_timeout => '20',
|
||||
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
|
||||
:proxy_local_net_ip => '127.0.0.1'
|
||||
}
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_port').with_value('80')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_ip').with_value('10.0.0.2')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/workers').with_value('3')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/user').with_value('swift')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_name').with_value('swift-proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_facility').with_value('LOG_LOCAL2')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_level').with_value('DEBUG')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_headers').with_value('False')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_address').with_value('/dev/log')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('http://foo.bar:1234,https://foo.bar')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('true')}
|
||||
it { is_expected.to contain_swift_proxy_config('pipeline:main/pipeline').with_value('swauth proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/use').with_value('egg:swift#proxy')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_name').with_value('swift-proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_level').with_value('DEBUG')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('false')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('false')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/sorting_method').with_value('affinity')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/read_affinity').with_value('r1z1=100, r1=200')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/write_affinity').with_value('r1')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20')}
|
||||
end
|
||||
describe "when log udp port is set" do
|
||||
context 'and log_udp_host is not set' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '10.0.0.2',
|
||||
:port => '80',
|
||||
:workers => 3,
|
||||
:pipeline => ['swauth', 'proxy-server'],
|
||||
:allow_account_management => false,
|
||||
:account_autocreate => false,
|
||||
:log_level => 'DEBUG',
|
||||
:log_name => 'swift-proxy-server',
|
||||
:log_udp_port => '514',
|
||||
:read_affinity => 'r1z1=100, r1=200',
|
||||
:write_affinity => 'r1',
|
||||
:write_affinity_node_count => '2 * replicas',
|
||||
:node_timeout => '20',
|
||||
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
|
||||
}
|
||||
|
||||
it { should contain_resources('swift_proxy_config').with(
|
||||
:purge => false
|
||||
)}
|
||||
|
||||
it { should contain_package('swift-proxy').that_requires('Anchor[swift::install::begin]') }
|
||||
it { should contain_package('swift-proxy').that_notifies('Anchor[swift::install::end]') }
|
||||
|
||||
it { should contain_service('swift-proxy-server').with(
|
||||
:ensure => 'running',
|
||||
:provider => nil,
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:tag => 'swift-service',
|
||||
)}
|
||||
|
||||
it { should contain_service('swift-proxy-server').that_subscribes_to('Anchor[swift::service::begin]') }
|
||||
it { should contain_service('swift-proxy-server').that_notifies('Anchor[swift::service::end]') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/bind_port').with_value('8080') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/bind_ip').with_value('127.0.0.1') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/workers').with_value('2') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/user').with_value('swift') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_name').with_value('proxy-server') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_facility').with_value('LOG_LOCAL2') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_level').with_value('INFO') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_headers').with_value('False') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_address').with_value('/dev/log') }
|
||||
it { should contain_swift_proxy_config('pipeline:main/pipeline').with_value('healthcheck cache tempauth proxy-server') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/use').with_value('egg:swift#proxy') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_name').with_value('proxy-server') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_level').with_value('INFO') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('true') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('true') }
|
||||
|
||||
it { should contain_service('swift-proxy-server').with_require([
|
||||
'Class[Swift::Proxy::Healthcheck]',
|
||||
'Class[Swift::Proxy::Cache]',
|
||||
'Class[Swift::Proxy::Tempauth]',
|
||||
])}
|
||||
|
||||
describe "when using swift_proxy_config resource" do
|
||||
let :pre_condition do
|
||||
"
|
||||
class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
swift_proxy_config { 'foo/bar': value => 'foo' }
|
||||
include ::swift::proxy::healthcheck
|
||||
include ::swift::proxy::cache
|
||||
include ::swift::proxy::tempauth
|
||||
"
|
||||
end
|
||||
it_raises 'a Puppet::Error', /log_udp_port requires log_udp_host to be set/
|
||||
|
||||
it { should contain_swift_proxy_config('foo/bar').with_value('foo').that_notifies('Anchor[swift::config::end]') }
|
||||
end
|
||||
context 'and log_udp_host is set' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '10.0.0.2',
|
||||
:port => '80',
|
||||
:workers => 3,
|
||||
:pipeline => ['swauth', 'proxy-server'],
|
||||
:allow_account_management => false,
|
||||
:account_autocreate => false,
|
||||
:log_level => 'DEBUG',
|
||||
:log_name => 'swift-proxy-server',
|
||||
:log_udp_host => '127.0.0.1',
|
||||
:log_udp_port => '514',
|
||||
:read_affinity => 'r1z1=100, r1=200',
|
||||
:write_affinity => 'r1',
|
||||
:write_affinity_node_count => '2 * replicas',
|
||||
:node_timeout => '20',
|
||||
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'when more parameters are set' do
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
include ::swift::proxy::swauth"
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_port').with_value('80')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/bind_ip').with_value('10.0.0.2')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/workers').with_value('3')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/user').with_value('swift')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_name').with_value('swift-proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_facility').with_value('LOG_LOCAL2')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_level').with_value('DEBUG')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_headers').with_value('False')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_address').with_value('/dev/log')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_udp_host').with_value('127.0.0.1')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/log_udp_port').with_value('514')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('http://foo.bar:1234,https://foo.bar')}
|
||||
it { is_expected.to contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('true')}
|
||||
it { is_expected.to contain_swift_proxy_config('pipeline:main/pipeline').with_value('swauth proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/use').with_value('egg:swift#proxy')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_name').with_value('swift-proxy-server')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_level').with_value('DEBUG')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('false')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('false')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/sorting_method').with_value('affinity')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/read_affinity').with_value('r1z1=100, r1=200')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/write_affinity').with_value('r1')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas')}
|
||||
it { is_expected.to contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20')}
|
||||
end
|
||||
end
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '10.0.0.2',
|
||||
:port => '80',
|
||||
:workers => 3,
|
||||
:pipeline => ['swauth', 'proxy-server'],
|
||||
:allow_account_management => false,
|
||||
:account_autocreate => false,
|
||||
:log_level => 'DEBUG',
|
||||
:log_name => 'swift-proxy-server',
|
||||
:read_affinity => 'r1z1=100, r1=200',
|
||||
:write_affinity => 'r1',
|
||||
:write_affinity_node_count => '2 * replicas',
|
||||
:node_timeout => '20',
|
||||
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'when supplying bad values for parameters' do
|
||||
[:account_autocreate, :allow_account_management].each do |param|
|
||||
it "should fail when #{param} is not passed a boolean" do
|
||||
params[param] = 'false'
|
||||
expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
|
||||
it { should contain_swift_proxy_config('DEFAULT/bind_port').with_value('80') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/bind_ip').with_value('10.0.0.2') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/workers').with_value('3') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/user').with_value('swift') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_name').with_value('swift-proxy-server') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_facility').with_value('LOG_LOCAL2') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_level').with_value('DEBUG') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_headers').with_value('False') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_address').with_value('/dev/log') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('http://foo.bar:1234,https://foo.bar') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('true') }
|
||||
it { should contain_swift_proxy_config('pipeline:main/pipeline').with_value('swauth proxy-server') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/use').with_value('egg:swift#proxy') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_name').with_value('swift-proxy-server') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_level').with_value('DEBUG') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('false') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('false') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/sorting_method').with_value('affinity') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/read_affinity').with_value('r1z1=100, r1=200') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/write_affinity').with_value('r1') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20') }
|
||||
end
|
||||
|
||||
describe "when log udp port is set" do
|
||||
context 'and log_udp_host is not set' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '10.0.0.2',
|
||||
:port => '80',
|
||||
:workers => 3,
|
||||
:pipeline => ['swauth', 'proxy-server'],
|
||||
:allow_account_management => false,
|
||||
:account_autocreate => false,
|
||||
:log_level => 'DEBUG',
|
||||
:log_name => 'swift-proxy-server',
|
||||
:log_udp_port => '514',
|
||||
:read_affinity => 'r1z1=100, r1=200',
|
||||
:write_affinity => 'r1',
|
||||
:write_affinity_node_count => '2 * replicas',
|
||||
:node_timeout => '20',
|
||||
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
|
||||
}
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /log_udp_port requires log_udp_host to be set/
|
||||
end
|
||||
|
||||
context 'and log_udp_host is set' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '10.0.0.2',
|
||||
:port => '80',
|
||||
:workers => 3,
|
||||
:pipeline => ['swauth', 'proxy-server'],
|
||||
:allow_account_management => false,
|
||||
:account_autocreate => false,
|
||||
:log_level => 'DEBUG',
|
||||
:log_name => 'swift-proxy-server',
|
||||
:log_udp_host => '127.0.0.1',
|
||||
:log_udp_port => '514',
|
||||
:read_affinity => 'r1z1=100, r1=200',
|
||||
:write_affinity => 'r1',
|
||||
:write_affinity_node_count => '2 * replicas',
|
||||
:node_timeout => '20',
|
||||
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
|
||||
}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
include ::swift::proxy::swauth"
|
||||
end
|
||||
|
||||
it { should contain_swift_proxy_config('DEFAULT/bind_port').with_value('80') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/bind_ip').with_value('10.0.0.2') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/workers').with_value('3') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/user').with_value('swift') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_name').with_value('swift-proxy-server') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_facility').with_value('LOG_LOCAL2') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_level').with_value('DEBUG') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_headers').with_value('False') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_address').with_value('/dev/log') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_udp_host').with_value('127.0.0.1') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/log_udp_port').with_value('514') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('http://foo.bar:1234,https://foo.bar') }
|
||||
it { should contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('true') }
|
||||
it { should contain_swift_proxy_config('pipeline:main/pipeline').with_value('swauth proxy-server') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/use').with_value('egg:swift#proxy') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_name').with_value('swift-proxy-server') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_level').with_value('DEBUG') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('false') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('false') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/sorting_method').with_value('affinity') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/read_affinity').with_value('r1z1=100, r1=200') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/write_affinity').with_value('r1') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas') }
|
||||
it { should contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20') }
|
||||
end
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '127.0.0.1',
|
||||
:write_affinity_node_count => '2 * replicas'
|
||||
}
|
||||
end
|
||||
describe 'when supplying bad values for parameters' do
|
||||
[:account_autocreate, :allow_account_management].each do |param|
|
||||
it "should fail when #{param} is not passed a boolean" do
|
||||
params[param] = 'false'
|
||||
should raise_error(Puppet::Error, /is not a boolean/)
|
||||
end
|
||||
end
|
||||
|
||||
it "should fail if write_affinity_node_count is used without write_affinity" do
|
||||
expect { catalogue }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '127.0.0.1',
|
||||
:write_affinity_node_count => '2 * replicas'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should fail if write_affinity_node_count is used without write_affinity' do
|
||||
should raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-proxy-server' do
|
||||
shared_examples 'swift::proxy server' do
|
||||
let :params do
|
||||
{ :proxy_local_net_ip => '127.0.0.1' }
|
||||
{
|
||||
:proxy_local_net_ip => '127.0.0.1'
|
||||
}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
|
@ -271,100 +261,63 @@ describe 'swift::proxy' do
|
|||
|
||||
[{ :enabled => true, :manage_service => true },
|
||||
{ :enabled => false, :manage_service => true }].each do |param_hash|
|
||||
context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
before do
|
||||
params.merge!(param_hash)
|
||||
end
|
||||
|
||||
it 'configures swift-proxy-server service' do
|
||||
is_expected.to contain_service('swift-proxy-server').with(
|
||||
should contain_service('swift-proxy-server').with(
|
||||
:name => platform_params['swift-proxy-server'],
|
||||
:ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash[:enabled],
|
||||
:provider => platform_params['service_provider'],
|
||||
:provider => nil,
|
||||
:tag => 'swift-service',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with disabled service managing' do
|
||||
context 'with disabled service managing and service provider' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false,
|
||||
:enabled => false,
|
||||
:service_provider => 'swiftinit',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures swift-proxy-server service' do
|
||||
|
||||
is_expected.to contain_service('swift-proxy-server').with(
|
||||
:ensure => nil,
|
||||
:name => platform_params['swift-proxy-server'],
|
||||
:provider => platform_params['service_provider'],
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
should contain_service('swift-proxy-server').with(
|
||||
:ensure => nil,
|
||||
:name => 'swift-proxy-server',
|
||||
:provider => 'swiftinit',
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:processorcount => 1,
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ 'swift-proxy-server' => 'swift-proxy',
|
||||
'service_provider' => nil
|
||||
}
|
||||
end
|
||||
it_configures 'swift-proxy-server'
|
||||
|
||||
context 'on Debian platforms using swiftinit service provider' do
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
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
|
||||
{ 'swift-proxy-server' => 'swift-proxy-server',
|
||||
'service_provider' => 'swiftinit'
|
||||
}
|
||||
end
|
||||
it_configures 'swift-proxy-server'
|
||||
end
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:processorcount => 1,
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{
|
||||
'swift-proxy-server' => 'openstack-swift-proxy',
|
||||
}
|
||||
end
|
||||
it_configures 'swift-proxy-server'
|
||||
|
||||
context 'on Redhat platforms using swiftinit service provider' do
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
let (:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{ 'swift-proxy-server' => 'swift-proxy' }
|
||||
when 'RedHat'
|
||||
{ 'swift-proxy-server' => 'openstack-swift-proxy' }
|
||||
end
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ 'swift-proxy-server' => 'swift-proxy-server',
|
||||
'service_provider' => 'swiftinit'
|
||||
}
|
||||
end
|
||||
it_configures 'swift-proxy-server'
|
||||
it_behaves_like 'swift::proxy'
|
||||
it_behaves_like 'swift::proxy server'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::staticweb' do
|
||||
shared_examples 'swift::proxy::staticweb' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:staticweb/use').with_value('egg:swift#staticweb') }
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:url_base => 'https://www.example.com',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:staticweb/use').with_value('egg:swift#staticweb') }
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:url_base => 'https://www.example.com',
|
||||
}
|
||||
it { is_expected.to contain_swift_proxy_config('filter:staticweb/url_base').with_value('https://www.example.com') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:staticweb/url_base').with_value('https://www.example.com') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::staticweb'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,36 +1,39 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::swauth' do
|
||||
shared_examples 'swift::proxy::swauth' do
|
||||
it { is_expected.to contain_package('python-swauth').with_ensure('present') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/use').with_value('egg:swauth#swauth') }
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('python-swauth').with_ensure('present') }
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/use').with_value('egg:swauth#swauth') }
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/default_swift_cluster').with_value('local#127.0.0.1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/super_admin_key').with_value('swauthkey') }
|
||||
|
||||
end
|
||||
|
||||
describe 'with overridden parameters' do
|
||||
|
||||
let :params do
|
||||
{:swauth_endpoint => '10.0.0.1',
|
||||
:swauth_super_admin_key => 'foo',
|
||||
:package_ensure => 'latest' }
|
||||
describe 'with defaults' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/default_swift_cluster').with_value('local#127.0.0.1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/super_admin_key').with_value('swauthkey') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/default_swift_cluster').with_value('local#10.0.0.1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/super_admin_key').with_value('foo') }
|
||||
describe 'with overridden parameters' do
|
||||
let :params do
|
||||
{:swauth_endpoint => '10.0.0.1',
|
||||
:swauth_super_admin_key => 'foo',
|
||||
:package_ensure => 'latest' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('python-swauth').with_ensure('latest') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/default_swift_cluster').with_value('local#10.0.0.1') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swauth/super_admin_key').with_value('foo') }
|
||||
|
||||
it { is_expected.to contain_package('python-swauth').with_ensure('latest') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::swauth'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::swift3' do
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
})
|
||||
shared_examples 'swift::proxy::swift3' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swift3/use').with_value('egg:swift3#swift3') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:swift3/use').with_value('egg:swift3#swift3') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::swift3'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::tempauth' do
|
||||
let :default_params do {
|
||||
'account_user_list' => [
|
||||
{
|
||||
'user' => 'admin',
|
||||
'account' => 'admin',
|
||||
'key' => 'admin',
|
||||
'groups' => [ 'admin', 'reseller_admin' ],
|
||||
},
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
let :params do default_params end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/use').with_value('egg:swift#tempauth') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin .admin .reseller_admin') }
|
||||
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/reseller_prefix').with_value('') }
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/token_life').with_value('') }
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/auth_prefix').with_value('') }
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/storage_url_scheme').with_value('') }
|
||||
|
||||
context 'declaring two users' do
|
||||
let :params do {
|
||||
shared_examples 'swift::proxy::tempauth' do
|
||||
let :default_params do {
|
||||
'account_user_list' => [
|
||||
{
|
||||
'user' => 'admin',
|
||||
|
@ -32,54 +10,91 @@ describe 'swift::proxy::tempauth' do
|
|||
'key' => 'admin',
|
||||
'groups' => [ 'admin', 'reseller_admin' ],
|
||||
},
|
||||
{
|
||||
'user' => 'foo',
|
||||
'account' => 'bar',
|
||||
'key' => 'pass',
|
||||
'groups' => [ 'reseller_admin' ],
|
||||
},
|
||||
]
|
||||
} end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin .admin .reseller_admin') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_bar_foo').with_value('pass .reseller_admin') }
|
||||
end
|
||||
|
||||
context 'when group is empty' do
|
||||
let :params do {
|
||||
'account_user_list' => [
|
||||
{
|
||||
'user' => 'admin',
|
||||
'account' => 'admin',
|
||||
'key' => 'admin',
|
||||
'groups' => [],
|
||||
},
|
||||
]
|
||||
} end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin') }
|
||||
end
|
||||
|
||||
|
||||
context 'when undef params are set' do
|
||||
let :params do {
|
||||
'reseller_prefix' => 'auth',
|
||||
'token_life' => 81600,
|
||||
'auth_prefix' => '/auth/',
|
||||
'storage_url_scheme' => 'http',
|
||||
}.merge(default_params)
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/reseller_prefix').with_value('AUTH') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/token_life').with_value('81600') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/auth_prefix').with_value('/auth/') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/storage_url_scheme').with_value('http') }
|
||||
let :params do default_params end
|
||||
|
||||
describe "invalid params" do
|
||||
['account_user_list', 'token_life', 'auth_prefix', 'storage_url_scheme'].each do |param|
|
||||
let :params do { param => 'foobar' }.merge(default_params) end
|
||||
it "invalid #{param} should fail" do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/use').with_value('egg:swift#tempauth') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin .admin .reseller_admin') }
|
||||
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/reseller_prefix').with_value('') }
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/token_life').with_value('') }
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/auth_prefix').with_value('') }
|
||||
it { is_expected.to_not contain_swift_proxy_config('filter:tempauth/storage_url_scheme').with_value('') }
|
||||
|
||||
context 'declaring two users' do
|
||||
let :params do {
|
||||
'account_user_list' => [
|
||||
{
|
||||
'user' => 'admin',
|
||||
'account' => 'admin',
|
||||
'key' => 'admin',
|
||||
'groups' => [ 'admin', 'reseller_admin' ],
|
||||
},
|
||||
{
|
||||
'user' => 'foo',
|
||||
'account' => 'bar',
|
||||
'key' => 'pass',
|
||||
'groups' => [ 'reseller_admin' ],
|
||||
},
|
||||
]
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin .admin .reseller_admin') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_bar_foo').with_value('pass .reseller_admin') }
|
||||
end
|
||||
|
||||
context 'when group is empty' do
|
||||
let :params do {
|
||||
'account_user_list' => [
|
||||
{
|
||||
'user' => 'admin',
|
||||
'account' => 'admin',
|
||||
'key' => 'admin',
|
||||
'groups' => [],
|
||||
},
|
||||
]
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin') }
|
||||
end
|
||||
|
||||
context 'when undef params are set' do
|
||||
let :params do {
|
||||
'reseller_prefix' => 'auth',
|
||||
'token_life' => 81600,
|
||||
'auth_prefix' => '/auth/',
|
||||
'storage_url_scheme' => 'http',
|
||||
}.merge(default_params)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/reseller_prefix').with_value('AUTH') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/token_life').with_value('81600') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/auth_prefix').with_value('/auth/') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/storage_url_scheme').with_value('http') }
|
||||
|
||||
describe "invalid params" do
|
||||
['account_user_list', 'token_life', 'auth_prefix', 'storage_url_scheme'].each do |param|
|
||||
let :params do { param => 'foobar' }.merge(default_params) end
|
||||
it "invalid #{param} should fail" do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::tempauth'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,54 +1,63 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::tempurl' do
|
||||
shared_examples 'swift::proxy::tempurl' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempurl/use').with_value('egg:swift#tempurl') }
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
['methods',
|
||||
'incoming_remove_headers',
|
||||
'incoming_allow_headers',
|
||||
'outgoing_remove_headers',
|
||||
'outgoing_allow_headers' ].each do |h|
|
||||
it { is_expected.to_not contain_swift_proxy_config("filter:tempurl/#{h}").with_value('') }
|
||||
end
|
||||
|
||||
context "when params are set" do
|
||||
let :params do {
|
||||
'methods' => ['GET','HEAD','PUT'],
|
||||
'incoming_remove_headers' => ['x-foo','x-bar-*'],
|
||||
'incoming_allow_headers' => ['x-foo','x-bar-*'],
|
||||
'outgoing_remove_headers' => ['x-foo','x-bar-*'],
|
||||
'outgoing_allow_headers' => ['x-foo','x-bar-*'],
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempurl/methods').with_value('GET HEAD PUT') }
|
||||
['incoming_remove_headers',
|
||||
'incoming_allow_headers',
|
||||
'outgoing_remove_headers',
|
||||
'outgoing_allow_headers' ].each do |h|
|
||||
it { is_expected.to contain_swift_proxy_config("filter:tempurl/#{h}").with_value('x-foo x-bar-*') }
|
||||
end
|
||||
|
||||
describe 'when params are not array' do
|
||||
let :params do {
|
||||
'methods' => 'GET HEAD PUT',
|
||||
'incoming_remove_headers' => 'x-foo x-bar-*',
|
||||
'incoming_allow_headers' => 'x-foo x-bar-*',
|
||||
'outgoing_remove_headers' => 'x-foo x-bar-*',
|
||||
'outgoing_allow_headers' => 'x-foo x-bar-*',
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempurl/methods').with_value('GET HEAD PUT') }
|
||||
['incoming_remove_headers',
|
||||
'incoming_allow_headers',
|
||||
'outgoing_remove_headers',
|
||||
'outgoing_allow_headers' ].each do |h|
|
||||
it { is_expected.to contain_swift_proxy_config("filter:tempurl/#{h}").with_value('x-foo x-bar-*') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempurl/use').with_value('egg:swift#tempurl') }
|
||||
|
||||
['methods',
|
||||
'incoming_remove_headers',
|
||||
'incoming_allow_headers',
|
||||
'outgoing_remove_headers',
|
||||
'outgoing_allow_headers' ].each do |h|
|
||||
it { is_expected.to_not contain_swift_proxy_config("filter:tempurl/#{h}").with_value('') }
|
||||
end
|
||||
|
||||
context "when params are set" do
|
||||
let :params do {
|
||||
'methods' => ['GET','HEAD','PUT'],
|
||||
'incoming_remove_headers' => ['x-foo','x-bar-*'],
|
||||
'incoming_allow_headers' => ['x-foo','x-bar-*'],
|
||||
'outgoing_remove_headers' => ['x-foo','x-bar-*'],
|
||||
'outgoing_allow_headers' => ['x-foo','x-bar-*'],
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempurl/methods').with_value('GET HEAD PUT') }
|
||||
['incoming_remove_headers',
|
||||
'incoming_allow_headers',
|
||||
'outgoing_remove_headers',
|
||||
'outgoing_allow_headers' ].each do |h|
|
||||
it { is_expected.to contain_swift_proxy_config("filter:tempurl/#{h}").with_value('x-foo x-bar-*') }
|
||||
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
|
||||
|
||||
describe 'when params are not array' do
|
||||
let :params do {
|
||||
'methods' => 'GET HEAD PUT',
|
||||
'incoming_remove_headers' => 'x-foo x-bar-*',
|
||||
'incoming_allow_headers' => 'x-foo x-bar-*',
|
||||
'outgoing_remove_headers' => 'x-foo x-bar-*',
|
||||
'outgoing_allow_headers' => 'x-foo x-bar-*',
|
||||
} end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempurl/methods').with_value('GET HEAD PUT') }
|
||||
['incoming_remove_headers',
|
||||
'incoming_allow_headers',
|
||||
'outgoing_remove_headers',
|
||||
'outgoing_allow_headers' ].each do |h|
|
||||
it { is_expected.to contain_swift_proxy_config("filter:tempurl/#{h}").with_value('x-foo x-bar-*') }
|
||||
end
|
||||
end
|
||||
end
|
||||
it_configures 'swift::proxy::tempurl'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,23 +1,32 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::versioned_writes' do
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:versioned_writes/use').with_value('egg:swift#versioned_writes') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:versioned_writes/allow_versioned_writes').with_value('false') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:allow_versioned_writes => true,
|
||||
}
|
||||
shared_examples 'swift::proxy::versioned_writes' do
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:versioned_writes/use').with_value('egg:swift#versioned_writes') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:versioned_writes/allow_versioned_writes').with_value('false') }
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:allow_versioned_writes => true,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:versioned_writes/allow_versioned_writes').with_value('true') }
|
||||
end
|
||||
it { is_expected.to contain_swift_proxy_config('filter:versioned_writes/allow_versioned_writes').with_value('true') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::versioned_writes'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,100 +1,105 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::ringbuilder' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:os_workers => 1,
|
||||
:processorcount => 1,
|
||||
})
|
||||
end
|
||||
describe 'when swift class is not included' do
|
||||
it 'should fail' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
describe 'when swift class is included' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }"
|
||||
end
|
||||
|
||||
it 'should rebalance the ring for all ring types' do
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('object')
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('account')
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('container')
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
['object', 'account', 'container'].each do |type|
|
||||
it { is_expected.to contain_swift__ringbuilder__create(type).with(
|
||||
:part_power => '18',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '24'
|
||||
)}
|
||||
shared_examples 'swift::ringbuilder' do
|
||||
describe 'when swift class is not included' do
|
||||
it 'should fail' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with parameter overrides' do
|
||||
|
||||
let :params do
|
||||
{:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
}
|
||||
end
|
||||
|
||||
['object', 'account', 'container'].each do |type|
|
||||
it { is_expected.to contain_swift__ringbuilder__create(type).with(
|
||||
:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
describe 'when specifying ring devices' do
|
||||
describe 'when swift class is included' do
|
||||
let :pre_condition do
|
||||
'class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
ring_object_device { "127.0.0.1:6000/1":
|
||||
zone => 1,
|
||||
weight => 1,
|
||||
}
|
||||
|
||||
ring_container_device { "127.0.0.1:6001/1":
|
||||
zone => 2,
|
||||
weight => 1,
|
||||
}
|
||||
|
||||
ring_account_device { "127.0.0.1:6002/1":
|
||||
zone => 3,
|
||||
weight => 1,
|
||||
}'
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }"
|
||||
end
|
||||
|
||||
it 'should set up all of the correct dependencies' do
|
||||
is_expected.to contain_swift__ringbuilder__create('object').with(
|
||||
{:before => ['Ring_object_device[127.0.0.1:6000/1]']}
|
||||
)
|
||||
is_expected.to contain_swift__ringbuilder__create('container').with(
|
||||
{:before => ['Ring_container_device[127.0.0.1:6001/1]']}
|
||||
)
|
||||
is_expected.to contain_swift__ringbuilder__create('account').with(
|
||||
{:before => ['Ring_account_device[127.0.0.1:6002/1]']}
|
||||
)
|
||||
is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[object]']}
|
||||
)
|
||||
is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[container]']}
|
||||
)
|
||||
is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[account]']}
|
||||
)
|
||||
it 'should rebalance the ring for all ring types' do
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('object')
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('account')
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('container')
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
['object', 'account', 'container'].each do |type|
|
||||
it { is_expected.to contain_swift__ringbuilder__create(type).with(
|
||||
:part_power => '18',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '24'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with parameter overrides' do
|
||||
let :params do
|
||||
{:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
}
|
||||
end
|
||||
|
||||
['object', 'account', 'container'].each do |type|
|
||||
it { is_expected.to contain_swift__ringbuilder__create(type).with(
|
||||
:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when specifying ring devices' do
|
||||
let :pre_condition do
|
||||
'class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
ring_object_device { "127.0.0.1:6000/1":
|
||||
zone => 1,
|
||||
weight => 1,
|
||||
}
|
||||
|
||||
ring_container_device { "127.0.0.1:6001/1":
|
||||
zone => 2,
|
||||
weight => 1,
|
||||
}
|
||||
|
||||
ring_account_device { "127.0.0.1:6002/1":
|
||||
zone => 3,
|
||||
weight => 1,
|
||||
}'
|
||||
end
|
||||
|
||||
it 'should set up all of the correct dependencies' do
|
||||
is_expected.to contain_swift__ringbuilder__create('object').with(
|
||||
{:before => ['Ring_object_device[127.0.0.1:6000/1]']}
|
||||
)
|
||||
is_expected.to contain_swift__ringbuilder__create('container').with(
|
||||
{:before => ['Ring_container_device[127.0.0.1:6001/1]']}
|
||||
)
|
||||
is_expected.to contain_swift__ringbuilder__create('account').with(
|
||||
{:before => ['Ring_account_device[127.0.0.1:6002/1]']}
|
||||
)
|
||||
is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[object]']}
|
||||
)
|
||||
is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[container]']}
|
||||
)
|
||||
is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[account]']}
|
||||
)
|
||||
end
|
||||
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
|
||||
|
||||
it_configures 'swift::ringbuilder'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,89 +1,83 @@
|
|||
require 'spec_helper'
|
||||
|
||||
# LP1492636 - Cohabitation of compile matcher and webmock
|
||||
WebMock.disable_net_connect!(:allow => "169.254.169.254")
|
||||
|
||||
describe 'swift::ringserver' do
|
||||
shared_examples 'swift::ringserver' do
|
||||
context 'when storage.pp was already included' do
|
||||
let :pre_condition do
|
||||
"class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }
|
||||
class {'swift' : swift_hash_path_suffix => 'eee' }
|
||||
include swift::ringbuilder"
|
||||
end
|
||||
|
||||
context 'when storage.pp was already included' do
|
||||
let :params do
|
||||
{
|
||||
:local_net_ip => '127.0.0.1',
|
||||
:max_connections => 5
|
||||
}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }
|
||||
class {'swift' : swift_hash_path_suffix => 'eee' }
|
||||
include swift::ringbuilder"
|
||||
it 'does not create the rsync::server class' do
|
||||
is_expected.to compile
|
||||
end
|
||||
|
||||
it 'contain the swift_server rsync block' do
|
||||
is_expected.to contain_rsync__server__module('swift_server').with({
|
||||
'path' => '/etc/swift',
|
||||
'lock_file' => '/var/lock/swift_server.lock',
|
||||
'uid' => 'swift',
|
||||
'gid' => 'swift',
|
||||
'max_connections' => '5',
|
||||
'read_only' => 'true'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
context 'when storage.pp was not already included' do
|
||||
let :pre_condition do
|
||||
"class {'swift' : swift_hash_path_suffix => 'eee' }
|
||||
include swift::ringbuilder"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:local_net_ip => '127.0.0.1',
|
||||
:max_connections => 5
|
||||
}
|
||||
end
|
||||
let :params do
|
||||
{
|
||||
:local_net_ip => '127.0.0.1',
|
||||
:max_connections => 5
|
||||
}
|
||||
end
|
||||
|
||||
it 'does not create the rsync::server class' do
|
||||
is_expected.to compile
|
||||
end
|
||||
it 'does create the rsync::server class' do
|
||||
is_expected.to contain_class('rsync::server').with({
|
||||
'use_xinetd' => 'true',
|
||||
'address' => '127.0.0.1',
|
||||
'use_chroot' => 'no'
|
||||
})
|
||||
end
|
||||
|
||||
it 'contain the swift_server rsync block' do
|
||||
is_expected.to contain_rsync__server__module('swift_server').with({
|
||||
'path' => '/etc/swift',
|
||||
'lock_file' => '/var/lock/swift_server.lock',
|
||||
'uid' => 'swift',
|
||||
'gid' => 'swift',
|
||||
'max_connections' => '5',
|
||||
'read_only' => 'true'
|
||||
})
|
||||
it 'contain the swift_server rsync block' do
|
||||
is_expected.to contain_rsync__server__module('swift_server').with({
|
||||
'path' => '/etc/swift',
|
||||
'lock_file' => '/var/lock/swift_server.lock',
|
||||
'uid' => 'swift',
|
||||
'gid' => 'swift',
|
||||
'max_connections' => '5',
|
||||
'read_only' => 'true'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'when storage.pp was not already included' do
|
||||
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 :pre_condition do
|
||||
"class {'swift' : swift_hash_path_suffix => 'eee' }
|
||||
include swift::ringbuilder"
|
||||
it_configures 'swift::ringserver'
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
let :params do
|
||||
{
|
||||
:local_net_ip => '127.0.0.1',
|
||||
:max_connections => 5
|
||||
}
|
||||
end
|
||||
|
||||
it 'does create the rsync::server class' do
|
||||
is_expected.to contain_class('rsync::server').with({
|
||||
'use_xinetd' => 'true',
|
||||
'address' => '127.0.0.1',
|
||||
'use_chroot' => 'no'
|
||||
})
|
||||
end
|
||||
|
||||
it 'contain the swift_server rsync block' do
|
||||
is_expected.to contain_rsync__server__module('swift_server').with({
|
||||
'path' => '/etc/swift',
|
||||
'lock_file' => '/var/lock/swift_server.lock',
|
||||
'uid' => 'swift',
|
||||
'gid' => 'swift',
|
||||
'max_connections' => '5',
|
||||
'read_only' => 'true'
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,91 +1,102 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:swift_hash_path_suffix => 'string',
|
||||
:max_header_size => '16384',
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
describe 'when no swift hash is specified' do
|
||||
shared_examples 'swift' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
it 'should raise an exception' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when using the default value for package_ensure' do
|
||||
let :file_defaults do
|
||||
{
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
:tag => 'swift-file',
|
||||
:swift_hash_path_suffix => 'string',
|
||||
:max_header_size => '16384',
|
||||
}
|
||||
end
|
||||
it {is_expected.to contain_user('swift')}
|
||||
it {is_expected.to contain_file('/etc/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/var/run/swift').with(
|
||||
{:ensure => 'directory',
|
||||
:selinux_ignore_defaults => true}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/var/lib/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/etc/swift/swift.conf').with(
|
||||
{:ensure => 'file'}.merge(file_defaults)
|
||||
)}
|
||||
it 'configures swift.conf' do
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_suffix').with_value('string')
|
||||
end
|
||||
it 'configures swift.conf' do
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-constraints/max_header_size').with_value('16384')
|
||||
end
|
||||
it { is_expected.to contain_package('swift').with_ensure('present')
|
||||
is_expected.to contain_package('swift').that_requires('Anchor[swift::install::begin]')
|
||||
is_expected.to contain_package('swift').that_notifies('Anchor[swift::install::end]')}
|
||||
it { is_expected.to contain_file('/etc/swift/swift.conf').with_before(/Swift_config\[.+\]/) }
|
||||
end
|
||||
|
||||
describe 'when overriding package_ensure parameter' do
|
||||
it 'should effect ensure state of swift package' do
|
||||
params[:package_ensure] = '1.12.0-1'
|
||||
is_expected.to contain_package('swift').with_ensure(params[:package_ensure])
|
||||
describe 'when no swift hash is specified' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'should raise an exception' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when using the default value for package_ensure' do
|
||||
let :file_defaults do
|
||||
{
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
:tag => 'swift-file',
|
||||
}
|
||||
end
|
||||
|
||||
it {is_expected.to contain_user('swift')}
|
||||
it {is_expected.to contain_file('/etc/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/var/run/swift').with(
|
||||
{:ensure => 'directory',
|
||||
:selinux_ignore_defaults => true}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/var/lib/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/etc/swift/swift.conf').with(
|
||||
{:ensure => 'file'}.merge(file_defaults)
|
||||
)}
|
||||
|
||||
it 'configures swift.conf' do
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_suffix').with_value('string')
|
||||
end
|
||||
|
||||
it 'configures swift.conf' do
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-constraints/max_header_size').with_value('16384')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('swift').with_ensure('present')
|
||||
is_expected.to contain_package('swift').that_requires('Anchor[swift::install::begin]')
|
||||
is_expected.to contain_package('swift').that_notifies('Anchor[swift::install::end]')}
|
||||
it { is_expected.to contain_file('/etc/swift/swift.conf').with_before(/Swift_config\[.+\]/) }
|
||||
end
|
||||
|
||||
describe 'when overriding package_ensure parameter' do
|
||||
it 'should effect ensure state of swift package' do
|
||||
params[:package_ensure] = '1.12.0-1'
|
||||
is_expected.to contain_package('swift').with_ensure(params[:package_ensure])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when providing swift_hash_path_prefix and swift_hash_path_suffix' do
|
||||
let (:params) do
|
||||
{ :swift_hash_path_suffix => 'mysuffix',
|
||||
:swift_hash_path_prefix => 'myprefix' }
|
||||
end
|
||||
|
||||
it 'should configure swift.conf' do
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_suffix').with_value('mysuffix')
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_prefix').with_value('myprefix')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overriding client_package_ensure parameter' do
|
||||
it 'should effect ensure state of swift package' do
|
||||
params[:client_package_ensure] = '2.0.2-1'
|
||||
is_expected.to contain_package('swiftclient').with_ensure(params[:client_package_ensure])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when providing swift_hash_path_prefix and swift_hash_path_suffix' do
|
||||
let (:params) do
|
||||
{ :swift_hash_path_suffix => 'mysuffix',
|
||||
:swift_hash_path_prefix => 'myprefix' }
|
||||
end
|
||||
it 'should configure swift.conf' do
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_suffix').with_value('mysuffix')
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_prefix').with_value('myprefix')
|
||||
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
|
||||
|
||||
it_configures 'swift'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overriding client_package_ensure parameter' do
|
||||
it 'should effect ensure state of swift package' do
|
||||
params[:client_package_ensure] = '2.0.2-1'
|
||||
is_expected.to contain_package('swiftclient').with_ensure(params[:client_package_ensure])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,8 +12,7 @@ describe 'swift::storage::account' do
|
|||
:manage_service => true }
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-storage-account' do
|
||||
|
||||
shared_examples 'swift::storage::account' do
|
||||
[{},
|
||||
{:package_ensure => 'latest'}
|
||||
].each do |param_set|
|
||||
|
@ -36,116 +35,74 @@ describe 'swift::storage::account' do
|
|||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:name => service_name,
|
||||
:ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash[:enabled],
|
||||
:provider => platform_params[:service_provider],
|
||||
:tag => 'swift-service',
|
||||
:name => service_name,
|
||||
:ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash[:enabled],
|
||||
:provider => nil,
|
||||
:tag => 'swift-service',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with disabled service managing' do
|
||||
context 'with disabled service managing and service provider' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false,
|
||||
:enabled => false,
|
||||
:service_provider => 'swiftinit',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
|
||||
{ 'swift-account-server' => 'swift-account-server',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-reaper' => 'swift-account-reaper',
|
||||
'swift-account-auditor' => 'swift-account-auditor' }.each do |service_alias, service_name|
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false,
|
||||
:tag => 'swift-service',
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false,
|
||||
:tag => 'swift-service',
|
||||
:provider => 'swiftinit',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-account-server' => 'swift-account',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-reaper' => 'swift-account-reaper',
|
||||
'swift-account-auditor' => 'swift-account-auditor'
|
||||
},
|
||||
:service_provider => nil
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-account'
|
||||
context 'on Debian platforms using swiftinit service provider' do
|
||||
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
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
|
||||
{ :service_names => {
|
||||
'swift-account-server' => 'swift-account-server',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-reaper' => 'swift-account-reaper',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
},
|
||||
:service_provider => 'swiftinit'
|
||||
}
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{ :service_names => {
|
||||
'swift-account-server' => 'swift-account',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-reaper' => 'swift-account-reaper',
|
||||
'swift-account-auditor' => 'swift-account-auditor'
|
||||
}
|
||||
}
|
||||
when 'RedHat'
|
||||
{ :service_names => {
|
||||
'swift-account-server' => 'openstack-swift-account',
|
||||
'swift-account-replicator' => 'openstack-swift-account-replicator',
|
||||
'swift-account-reaper' => 'openstack-swift-account-reaper',
|
||||
'swift-account-auditor' => 'openstack-swift-account-auditor'
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-account'
|
||||
end
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-account-server' => 'openstack-swift-account',
|
||||
'swift-account-replicator' => 'openstack-swift-account-replicator',
|
||||
'swift-account-reaper' => 'openstack-swift-account-reaper',
|
||||
'swift-account-auditor' => 'openstack-swift-account-auditor'
|
||||
},
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-account'
|
||||
context 'on redhat using swiftinit service provider' do
|
||||
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-account-server' => 'swift-account-server',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-reaper' => 'swift-account-reaper',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
},
|
||||
:service_provider => 'swiftinit'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-account'
|
||||
it_configures 'swift::storage::account'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage::all' do
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'changeme' }
|
||||
swift::storage::filter::healthcheck { 'container': }
|
||||
|
@ -29,150 +21,33 @@ describe 'swift::storage::all' do
|
|||
}
|
||||
end
|
||||
|
||||
describe 'when an internal network ip is not specified' do
|
||||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
|
||||
it_raises 'a Puppet::Error', /expects a value for parameter 'storage_local_net_ip'/
|
||||
else
|
||||
it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
|
||||
end
|
||||
end
|
||||
|
||||
[{ :storage_local_net_ip => '127.0.0.1' },
|
||||
{
|
||||
:devices => '/tmp/node',
|
||||
:storage_local_net_ip => '10.0.0.1',
|
||||
:object_port => '7000',
|
||||
:container_port => '7001',
|
||||
:account_port => '7002',
|
||||
:object_pipeline => ["healthcheck"],
|
||||
:container_pipeline => ["healthcheck"],
|
||||
:account_pipeline => ["healthcheck"],
|
||||
:allow_versions => true,
|
||||
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
|
||||
:incoming_chmod => '0644',
|
||||
:outgoing_chmod => '0644',
|
||||
:log_requests => false
|
||||
}
|
||||
].each do |param_set|
|
||||
|
||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
shared_examples 'swift::storage::all' do
|
||||
describe 'when an internal network ip is not specified' do
|
||||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
|
||||
it_raises 'a Puppet::Error', /expects a value for parameter 'storage_local_net_ip'/
|
||||
else
|
||||
it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
|
||||
end
|
||||
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
['object', 'container', 'account'].each do |type|
|
||||
it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{type}-server").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
})}
|
||||
it { is_expected.to contain_service("swift-#{type}-replicator").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
}
|
||||
)}
|
||||
it { is_expected.to contain_file("/etc/swift/#{type}-server/").with(
|
||||
{:ensure => 'directory'}
|
||||
)}
|
||||
end
|
||||
|
||||
let :storage_server_defaults do
|
||||
{:devices => param_hash[:devices],
|
||||
:storage_local_net_ip => param_hash[:storage_local_net_ip],
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:log_facility => param_hash[:log_facility]
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with(
|
||||
{:type => 'account',
|
||||
:config_file_path => 'account-server.conf',
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:pipeline => param_hash[:account_pipeline] || ['account-server'] }.merge(storage_server_defaults)
|
||||
)}
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with(
|
||||
{:type => 'object',
|
||||
:config_file_path => 'object-server.conf',
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:pipeline => param_hash[:object_pipeline] || ['object-server'] }.merge(storage_server_defaults)
|
||||
)}
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
|
||||
{:type => 'container',
|
||||
:config_file_path => 'container-server.conf',
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:pipeline => param_hash[:container_pipeline] || ['container-server'],
|
||||
:allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults)
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => param_hash[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
}
|
||||
)}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
describe "when specifying statsd enabled" do
|
||||
let :params do
|
||||
{
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
:statsd_enabled => true,
|
||||
:log_statsd_host => 'statsd.example.com',
|
||||
:log_statsd_port => '9999',
|
||||
:log_statsd_default_sample_rate => '2.0',
|
||||
:log_statsd_sample_rate_factor => '1.5',
|
||||
:log_statsd_metric_prefix => 'foo',
|
||||
}
|
||||
end
|
||||
|
||||
{'object' => '6000', 'container' => '6001', 'account' => '6002'}.each do |type,name|
|
||||
it "should configure statsd in the #{type} config file" do
|
||||
is_expected.to contain_concat_fragment("swift-#{type}-#{name}").with_content(
|
||||
/log_statsd_host = statsd.example.com/
|
||||
).with_content(
|
||||
/log_statsd_port = 9999/
|
||||
).with_content(
|
||||
/log_statsd_default_sample_rate = 2.0/
|
||||
).with_content(
|
||||
/log_statsd_sample_rate_factor = 1.5/
|
||||
).with_content(
|
||||
/log_statsd_metric_prefix = foo/
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "when installed on Debian" do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Debian',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
[{ :storage_local_net_ip => '127.0.0.1' },
|
||||
{
|
||||
:devices => '/tmp/node',
|
||||
:storage_local_net_ip => '10.0.0.1',
|
||||
:object_port => '7000',
|
||||
:container_port => '7001',
|
||||
:account_port => '7002'
|
||||
}
|
||||
{
|
||||
:devices => '/tmp/node',
|
||||
:storage_local_net_ip => '10.0.0.1',
|
||||
:object_port => '7000',
|
||||
:container_port => '7001',
|
||||
:account_port => '7002',
|
||||
:object_pipeline => ["healthcheck"],
|
||||
:container_pipeline => ["healthcheck"],
|
||||
:account_pipeline => ["healthcheck"],
|
||||
:allow_versions => true,
|
||||
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
|
||||
:incoming_chmod => '0644',
|
||||
:outgoing_chmod => '0644',
|
||||
:log_requests => false
|
||||
}
|
||||
].each do |param_set|
|
||||
|
||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
|
@ -181,43 +56,172 @@ describe 'swift::storage::all' do
|
|||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
['object', 'container', 'account'].each do |type|
|
||||
it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{type}-server").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
})}
|
||||
it { is_expected.to contain_service("swift-#{type}-replicator").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
}
|
||||
)}
|
||||
it { is_expected.to contain_service("swift-#{type}-replicator").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
}
|
||||
)}
|
||||
it { is_expected.to contain_file("/etc/swift/#{type}-server/").with(
|
||||
{:ensure => 'directory'}
|
||||
)}
|
||||
end
|
||||
|
||||
let :storage_server_defaults do
|
||||
{:devices => param_hash[:devices],
|
||||
:storage_local_net_ip => param_hash[:storage_local_net_ip],
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:log_facility => param_hash[:log_facility]
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with(
|
||||
{:type => 'account',
|
||||
:config_file_path => 'account-server.conf',
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:pipeline => param_hash[:account_pipeline] || ['account-server'] }.merge(storage_server_defaults)
|
||||
)}
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with(
|
||||
{:type => 'object',
|
||||
:config_file_path => 'object-server.conf',
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:pipeline => param_hash[:object_pipeline] || ['object-server'] }.merge(storage_server_defaults)
|
||||
)}
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
|
||||
{:type => 'container',
|
||||
:config_file_path => 'container-server.conf',
|
||||
:incoming_chmod => param_hash[:incoming_chmod],
|
||||
:outgoing_chmod => param_hash[:outgoing_chmod],
|
||||
:pipeline => param_hash[:container_pipeline] || ['container-server'],
|
||||
:allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults)
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => param_hash[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
}
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe "when specifying statsd enabled" do
|
||||
let :params do
|
||||
{
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
:statsd_enabled => true,
|
||||
:log_statsd_host => 'statsd.example.com',
|
||||
:log_statsd_port => '9999',
|
||||
:log_statsd_default_sample_rate => '2.0',
|
||||
:log_statsd_sample_rate_factor => '1.5',
|
||||
:log_statsd_metric_prefix => 'foo',
|
||||
}
|
||||
end
|
||||
|
||||
{'object' => '6000', 'container' => '6001', 'account' => '6002'}.each do |type,name|
|
||||
it "should configure statsd in the #{type} config file" do
|
||||
is_expected.to contain_concat_fragment("swift-#{type}-#{name}").with_content(
|
||||
/log_statsd_host = statsd.example.com/
|
||||
).with_content(
|
||||
/log_statsd_port = 9999/
|
||||
).with_content(
|
||||
/log_statsd_default_sample_rate = 2.0/
|
||||
).with_content(
|
||||
/log_statsd_sample_rate_factor = 1.5/
|
||||
).with_content(
|
||||
/log_statsd_metric_prefix = foo/
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "when specifying number of workers" do
|
||||
let :params do
|
||||
{
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
:account_server_workers => '42',
|
||||
:container_server_workers => '42',
|
||||
:object_server_workers => '42',
|
||||
}
|
||||
end
|
||||
|
||||
{'object' => '6000', 'container' => '6001', 'account' => '6002'}.each do |type,name|
|
||||
it "should define worker count in the #{type} config file" do
|
||||
is_expected.to contain_concat_fragment("swift-#{type}-#{name}").with_content(
|
||||
/workers = 42/
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "when specifying number of workers" do
|
||||
let :params do
|
||||
{
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
:account_server_workers => '42',
|
||||
:container_server_workers => '42',
|
||||
:object_server_workers => '42',
|
||||
}
|
||||
end
|
||||
shared_examples 'swift::storage::all debian' do
|
||||
describe "when installed on Debian" do
|
||||
[{ :storage_local_net_ip => '127.0.0.1' },
|
||||
{
|
||||
:devices => '/tmp/node',
|
||||
:storage_local_net_ip => '10.0.0.1',
|
||||
:object_port => '7000',
|
||||
:container_port => '7001',
|
||||
:account_port => '7002'
|
||||
}
|
||||
].each do |param_set|
|
||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
end
|
||||
|
||||
{'object' => '6000', 'container' => '6001', 'account' => '6002'}.each do |type,name|
|
||||
it "should define worker count in the #{type} config file" do
|
||||
is_expected.to contain_concat_fragment("swift-#{type}-#{name}").with_content(
|
||||
/workers = 42/
|
||||
)
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
['object', 'container', 'account'].each do |type|
|
||||
it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{type}-server").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
})}
|
||||
it { is_expected.to contain_service("swift-#{type}-replicator").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
}
|
||||
)}
|
||||
end
|
||||
end
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::all'
|
||||
|
||||
if facts[:osfamily] == 'Debian'
|
||||
it_configures 'swift::storage::all debian'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ describe 'swift::storage::container' do
|
|||
:manage_service => true }
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-storage-container' do
|
||||
shared_examples 'swift::storage::container' do
|
||||
[{},
|
||||
{:package_ensure => 'latest'}
|
||||
].each do |param_set|
|
||||
|
@ -39,7 +39,7 @@ describe 'swift::storage::container' do
|
|||
:name => service_name,
|
||||
:ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash[:enabled],
|
||||
:provider => platform_params[:service_provider],
|
||||
:provider => nil,
|
||||
:tag => 'swift-service',
|
||||
)
|
||||
end
|
||||
|
@ -47,108 +47,63 @@ describe 'swift::storage::container' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with disabled service managing' do
|
||||
context 'with disabled service managing and service provider' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false,
|
||||
:enabled => false,
|
||||
:service_provider => 'swiftinit',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
{ 'swift-container-server' => 'swift-container-server',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-updater' => 'swift-container-updater',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-container-sync' => 'swift-container-sync' }.each do |service_alias, service_name|
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false,
|
||||
:tag => 'swift-service',
|
||||
:provider => 'swiftinit',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-container-server' => 'swift-container',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-updater' => 'swift-container-updater',
|
||||
'swift-container-auditor' => 'swift-container-auditor'
|
||||
},
|
||||
:service_provider => nil
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-container'
|
||||
|
||||
context 'on debian using swiftinit service provider' do
|
||||
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
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
|
||||
{ :service_names => {
|
||||
'swift-container-server' => 'swift-container-server',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-updater' => 'swift-container-updater',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-container-sync' => 'swift-container-sync'
|
||||
},
|
||||
:service_provider => 'swiftinit'
|
||||
}
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{ :service_names => {
|
||||
'swift-container-server' => 'swift-container',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-updater' => 'swift-container-updater',
|
||||
'swift-container-auditor' => 'swift-container-auditor'
|
||||
}
|
||||
}
|
||||
when 'RedHat'
|
||||
{ :service_names => {
|
||||
'swift-container-server' => 'openstack-swift-container',
|
||||
'swift-container-replicator' => 'openstack-swift-container-replicator',
|
||||
'swift-container-updater' => 'openstack-swift-container-updater',
|
||||
'swift-container-auditor' => 'openstack-swift-container-auditor'
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-container'
|
||||
end
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-container-server' => 'openstack-swift-container',
|
||||
'swift-container-replicator' => 'openstack-swift-container-replicator',
|
||||
'swift-container-updater' => 'openstack-swift-container-updater',
|
||||
'swift-container-auditor' => 'openstack-swift-container-auditor'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-container'
|
||||
|
||||
context 'on redhat using swiftinit service provider' do
|
||||
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-container-server' => 'swift-container-server',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-updater' => 'swift-container-updater',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-container-sync' => 'swift-container-sync'
|
||||
},
|
||||
:service_provider => 'swiftinit'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-container'
|
||||
it_configures 'swift::storage::container'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'swift::storage::disks' do
|
||||
|
||||
shared_examples_for 'swift storage disks' do
|
||||
shared_examples 'swift::storage::disks' do
|
||||
let :params do
|
||||
{
|
||||
:args => {
|
||||
|
@ -44,7 +44,7 @@ describe 'swift::storage::disks' do
|
|||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'swift storage disks'
|
||||
it_configures 'swift::storage::disks'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'swift::storage::loopbacks' do
|
||||
|
||||
shared_examples_for 'swift storage loopbacks' do
|
||||
shared_examples 'swift::storage::loopbacks' do
|
||||
let :params do
|
||||
{
|
||||
:args => {
|
||||
|
@ -44,7 +44,7 @@ describe 'swift::storage::loopbacks' do
|
|||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'swift storage loopbacks'
|
||||
it_configures 'swift::storage::loopbacks'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ describe 'swift::storage::object' do
|
|||
:manage_service => true }
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-storage-object' do
|
||||
|
||||
shared_examples 'swift::storage::object' do
|
||||
[{},
|
||||
{ :package_ensure => 'latest' }
|
||||
].each do |param_set|
|
||||
|
@ -40,7 +39,7 @@ describe 'swift::storage::object' do
|
|||
:name => service_name,
|
||||
:ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash[:enabled],
|
||||
:provider => platform_params[:service_provider],
|
||||
:provider => nil,
|
||||
:tag => 'swift-service',
|
||||
)
|
||||
end
|
||||
|
@ -48,110 +47,65 @@ describe 'swift::storage::object' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with disabled service managing' do
|
||||
context 'with disabled service managing and service provider' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false,
|
||||
:enabled => false,
|
||||
:service_provider => 'swiftinit',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
{ 'swift-object-server' => 'swift-object-server',
|
||||
'swift-object-reconstructor' => 'swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-updater' => 'swift-object-updater',
|
||||
'swift-object-auditor' => 'swift-object-auditor' }.each do |service_alias, service_name|
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false,
|
||||
:tag => 'swift-service',
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false,
|
||||
:tag => 'swift-service',
|
||||
:provider => 'swiftinit',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-object-server' => 'swift-object',
|
||||
'swift-object-reconstructor' => 'swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-updater' => 'swift-object-updater',
|
||||
'swift-object-auditor' => 'swift-object-auditor'
|
||||
},
|
||||
:service_provider => nil
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-object'
|
||||
context 'on debian using swiftinit service provider' do
|
||||
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
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
|
||||
{ :service_names => {
|
||||
'swift-object-server' => 'swift-object-server',
|
||||
'swift-object-reconstructor' => 'swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-updater' => 'swift-object-updater',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
},
|
||||
:service_provider => 'swiftinit'
|
||||
}
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{ :service_names => {
|
||||
'swift-object-server' => 'swift-object',
|
||||
'swift-object-reconstructor' => 'swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-updater' => 'swift-object-updater',
|
||||
'swift-object-auditor' => 'swift-object-auditor'
|
||||
}
|
||||
}
|
||||
when 'RedHat'
|
||||
{ :service_names => {
|
||||
'swift-object-server' => 'openstack-swift-object',
|
||||
'swift-object-reconstructor' => 'openstack-swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'openstack-swift-object-replicator',
|
||||
'swift-object-updater' => 'openstack-swift-object-updater',
|
||||
'swift-object-auditor' => 'openstack-swift-object-auditor'
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-object'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-object-server' => 'openstack-swift-object',
|
||||
'swift-object-reconstructor' => 'openstack-swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'openstack-swift-object-replicator',
|
||||
'swift-object-updater' => 'openstack-swift-object-updater',
|
||||
'swift-object-auditor' => 'openstack-swift-object-auditor'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-object'
|
||||
context 'on redhat using swiftinit service provider' do
|
||||
|
||||
before do
|
||||
params.merge!({ :service_provider => 'swiftinit' })
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :service_names => {
|
||||
'swift-object-server' => 'swift-object-server',
|
||||
'swift-object-reconstructor' => 'swift-object-reconstructor',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-updater' => 'swift-object-updater',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
},
|
||||
:service_provider => 'swiftinit'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-object'
|
||||
it_configures 'swift::storage::object'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,43 +1,52 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
describe 'when required classes are specified' do
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'changeme' }"
|
||||
end
|
||||
|
||||
describe 'when the local net ip is specified' do
|
||||
let :params do
|
||||
{
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
}
|
||||
shared_examples 'swift::storage' do
|
||||
describe 'when required classes are specified' do
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'changeme' }"
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => params[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
}
|
||||
)}
|
||||
describe 'when the local net ip is specified' do
|
||||
let :params do
|
||||
{
|
||||
:storage_local_net_ip => '127.0.0.1',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => params[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
}
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when local net ip is not specified' do
|
||||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
|
||||
it_raises 'a Puppet::Error', /expects a value for parameter 'storage_local_net_ip'/
|
||||
else
|
||||
it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'when local net ip is not specified' do
|
||||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
|
||||
it_raises 'a Puppet::Error', /expects a value for parameter 'storage_local_net_ip'/
|
||||
else
|
||||
it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
|
||||
|
||||
describe 'when the dependencies are not specified' do
|
||||
it 'should fail' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'when the dependencies are not specified' do
|
||||
it 'should fail' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
|
||||
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
|
||||
|
||||
it_configures 'swift::storage'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,44 +6,54 @@ describe 'swift::test_file' do
|
|||
{:password => 'foo'}
|
||||
end
|
||||
|
||||
describe 'with defaults' do
|
||||
shared_examples 'swift::test_file' do
|
||||
describe 'with defaults' do
|
||||
let :params do
|
||||
default_params
|
||||
end
|
||||
|
||||
let :params do
|
||||
default_params
|
||||
it 'should create a reasonable test file' do
|
||||
verify_contents(catalogue, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.1"',
|
||||
"user='openstack:admin'",
|
||||
"password='foo'"
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should create a reasonable test file' do
|
||||
verify_contents(catalogue, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.1"',
|
||||
"user='openstack:admin'",
|
||||
"password='foo'"
|
||||
]
|
||||
)
|
||||
end
|
||||
describe 'when overridding' do
|
||||
let :params do
|
||||
default_params.merge({
|
||||
:auth_server => '127.0.0.2',
|
||||
:tenant => 'tenant',
|
||||
:user => 'user',
|
||||
:password => 'password'
|
||||
})
|
||||
end
|
||||
|
||||
it 'should create a configured test file' do
|
||||
verify_contents(catalogue, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.2"',
|
||||
"user='tenant:user'",
|
||||
"password='password'"
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overridding' do
|
||||
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 :params do
|
||||
default_params.merge({
|
||||
:auth_server => '127.0.0.2',
|
||||
:tenant => 'tenant',
|
||||
:user => 'user',
|
||||
:password => 'password'
|
||||
})
|
||||
it_configures 'swift::test_file'
|
||||
end
|
||||
|
||||
it 'should create a configured test file' do
|
||||
verify_contents(catalogue, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.2"',
|
||||
"user='tenant:user'",
|
||||
"password='password'"
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::xfs' do
|
||||
['xfsprogs', 'parted'].each do |present_package|
|
||||
it { is_expected.to contain_package(present_package).with_ensure('present') }
|
||||
shared_examples 'swift::xfs' do
|
||||
['xfsprogs', 'parted'].each do |present_package|
|
||||
it { is_expected.to contain_package(present_package).with_ensure('present') }
|
||||
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
|
||||
|
||||
it_configures 'swift::xfs'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::tempauth_account' do
|
||||
shared_examples 'swift::proxy::tempauth_account' do
|
||||
let :title do
|
||||
' user_admin_admin, admin .admin .reseller_admin'
|
||||
end
|
||||
|
||||
let :title do
|
||||
' user_admin_admin, admin .admin .reseller_admin'
|
||||
describe 'when passing in a string containing "user_<account>_<user>, <key> .<group1> .<groupx>"' do
|
||||
it { should contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin .admin .reseller_admin') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when passing in a string containing "user_<account>_<user>, <key> .<group1> .<groupx>"' do
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:tempauth/user_admin_admin').with_value('admin .admin .reseller_admin') }
|
||||
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
|
||||
|
||||
it_configures 'swift::proxy::tempauth_acount'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,54 +1,68 @@
|
|||
require 'spec_helper'
|
||||
describe 'swift::ringbuilder::create' do
|
||||
|
||||
describe 'swift::ringbuilder::create' do
|
||||
let :default_params do
|
||||
{:part_power => 18,
|
||||
:replicas => 3,
|
||||
:min_part_hours => 24,
|
||||
:user => 'swift'}
|
||||
{
|
||||
:part_power => 18,
|
||||
:replicas => 3,
|
||||
:min_part_hours => 24,
|
||||
:user => 'swift'
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with allowed titles' do
|
||||
['object', 'container', 'account'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
type
|
||||
end
|
||||
shared_examples 'swift::ringbuilder::create' do
|
||||
describe 'with allowed titles' do
|
||||
['object', 'container', 'account'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
type
|
||||
end
|
||||
|
||||
[{},
|
||||
{:part_power => 19,
|
||||
:replicas => 6,
|
||||
:min_part_hours => 2,
|
||||
:user => 'root'}].each do |param_set|
|
||||
[{},
|
||||
{:part_power => 19,
|
||||
:replicas => 6,
|
||||
:min_part_hours => 2,
|
||||
:user => 'root'}].each do |param_set|
|
||||
|
||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parame
|
||||
ters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
describe "when #{param_set == {} ? "using default" : "specifying"} class parame ters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
end
|
||||
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
it { should contain_exec("create_#{type}").with(
|
||||
:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
|
||||
:path => ['/usr/bin'],
|
||||
:user => param_hash[:user],
|
||||
:creates => "/etc/swift/#{type}.builder",
|
||||
)}
|
||||
end
|
||||
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("create_#{type}").with(
|
||||
{:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
|
||||
:path => ['/usr/bin'],
|
||||
:user => param_hash[:user],
|
||||
:creates => "/etc/swift/#{type}.builder" }
|
||||
)}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'with an invalid title' do
|
||||
let :title do
|
||||
'invalid'
|
||||
end
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
|
||||
describe 'with an invalid title' do
|
||||
let :title do
|
||||
'invalid'
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error) }
|
||||
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
|
||||
|
||||
it_configures 'swift::ringbuilder::create'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,74 +6,75 @@ describe 'swift::ringbuilder::policy_ring' do
|
|||
"1"
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:os_workers => 1,
|
||||
:processorcount => 1,
|
||||
})
|
||||
end
|
||||
describe 'when swift class is not included' do
|
||||
it 'should fail' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
describe 'when swift class is included and policy is >= 1' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }"
|
||||
shared_examples 'swift::ringbuilder::policy_ring' do
|
||||
describe 'when swift class is not included' do
|
||||
it { should raise_error(Puppet::Error) }
|
||||
end
|
||||
|
||||
it 'should rebalance the object ring' do
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('object-1')
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
it { is_expected.to contain_swift__ringbuilder__create('object-1').with(
|
||||
:part_power => '18',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '24'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'with parameter overrides' do
|
||||
|
||||
let :params do
|
||||
{:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift__ringbuilder__create('object-1').with(
|
||||
:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
describe 'when specifying ring devices' do
|
||||
describe 'when swift class is included and policy is >= 1' do
|
||||
let :pre_condition do
|
||||
'class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
ring_object_device { "1:127.0.0.1:6000/1":
|
||||
zone => 1,
|
||||
weight => 1,
|
||||
}'
|
||||
|
||||
"class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }"
|
||||
end
|
||||
|
||||
it 'should set up all of the correct dependencies' do
|
||||
is_expected.to contain_swift__ringbuilder__create('object-1').with(
|
||||
{:before => ['Ring_object_device[1:127.0.0.1:6000/1]']}
|
||||
)
|
||||
is_expected.to contain_ring_object_device('1:127.0.0.1:6000/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[object-1]']}
|
||||
)
|
||||
it 'should rebalance the object ring' do
|
||||
is_expected.to contain_swift__ringbuilder__rebalance('object-1')
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
it { is_expected.to contain_swift__ringbuilder__create('object-1').with(
|
||||
:part_power => '18',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '24'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'with parameter overrides' do
|
||||
let :params do
|
||||
{:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift__ringbuilder__create('object-1').with(
|
||||
:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when specifying ring devices' do
|
||||
let :pre_condition do
|
||||
'class { memcached: max_memory => 1}
|
||||
class { swift: swift_hash_path_suffix => string }
|
||||
ring_object_device { "1:127.0.0.1:6000/1":
|
||||
zone => 1,
|
||||
weight => 1,
|
||||
}'
|
||||
end
|
||||
|
||||
it 'should set up all of the correct dependencies' do
|
||||
is_expected.to contain_swift__ringbuilder__create('object-1').with(
|
||||
{:before => ['Ring_object_device[1:127.0.0.1:6000/1]']}
|
||||
)
|
||||
is_expected.to contain_ring_object_device('1:127.0.0.1:6000/1').with(
|
||||
{:notify => ['Swift::Ringbuilder::Rebalance[object-1]']}
|
||||
)
|
||||
end
|
||||
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
|
||||
|
||||
it_configures 'swift::ringbuilder::policy_ring'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,50 +1,73 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::ringbuilder::rebalance' do
|
||||
describe 'with allowed titles' do
|
||||
['object', 'container', 'account'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
type
|
||||
shared_examples 'swift::ringbuilder::rebalance' do
|
||||
describe 'with allowed titles' do
|
||||
['object', 'container', 'account'].each do |type|
|
||||
describe "when title is #{type}" do
|
||||
let :title do
|
||||
type
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("rebalance_#{type}").with(
|
||||
{:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
|
||||
:path => ['/usr/bin'],
|
||||
:refreshonly => true}
|
||||
)}
|
||||
end
|
||||
it { is_expected.to contain_exec("rebalance_#{type}").with(
|
||||
{:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
|
||||
:path => ['/usr/bin'],
|
||||
:refreshonly => true}
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with valid seed' do
|
||||
let :params do
|
||||
{ :seed => '999' }
|
||||
end
|
||||
|
||||
let :title do
|
||||
'object'
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("rebalance_object").with(
|
||||
{:command => "swift-ring-builder /etc/swift/object.builder rebalance 999",
|
||||
:path => ['/usr/bin'],
|
||||
:refreshonly => true}
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'with an invalid seed' do
|
||||
let :title do
|
||||
'object'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :seed => 'invalid' }
|
||||
end
|
||||
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with an invalid title' do
|
||||
let :title do
|
||||
'invalid'
|
||||
end
|
||||
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'with valid seed' do
|
||||
let :params do
|
||||
{ :seed => '999' }
|
||||
end
|
||||
let :title do
|
||||
'object'
|
||||
end
|
||||
it { is_expected.to contain_exec("rebalance_object").with(
|
||||
{:command => "swift-ring-builder /etc/swift/object.builder rebalance 999",
|
||||
:path => ['/usr/bin'],
|
||||
:refreshonly => true}
|
||||
)}
|
||||
end
|
||||
describe 'with an invalid seed' do
|
||||
let :title do
|
||||
'object'
|
||||
end
|
||||
let :params do
|
||||
{ :seed => 'invalid' }
|
||||
end
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
describe 'with an invalid title' do
|
||||
let :title do
|
||||
'invalid'
|
||||
end
|
||||
it 'should raise an error' do
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
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
|
||||
|
||||
it_configures 'swift::ringbuilder::rebalance'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,19 +16,32 @@ describe 'swift::storage::disk' do
|
|||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("create_partition_label-sdb").with(
|
||||
:command => "parted -s #{params[:base_dir]}/sdb mklabel gpt #{params[:ext_args]}",
|
||||
:path => ["/usr/bin/", "/sbin", "/bin"],
|
||||
:onlyif => ["test -b #{params[:base_dir]}/sdb","parted #{params[:base_dir]}/sdb print|tail -1|grep 'Error'"],
|
||||
:before => 'Anchor[swift::config::end]'
|
||||
)}
|
||||
shared_examples 'swift::storage::disk' do
|
||||
it { is_expected.to contain_exec("create_partition_label-sdb").with(
|
||||
:command => "parted -s #{params[:base_dir]}/sdb mklabel gpt #{params[:ext_args]}",
|
||||
:path => ["/usr/bin/", "/sbin", "/bin"],
|
||||
:onlyif => ["test -b #{params[:base_dir]}/sdb","parted #{params[:base_dir]}/sdb print|tail -1|grep 'Error'"],
|
||||
:before => 'Anchor[swift::config::end]'
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_swift__storage__xfs('sdb').with(
|
||||
:device => '/dev/sdb',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:byte_size => '1024',
|
||||
:subscribe => 'Exec[create_partition_label-sdb]',
|
||||
:loopback => false
|
||||
) }
|
||||
it { is_expected.to contain_swift__storage__xfs('sdb').with(
|
||||
:device => '/dev/sdb',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:byte_size => '1024',
|
||||
:subscribe => 'Exec[create_partition_label-sdb]',
|
||||
:loopback => false
|
||||
) }
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::disk'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,15 +5,24 @@ describe 'swift::storage::filter::healthcheck' do
|
|||
'dummy'
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct content' do
|
||||
is_expected.to contain_concat_fragment('swift_healthcheck_dummy').with_content('
|
||||
shared_examples 'swift::storage::filter::healthcheck' do
|
||||
it 'should build the fragment with correct content' do
|
||||
is_expected.to contain_concat_fragment('swift_healthcheck_dummy').with_content('
|
||||
[filter:healthcheck]
|
||||
use = egg:swift#healthcheck
|
||||
')
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::filter::healthcheck'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,29 +5,39 @@ describe 'swift::storage::filter::recon' do
|
|||
'dummy'
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{}
|
||||
end
|
||||
|
||||
describe 'when passing default parameters' do
|
||||
it 'should build the fragment with correct content' do
|
||||
is_expected.to contain_concat_fragment('swift_recon_dummy').with_content('
|
||||
shared_examples 'swift::storage::filter::recon' do
|
||||
describe 'when passing default parameters' do
|
||||
it 'should build the fragment with correct content' do
|
||||
is_expected.to contain_concat_fragment('swift_recon_dummy').with_content('
|
||||
[filter:recon]
|
||||
use = egg:swift#recon
|
||||
recon_cache_path = /var/cache/swift
|
||||
')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overriding default parameters' do
|
||||
let :params do
|
||||
{
|
||||
:cache_path => '/some/other/path'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct content' do
|
||||
is_expected.to contain_concat_fragment('swift_recon_dummy').with_content(/recon_cache_path = \/some\/other\/path/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when overriding default parameters' do
|
||||
let :params do
|
||||
{
|
||||
:cache_path => '/some/other/path'
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct content' do
|
||||
is_expected.to contain_concat_fragment('swift_recon_dummy').with_content(/recon_cache_path = \/some\/other\/path/)
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::filter::recon'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage::generic' do
|
||||
|
||||
let :title do
|
||||
'account'
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
|
||||
|
@ -24,17 +16,18 @@ describe 'swift::storage::generic' do
|
|||
:manage_service => true }
|
||||
end
|
||||
|
||||
describe 'with an invalid title' do
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
it_raises 'a Puppet::Error', /does not match/
|
||||
end
|
||||
shared_examples 'swift::storage::generic' do
|
||||
describe 'with an invalid title' do
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /does not match/
|
||||
end
|
||||
|
||||
shared_examples_for 'swift-storage-generic' do
|
||||
%w(account object container).each do |t|
|
||||
[{},
|
||||
{ :package_ensure => 'latest' }
|
||||
{ :package_ensure => 'latest', :service_provider => 'swiftinit' }
|
||||
].each do |param_set|
|
||||
describe "when #{param_set == {} ? 'using default' : 'specifying'} class parameters" do
|
||||
before do
|
||||
|
@ -45,11 +38,29 @@ describe 'swift::storage::generic' do
|
|||
t
|
||||
end
|
||||
|
||||
let :swiftinit_platform do
|
||||
{
|
||||
'swift-account-server' => 'swift-account-server',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
'swift-container-server' => 'swift-container-server',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-object-server' => 'swift-object-server',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
}
|
||||
end
|
||||
|
||||
[{ :enabled => true, :manage_service => true },
|
||||
{ :enabled => false, :manage_service => true }].each do |param_hash_manage|
|
||||
context "when service is_expected.to be #{param_hash_manage[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
before do
|
||||
params.merge!(param_hash_manage)
|
||||
|
||||
if param_set[:service_provider] == 'swiftinit'
|
||||
platform_params.merge!(swiftinit_platform)
|
||||
end
|
||||
end
|
||||
|
||||
it do
|
||||
|
@ -59,33 +70,37 @@ describe 'swift::storage::generic' do
|
|||
:notify => ['Anchor[swift::install::end]']
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to contain_service("swift-#{t}-server").with(
|
||||
:name => platform_params["swift-#{t}-server"],
|
||||
:ensure => (param_hash_manage[:manage_service] && param_hash_manage[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash_manage[:enabled],
|
||||
:provider => platform_params['service_provider'],
|
||||
:provider => param_set[:service_provider],
|
||||
:tag => 'swift-service'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to contain_service("swift-#{t}-replicator").with(
|
||||
:name => platform_params["swift-#{t}-replicator"],
|
||||
:ensure => (param_hash_manage[:manage_service] && param_hash_manage[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash_manage[:enabled],
|
||||
:provider => platform_params['service_provider'],
|
||||
:provider => param_set[:service_provider],
|
||||
:tag => 'swift-service'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to contain_service("swift-#{t}-auditor").with(
|
||||
:name => platform_params["swift-#{t}-auditor"],
|
||||
:ensure => (param_hash_manage[:manage_service] && param_hash_manage[:enabled]) ? 'running' : 'stopped',
|
||||
:enable => param_hash_manage[:enabled],
|
||||
:provider => platform_params['service_provider'],
|
||||
:provider => param_set[:service_provider],
|
||||
:tag => 'swift-service'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
is_expected.to contain_file("/etc/swift/#{t}-server/").with(
|
||||
:ensure => 'directory',
|
||||
|
@ -98,96 +113,44 @@ describe 'swift::storage::generic' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ 'swift-account-server' => 'swift-account',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
'swift-container-server' => 'swift-container',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-object-server' => 'swift-object',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
'service_provider' => nil
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-generic'
|
||||
|
||||
context 'on Debian platforms using swiftinit service provider' do
|
||||
before do
|
||||
params.merge!(:service_provider => 'swiftinit')
|
||||
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
|
||||
{ 'swift-account-server' => 'swift-account-server',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
'swift-container-server' => 'swift-container-server',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-object-server' => 'swift-object-server',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
'service_provider' => 'swiftinit',
|
||||
}
|
||||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{
|
||||
'swift-account-server' => 'swift-account',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
'swift-container-server' => 'swift-container',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-object-server' => 'swift-object',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
}
|
||||
when 'RedHat'
|
||||
{
|
||||
'swift-account-server' => 'openstack-swift-account',
|
||||
'swift-account-replicator' => 'openstack-swift-account-replicator',
|
||||
'swift-account-auditor' => 'openstack-swift-account-auditor',
|
||||
'swift-container-server' => 'openstack-swift-container',
|
||||
'swift-container-replicator' => 'openstack-swift-container-replicator',
|
||||
'swift-container-auditor' => 'openstack-swift-container-auditor',
|
||||
'swift-object-server' => 'openstack-swift-object',
|
||||
'swift-object-replicator' => 'openstack-swift-object-replicator',
|
||||
'swift-object-auditor' => 'openstack-swift-object-auditor',
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-generic'
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Redhat platforms' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Redhat',
|
||||
:osfamily => 'Redhat',
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ 'swift-account-server' => 'openstack-swift-account',
|
||||
'swift-account-replicator' => 'openstack-swift-account-replicator',
|
||||
'swift-account-auditor' => 'openstack-swift-account-auditor',
|
||||
'swift-container-server' => 'openstack-swift-container',
|
||||
'swift-container-replicator' => 'openstack-swift-container-replicator',
|
||||
'swift-container-auditor' => 'openstack-swift-container-auditor',
|
||||
'swift-object-server' => 'openstack-swift-object',
|
||||
'swift-object-replicator' => 'openstack-swift-object-replicator',
|
||||
'swift-object-auditor' => 'openstack-swift-object-auditor',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-generic'
|
||||
|
||||
context 'on Redhat platforms using swiftinit service provider' do
|
||||
before do
|
||||
params.merge!(:service_provider => 'swiftinit')
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ 'swift-account-server' => 'swift-account-server',
|
||||
'swift-account-replicator' => 'swift-account-replicator',
|
||||
'swift-account-auditor' => 'swift-account-auditor',
|
||||
'swift-container-server' => 'swift-container-server',
|
||||
'swift-container-replicator' => 'swift-container-replicator',
|
||||
'swift-container-auditor' => 'swift-container-auditor',
|
||||
'swift-object-server' => 'swift-object-server',
|
||||
'swift-object-replicator' => 'swift-object-replicator',
|
||||
'swift-object-auditor' => 'swift-object-auditor',
|
||||
'service_provider' => 'swiftinit',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'swift-storage-generic'
|
||||
it_configures 'swift::storage::generic'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,12 +7,25 @@ describe 'swift::storage::loopback' do
|
|||
'dans_disk'
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift__storage__xfs('dans_disk').with(
|
||||
:device => '/srv/loopback-device/dans_disk',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:byte_size => '1024',
|
||||
:subscribe => 'Exec[create_partition-dans_disk]',
|
||||
:loopback => true
|
||||
) }
|
||||
shared_examples 'swift::storage::loopback' do
|
||||
it { is_expected.to contain_swift__storage__xfs('dans_disk').with(
|
||||
:device => '/srv/loopback-device/dans_disk',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:byte_size => '1024',
|
||||
:subscribe => 'Exec[create_partition-dans_disk]',
|
||||
:loopback => true
|
||||
)}
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::loopback'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage::mount' do
|
||||
# TODO add unit tests
|
||||
|
||||
|
@ -6,56 +7,66 @@ describe 'swift::storage::mount' do
|
|||
'dans_mount_point'
|
||||
end
|
||||
|
||||
describe 'with defaults params' do
|
||||
let :params do
|
||||
{
|
||||
:device => '/dev/sda'
|
||||
}
|
||||
shared_examples 'swift::storage::mount' do
|
||||
describe 'with defaults params' do
|
||||
let :params do
|
||||
{
|
||||
:device => '/dev/sda'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
|
||||
:ensure => 'present',
|
||||
:device => '/dev/sda',
|
||||
:fstype => 'xfs',
|
||||
:options => 'noatime,nodiratime,nobarrier,logbufs=8',
|
||||
)}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
|
||||
:ensure => 'present',
|
||||
:device => '/dev/sda',
|
||||
:fstype => 'xfs',
|
||||
:options => 'noatime,nodiratime,nobarrier,logbufs=8',
|
||||
)}
|
||||
describe 'when mounting a loopback device' do
|
||||
let :params do
|
||||
{
|
||||
:device => '/dev/sda',
|
||||
:loopback => true
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
|
||||
:device => '/dev/sda',
|
||||
:options => 'noatime,nodiratime,nobarrier,loop,logbufs=8'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when mounting a loopback device on selinux system' do
|
||||
let :params do
|
||||
{
|
||||
:device => '/dev/sda'
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:selinux => 'true',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
|
||||
{:command => "restorecon /srv/node/dans_mount_point",
|
||||
:path => ['/usr/sbin', '/sbin'],
|
||||
:refreshonly => true}
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when mounting a loopback device' do
|
||||
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 :params do
|
||||
{
|
||||
:device => '/dev/sda',
|
||||
:loopback => true
|
||||
}
|
||||
it_configures 'swift::storage::mount'
|
||||
end
|
||||
|
||||
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
|
||||
:device => '/dev/sda',
|
||||
:options => 'noatime,nodiratime,nobarrier,loop,logbufs=8'
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
describe 'when mounting a loopback device on selinux system' do
|
||||
let :params do
|
||||
{
|
||||
:device => '/dev/sda'
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:selinux => 'true',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
|
||||
{:command => "restorecon /srv/node/dans_mount_point",
|
||||
:path => ['/usr/sbin', '/sbin'],
|
||||
:refreshonly => true}
|
||||
)}
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,68 +1,73 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage::node' do
|
||||
shared_examples 'swift::storage::node' do
|
||||
describe 'with valid preconditons should contain ring devices' do
|
||||
let :params do
|
||||
{
|
||||
:zone => "1",
|
||||
:mnt_base_dir => '/srv/node'
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:os_workers => 1,
|
||||
})
|
||||
let :title do
|
||||
"1"
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }"
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ring_object_device("127.0.0.1:6010/1") }
|
||||
it { is_expected.to contain_ring_container_device("127.0.0.1:6011/1") }
|
||||
it { is_expected.to contain_ring_account_device("127.0.0.1:6012/1") }
|
||||
end
|
||||
|
||||
context 'when zone is not a number' do
|
||||
let(:title) { '1' }
|
||||
|
||||
let :params do
|
||||
{ :zone => 'invalid',
|
||||
:mnt_base_dir => '/srv/node' }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /The zone parameter must be an integer/
|
||||
end
|
||||
|
||||
describe 'with valid preconditons and policy_index=1 should contain ring devices' do
|
||||
let :params do
|
||||
{
|
||||
:zone => "1",
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:policy_index => '1',
|
||||
}
|
||||
end
|
||||
|
||||
let :title do
|
||||
"1"
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }"
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ring_object_device("1:127.0.0.1:6010/1") }
|
||||
it { is_expected.to contain_ring_container_device("127.0.0.1:6011/1") }
|
||||
it { is_expected.to contain_ring_account_device("127.0.0.1:6012/1") }
|
||||
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
|
||||
|
||||
describe 'with valid preconditons should contain ring devices' do
|
||||
let :params do
|
||||
{
|
||||
:zone => "1",
|
||||
:mnt_base_dir => '/srv/node'
|
||||
}
|
||||
it_configures 'swift::storage::node'
|
||||
end
|
||||
|
||||
let :title do
|
||||
"1"
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }"
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ring_object_device("127.0.0.1:6010/1") }
|
||||
it { is_expected.to contain_ring_container_device("127.0.0.1:6011/1") }
|
||||
it { is_expected.to contain_ring_account_device("127.0.0.1:6012/1") }
|
||||
|
||||
end
|
||||
|
||||
context 'when zone is not a number' do
|
||||
let(:title) { '1' }
|
||||
let :params do
|
||||
{ :zone => 'invalid',
|
||||
:mnt_base_dir => '/srv/node' }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /The zone parameter must be an integer/
|
||||
end
|
||||
|
||||
describe 'with valid preconditons and policy_index=1 should contain ring devices' do
|
||||
let :params do
|
||||
{
|
||||
:zone => "1",
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:policy_index => '1',
|
||||
}
|
||||
end
|
||||
|
||||
let :title do
|
||||
"1"
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }"
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ring_object_device("1:127.0.0.1:6010/1") }
|
||||
it { is_expected.to contain_ring_container_device("127.0.0.1:6011/1") }
|
||||
it { is_expected.to contain_ring_account_device("127.0.0.1:6012/1") }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage::server' do
|
||||
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:os_workers => 1,
|
||||
})
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }
|
||||
|
@ -20,6 +12,7 @@ describe 'swift::storage::server' do
|
|||
swift::storage::filter::recon { 'account': }
|
||||
"
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
{
|
||||
:devices => '/srv/node',
|
||||
|
@ -32,148 +25,169 @@ describe 'swift::storage::server' do
|
|||
}
|
||||
end
|
||||
|
||||
describe 'with an invalid title' do
|
||||
let :params do
|
||||
{:storage_local_net_ip => '127.0.0.1',
|
||||
:type => 'object'}
|
||||
end
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
it_raises 'a Puppet::Error', /does not match/
|
||||
end
|
||||
|
||||
['account', 'object', 'container'].each do |t|
|
||||
|
||||
describe "for type #{t}" do
|
||||
shared_examples 'swift::storage::server' do
|
||||
describe 'with an invalid title' do
|
||||
let :params do
|
||||
{:storage_local_net_ip => '127.0.0.1',
|
||||
:type => 'object'}
|
||||
end
|
||||
|
||||
let :title do
|
||||
'8000'
|
||||
'foo'
|
||||
end
|
||||
|
||||
let :req_params do
|
||||
{:storage_local_net_ip => '10.0.0.1', :type => t}
|
||||
end
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
it_raises 'a Puppet::Error', /does not match/
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package("swift-#{t}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{t}-server").with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
)}
|
||||
|
||||
describe 'when parameters are overridden' do
|
||||
{
|
||||
:devices => '/tmp/foo',
|
||||
:user => 'dan',
|
||||
:mount_check => true,
|
||||
:workers => 7,
|
||||
:pipeline => ['healthcheck'],
|
||||
}.each do |k,v|
|
||||
describe "when #{k} is set" do
|
||||
let :params do req_params.merge({k => v}) end
|
||||
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*$/) }
|
||||
end
|
||||
end
|
||||
describe "when pipeline is passed an array" do
|
||||
let :params do req_params.merge({:pipeline => ['healthcheck','recon']}) end
|
||||
it { is_expected.to contain_concat__fragment("swift-#{t}-#{title}").with(
|
||||
:content => /^pipeline\s*=\s*healthcheck recon\s*$/,
|
||||
:before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]",]
|
||||
)}
|
||||
end
|
||||
describe "when pipeline is not passed an array" do
|
||||
let :params do req_params.merge({:pipeline => 'not an array'}) end
|
||||
it_raises 'a Puppet::Error', /is not an Array/
|
||||
['account', 'object', 'container'].each do |t|
|
||||
describe "for type #{t}" do
|
||||
let :title do
|
||||
'8000'
|
||||
end
|
||||
|
||||
describe "when replicator_concurrency is set" do
|
||||
let :params do req_params.merge({:replicator_concurrency => 42}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m) }
|
||||
end
|
||||
if t != 'account'
|
||||
describe "when updater_concurrency is set" do
|
||||
let :params do req_params.merge({:updater_concurrency => 73}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m) }
|
||||
end
|
||||
else
|
||||
describe "when reaper_concurrency is set" do
|
||||
let :params do req_params.merge({:reaper_concurrency => 4682}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m) }
|
||||
end
|
||||
end
|
||||
if t == 'container'
|
||||
describe "when allow_versioning is set" do
|
||||
let :params do req_params.merge({ :allow_versions => false, }) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m) }
|
||||
end
|
||||
end
|
||||
describe "when log_udp_port is set" do
|
||||
context 'and log_udp_host is not set' do
|
||||
let :params do req_params.merge({ :log_udp_port => 514}) end
|
||||
it_raises 'a Puppet::Error', /log_udp_port requires log_udp_host to be set/
|
||||
end
|
||||
context 'and log_udp_host is set' do
|
||||
let :params do req_params.merge(
|
||||
{ :log_udp_host => '127.0.0.1',
|
||||
:log_udp_port => '514'})
|
||||
end
|
||||
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_concat_fragment("swift-#{t}-#{title}").with_content(/^log_udp_port\s*=\s*514\s*$/) }
|
||||
end
|
||||
let :req_params do
|
||||
{:storage_local_net_ip => '10.0.0.1', :type => t}
|
||||
end
|
||||
|
||||
describe "when using swift_#{t}_config resource" do
|
||||
let :pre_condition do
|
||||
"
|
||||
class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }
|
||||
swift_#{t}_config { 'foo/bar': value => 'foo' }
|
||||
"
|
||||
end
|
||||
it { is_expected.to contain_concat("/etc/swift/#{t}-server.conf").that_comes_before("Swift_#{t}_config[foo/bar]") }
|
||||
end
|
||||
describe "when log_requests is turned off" do
|
||||
let :params do req_params.merge({:log_requests => false}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_requests\s*=\s*false\s*$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with all allowed defaults' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_rsync__server__module("#{t}").with(
|
||||
:path => '/srv/node',
|
||||
:lock_file => "/var/lock/#{t}.lock",
|
||||
:uid => 'swift',
|
||||
:gid => 'swift',
|
||||
:incoming_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
||||
:outgoing_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
||||
:max_connections => 25,
|
||||
:read_only => false
|
||||
it { is_expected.to contain_package("swift-#{t}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{t}-server").with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
)}
|
||||
|
||||
# verify template lines
|
||||
it { is_expected.to contain_concat("/etc/swift/#{t}-server.conf") }
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^devices\s*=\s*\/srv\/node\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_concat_fragment("swift-#{t}-#{title}").with_content(/^bind_port\s*=\s*#{title}\s*$/) }
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^mount_check\s*=\s*true\s*$/) }
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^user\s*=\s*swift\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_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_facility\s*=\s*LOG_LOCAL2\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_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_address\s*=\s*\/dev\/log\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_concat_fragment("swift-#{t}-#{title}").with_content(/^workers\s*=\s*1\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*$/) }
|
||||
describe 'when parameters are overridden' do
|
||||
{
|
||||
:devices => '/tmp/foo',
|
||||
:user => 'dan',
|
||||
:mount_check => true,
|
||||
:workers => 7,
|
||||
:pipeline => ['healthcheck'],
|
||||
}.each do |k,v|
|
||||
describe "when #{k} is set" do
|
||||
let :params do req_params.merge({k => v}) end
|
||||
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*$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "when pipeline is passed an array" do
|
||||
let :params do req_params.merge({:pipeline => ['healthcheck','recon']}) end
|
||||
it { is_expected.to contain_concat__fragment("swift-#{t}-#{title}").with(
|
||||
:content => /^pipeline\s*=\s*healthcheck recon\s*$/,
|
||||
:before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]",]
|
||||
)}
|
||||
end
|
||||
|
||||
describe "when pipeline is not passed an array" do
|
||||
let :params do req_params.merge({:pipeline => 'not an array'}) end
|
||||
it_raises 'a Puppet::Error', /is not an Array/
|
||||
end
|
||||
|
||||
describe "when replicator_concurrency is set" do
|
||||
let :params do req_params.merge({:replicator_concurrency => 42}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m) }
|
||||
end
|
||||
|
||||
if t != 'account'
|
||||
describe "when updater_concurrency is set" do
|
||||
let :params do req_params.merge({:updater_concurrency => 73}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m) }
|
||||
end
|
||||
else
|
||||
describe "when reaper_concurrency is set" do
|
||||
let :params do req_params.merge({:reaper_concurrency => 4682}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m) }
|
||||
end
|
||||
end
|
||||
|
||||
if t == 'container'
|
||||
describe "when allow_versioning is set" do
|
||||
let :params do req_params.merge({ :allow_versions => false, }) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "when log_udp_port is set" do
|
||||
context 'and log_udp_host is not set' do
|
||||
let :params do req_params.merge({ :log_udp_port => 514}) end
|
||||
it_raises 'a Puppet::Error', /log_udp_port requires log_udp_host to be set/
|
||||
end
|
||||
context 'and log_udp_host is set' do
|
||||
let :params do req_params.merge(
|
||||
{ :log_udp_host => '127.0.0.1',
|
||||
:log_udp_port => '514'})
|
||||
end
|
||||
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_concat_fragment("swift-#{t}-#{title}").with_content(/^log_udp_port\s*=\s*514\s*$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "when using swift_#{t}_config resource" do
|
||||
let :pre_condition do
|
||||
"
|
||||
class { 'swift': swift_hash_path_suffix => 'foo' }
|
||||
class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }
|
||||
swift_#{t}_config { 'foo/bar': value => 'foo' }
|
||||
"
|
||||
end
|
||||
it { is_expected.to contain_concat("/etc/swift/#{t}-server.conf").that_comes_before("Swift_#{t}_config[foo/bar]") }
|
||||
end
|
||||
|
||||
describe "when log_requests is turned off" do
|
||||
let :params do req_params.merge({:log_requests => false}) end
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_requests\s*=\s*false\s*$/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with all allowed defaults' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_rsync__server__module("#{t}").with(
|
||||
:path => '/srv/node',
|
||||
:lock_file => "/var/lock/#{t}.lock",
|
||||
:uid => 'swift',
|
||||
:gid => 'swift',
|
||||
:incoming_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
||||
:outgoing_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
||||
:max_connections => 25,
|
||||
:read_only => false
|
||||
)}
|
||||
|
||||
# verify template lines
|
||||
it { is_expected.to contain_concat("/etc/swift/#{t}-server.conf") }
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^devices\s*=\s*\/srv\/node\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_concat_fragment("swift-#{t}-#{title}").with_content(/^bind_port\s*=\s*#{title}\s*$/) }
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^mount_check\s*=\s*true\s*$/) }
|
||||
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^user\s*=\s*swift\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_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_facility\s*=\s*LOG_LOCAL2\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_concat_fragment("swift-#{t}-#{title}").with_content(/^set log_address\s*=\s*\/dev\/log\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_concat_fragment("swift-#{t}-#{title}").with_content(/^workers\s*=\s*2\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
|
||||
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::server'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,50 +1,64 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'swift::storage::xfs' do
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
|
||||
describe 'when a device is specified' do
|
||||
let :default_params do
|
||||
{
|
||||
:device => "/dev/#{title}",
|
||||
:byte_size => '1024',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:loopback => false,
|
||||
:device_type => 'path'
|
||||
}
|
||||
end
|
||||
shared_examples 'swift::storage::xfs' do
|
||||
describe 'when a device is specified' do
|
||||
let :default_params do
|
||||
{
|
||||
:device => "/dev/#{title}",
|
||||
:byte_size => '1024',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:loopback => false,
|
||||
:device_type => 'path'
|
||||
}
|
||||
end
|
||||
|
||||
[{},
|
||||
{
|
||||
:device => 'some_device',
|
||||
:byte_size => 1,
|
||||
:mnt_base_dir => '/mnt/foo',
|
||||
:loopback => true
|
||||
}
|
||||
].each do |param_set|
|
||||
[{},
|
||||
{
|
||||
:device => 'some_device',
|
||||
:byte_size => 1,
|
||||
:mnt_base_dir => '/mnt/foo',
|
||||
:loopback => true
|
||||
}
|
||||
].each do |param_set|
|
||||
|
||||
describe "#{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
describe "#{param_set == {} ? "using default" : "specifying"} class parameters" do
|
||||
let :param_hash do
|
||||
default_params.merge(param_set)
|
||||
end
|
||||
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("mkfs-foo").with(
|
||||
:command => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}",
|
||||
:path => ['/sbin/', '/usr/sbin/'],
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_swift__storage__mount(title).with(
|
||||
:device => param_hash[:device],
|
||||
:mnt_base_dir => param_hash[:mnt_base_dir],
|
||||
:loopback => param_hash[:loopback],
|
||||
)}
|
||||
end
|
||||
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec("mkfs-foo").with(
|
||||
:command => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}",
|
||||
:path => ['/sbin/', '/usr/sbin/'],
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_swift__storage__mount(title).with(
|
||||
:device => param_hash[:device],
|
||||
:mnt_base_dir => param_hash[:mnt_base_dir],
|
||||
:loopback => param_hash[:loopback],
|
||||
)}
|
||||
|
||||
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
|
||||
|
||||
it_configures 'swift::storage::xfs'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue