Merge "spec: updates for rspec-puppet 2.x and rspec 3.x"
This commit is contained in:
commit
cc00b5cf5f
Gemfile
spec
classes
swift_bench_spec.rbswift_client_spec.rbswift_dispersion_spec.rbswift_keystone_auth_spec.rbswift_keystone_dispersion_spec.rbswift_proxy_account_quotas_spec.rbswift_proxy_authtoken_spec.rbswift_proxy_bulk_spec.rbswift_proxy_cache_spec.rbswift_proxy_catch_errors_spec.rbswift_proxy_ceilometer_spec.rbswift_proxy_container_quotas_spec.rbswift_proxy_crossdomain_spec.rbswift_proxy_formpost_spec.rbswift_proxy_gatekeeper_spec.rbswift_proxy_healthcheck_spec.rbswift_proxy_keystone_spec.rbswift_proxy_ratelimit_spec.rbswift_proxy_s3token_spec.rbswift_proxy_slo_spec.rbswift_proxy_spec.rbswift_proxy_staticweb_spec.rbswift_proxy_swauth_spec.rbswift_proxy_swift3_spec.rbswift_proxy_tempurl_spec.rbswift_ringbuilder_spec.rbswift_ringserver_spec.rbswift_spec.rbswift_storage_account_spec.rbswift_storage_all_spec.rbswift_storage_container_spec.rbswift_storage_object_spec.rbswift_storage_spec.rbswift_test_file_spec.rbswift_xfs_spec.rb
defines
swift_ringbuilder_create_spec.rbswift_ringbuilder_rebalance_spec.rbswift_storage_disk_spec.rbswift_storage_filter_healthcheck_spec.rbswift_storage_filter_recon_spec.rbswift_storage_generic_spec.rbswift_storage_loopback_spec.rbswift_storage_mount_spec.rbswift_storage_node_spec.rbswift_storage_server_spec.rbswift_storage_xfs_spec.rb
shared_examples.rbunit/puppet/provider
6
Gemfile
6
Gemfile
@ -2,13 +2,11 @@ source 'https://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'rspec-puppet', '~> 2.0.0', :require => false
|
||||
|
||||
gem 'metadata-json-lint'
|
||||
gem 'puppet-lint-param-docs'
|
||||
gem 'puppet-lint', '~> 1.1'
|
||||
gem 'rspec-puppet', '~> 1.0.1'
|
||||
gem 'rake', '10.1.1'
|
||||
gem 'rspec', '< 2.99'
|
||||
|
||||
gem 'json'
|
||||
gem 'webmock'
|
||||
end
|
||||
|
@ -38,41 +38,41 @@ describe 'swift::bench' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
|
||||
it 'depends on swift package' do
|
||||
should contain_package('swift').with_before(/Swift_bench_config\[.+\]/)
|
||||
is_expected.to contain_package('swift').with_before(/Swift_bench_config\[.+\]/)
|
||||
end
|
||||
|
||||
it 'configures swift-bench.conf' do
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth').with_value(p[:auth_url])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/user').with_value(p[:swift_user])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/key').with_value(p[:swift_key])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/auth_version').with_value(p[:auth_version])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/log-level').with_value(p[:log_level])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/timeout').with_value(p[:test_timeout])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/put_concurrency').with_value(p[:put_concurrency])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/get_concurrency').with_value(p[:get_concurrency])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/get_concurrency').with_value(p[:get_concurrency])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/lower_object_size').with_value(p[:lower_object_size])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/upper_object_size').with_value(p[:upper_object_size])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/object_size').with_value(p[:object_size])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_objects').with_value(p[:num_objects])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_gets').with_value(p[:num_gets])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/num_containers').with_value(p[:num_containers])
|
||||
should contain_swift_bench_config(
|
||||
is_expected.to contain_swift_bench_config(
|
||||
'bench/delete').with_value(p[:delete])
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'swift::client' do
|
||||
it { should contain_package('swiftclient').with(
|
||||
it { is_expected.to contain_package('swiftclient').with(
|
||||
:ensure => 'present',
|
||||
:name => 'python-swiftclient'
|
||||
)}
|
||||
@ -12,7 +12,7 @@ describe 'swift::client' do
|
||||
let :params do
|
||||
{:ensure => 'latest'}
|
||||
end
|
||||
it { should contain_package('swiftclient').with(
|
||||
it { is_expected.to contain_package('swiftclient').with(
|
||||
:ensure => 'latest',
|
||||
:name => 'python-swiftclient'
|
||||
)}
|
||||
|
@ -28,7 +28,7 @@ describe 'swift::dispersion' do
|
||||
{}
|
||||
end
|
||||
|
||||
it { should contain_file('/etc/swift/dispersion.conf').with(
|
||||
it { is_expected.to contain_file('/etc/swift/dispersion.conf').with(
|
||||
:ensure => 'present',
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
@ -40,34 +40,34 @@ describe 'swift::dispersion' do
|
||||
let (:p) { default_params.merge!(params) }
|
||||
|
||||
it 'depends on swift package' do
|
||||
should contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/)
|
||||
is_expected.to contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/)
|
||||
end
|
||||
|
||||
it 'configures dispersion.conf' do
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_url').with_value(p[:auth_url])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_version').with_value(p[:auth_version])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_user').with_value("#{p[:auth_tenant]}:#{p[:auth_user]}")
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/auth_key').with_value(p[:auth_pass])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/endpoint_type').with_value(p[:endpoint_type])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/swift_dir').with_value(p[:swift_dir])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/dispersion_coverage').with_value(p[:coverage])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/retries').with_value(p[:retries])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/concurrency').with_value(p[:concurrency])
|
||||
should contain_swift_dispersion_config(
|
||||
is_expected.to contain_swift_dispersion_config(
|
||||
'dispersion/dump_json').with_value(p[:dump_json])
|
||||
end
|
||||
|
||||
it 'triggers swift-dispersion-populate' do
|
||||
should contain_exec('swift-dispersion-populate').with(
|
||||
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]} -U #{p[:auth_tenant]}:#{p[:auth_user]} -K #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '",
|
||||
|
@ -30,7 +30,7 @@ describe 'swift::keystone::auth' do
|
||||
it_configures 'keystone auth configuration'
|
||||
|
||||
['admin', 'SwiftOperator'].each do |role_name|
|
||||
it { should contain_keystone_role(role_name).with_ensure('present') }
|
||||
it { is_expected.to contain_keystone_role(role_name).with_ensure('present') }
|
||||
end
|
||||
end
|
||||
|
||||
@ -58,7 +58,7 @@ describe 'swift::keystone::auth' do
|
||||
it_configures 'keystone auth configuration'
|
||||
|
||||
['admin', 'SwiftOperator', 'Gopher'].each do |role_name|
|
||||
it { should contain_keystone_role(role_name).with_ensure('present') }
|
||||
it { is_expected.to contain_keystone_role(role_name).with_ensure('present') }
|
||||
end
|
||||
end
|
||||
|
||||
@ -67,7 +67,7 @@ describe 'swift::keystone::auth' do
|
||||
params.merge!(:configure_endpoint => false)
|
||||
end
|
||||
|
||||
it { should_not contain_keystone_endpoint('RegionOne/swift') }
|
||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/swift') }
|
||||
end
|
||||
|
||||
context 'when disabling S3 endpoint' do
|
||||
@ -75,8 +75,8 @@ describe 'swift::keystone::auth' do
|
||||
params.merge!(:configure_s3_endpoint => false)
|
||||
end
|
||||
|
||||
it { should_not contain_keystone_service('swift_s3') }
|
||||
it { should_not contain_keystone_endpoint('RegionOne/swift_s3') }
|
||||
it { is_expected.to_not contain_keystone_service('swift_s3') }
|
||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/swift_s3') }
|
||||
end
|
||||
end
|
||||
|
||||
@ -85,37 +85,37 @@ describe 'swift::keystone::auth' do
|
||||
default_params.merge( params )
|
||||
end
|
||||
|
||||
it { should contain_keystone_user(p[:auth_name]).with(
|
||||
it { is_expected.to contain_keystone_user(p[:auth_name]).with(
|
||||
:ensure => 'present',
|
||||
:password => p[:password],
|
||||
:email => p[:email]
|
||||
)}
|
||||
|
||||
it { should contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with(
|
||||
it { is_expected.to contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with(
|
||||
:ensure => 'present',
|
||||
:roles => 'admin',
|
||||
)}
|
||||
|
||||
it { should contain_keystone_service(p[:auth_name]).with(
|
||||
it { is_expected.to contain_keystone_service(p[:auth_name]).with(
|
||||
:ensure => 'present',
|
||||
:type => 'object-store',
|
||||
:description => 'Openstack Object-Store Service'
|
||||
)}
|
||||
|
||||
it { should contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}").with(
|
||||
it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}").with(
|
||||
:ensure => 'present',
|
||||
:public_url => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s",
|
||||
:admin_url => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}/",
|
||||
:internal_url => "#{p[:internal_protocol]}://#{p[:internal_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s"
|
||||
)}
|
||||
|
||||
it { should contain_keystone_service("#{p[:auth_name]}_s3").with(
|
||||
it { is_expected.to contain_keystone_service("#{p[:auth_name]}_s3").with(
|
||||
:ensure => 'present',
|
||||
:type => 's3',
|
||||
:description => 'Openstack S3 Service'
|
||||
)}
|
||||
|
||||
it { should contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}_s3").with(
|
||||
it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}_s3").with(
|
||||
:ensure => 'present',
|
||||
:public_url => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}",
|
||||
:admin_url => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}",
|
||||
|
@ -4,14 +4,14 @@ describe 'swift::keystone::dispersion' do
|
||||
|
||||
describe 'with default class parameters' do
|
||||
|
||||
it { should contain_keystone_user('dispersion').with(
|
||||
it { is_expected.to contain_keystone_user('dispersion').with(
|
||||
:ensure => 'present',
|
||||
:password => 'dispersion_password',
|
||||
:email => 'swift@localhost',
|
||||
:tenant => 'services'
|
||||
) }
|
||||
|
||||
it { should contain_keystone_user_role('dispersion@services').with(
|
||||
it { is_expected.to contain_keystone_user_role('dispersion@services').with(
|
||||
:ensure => 'present',
|
||||
:roles => 'admin',
|
||||
:require => 'Keystone_user[dispersion]'
|
||||
@ -29,14 +29,14 @@ describe 'swift::keystone::dispersion' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_keystone_user('bar').with(
|
||||
it { is_expected.to contain_keystone_user('bar').with(
|
||||
:ensure => 'present',
|
||||
:password => 'foo',
|
||||
:email => 'bar@example.com',
|
||||
:tenant => 'dummyTenant'
|
||||
) }
|
||||
|
||||
it { should contain_keystone_user_role('bar@dummyTenant') }
|
||||
it { is_expected.to contain_keystone_user_role('bar@dummyTenant') }
|
||||
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe 'swift::proxy::account_quotas' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/80_swift_account_quotas"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) }
|
||||
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ describe 'swift::proxy::authtoken' do
|
||||
:group => 'swift',
|
||||
}
|
||||
end
|
||||
it {should contain_file('/var/cache/swift').with(
|
||||
it {is_expected.to contain_file('/var/cache/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
end
|
||||
@ -32,7 +32,7 @@ describe 'swift::proxy::authtoken' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:authtoken]',
|
||||
'log_name = swift',
|
||||
@ -61,7 +61,7 @@ describe 'swift::proxy::authtoken' do
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:authtoken]',
|
||||
'log_name = swift',
|
||||
@ -97,7 +97,7 @@ describe 'swift::proxy::authtoken' do
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:authtoken]',
|
||||
'log_name = swift',
|
||||
@ -124,7 +124,7 @@ describe 'swift::proxy::authtoken' do
|
||||
{ :auth_uri => 'http://public.host/keystone/main' }
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)}
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)}
|
||||
end
|
||||
|
||||
[
|
||||
@ -140,7 +140,7 @@ describe 'swift::proxy::authtoken' do
|
||||
{ :auth_admin_prefix => auth_admin_prefix }
|
||||
end
|
||||
|
||||
it { expect { should contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \
|
||||
it { expect { is_expected.to contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \
|
||||
raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
|
||||
end
|
||||
end
|
||||
@ -153,7 +153,7 @@ describe 'swift::proxy::authtoken' do
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:authtoken]',
|
||||
'log_name = swift',
|
||||
@ -183,7 +183,7 @@ describe 'swift::proxy::authtoken' do
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:authtoken]',
|
||||
'log_name = swift',
|
||||
|
@ -37,7 +37,7 @@ describe 'swift::proxy::bulk' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:bulk]',
|
||||
'use = egg:swift#bulk',
|
||||
@ -60,7 +60,7 @@ describe 'swift::proxy::bulk' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:bulk]',
|
||||
'use = egg:swift#bulk',
|
||||
|
@ -20,12 +20,12 @@ describe 'swift::proxy::cache' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/23_swift_cache"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:cache]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#memcache/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:cache]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#memcache/) }
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) }
|
||||
|
||||
end
|
||||
|
||||
@ -35,7 +35,7 @@ describe 'swift::proxy::cache' do
|
||||
{:memcache_servers => '10.0.0.1:1'}
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) }
|
||||
|
||||
end
|
||||
|
||||
@ -45,7 +45,7 @@ describe 'swift::proxy::cache' do
|
||||
{:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']}
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) }
|
||||
|
||||
end
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe 'swift::proxy::catch_errors' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/24_swift_catch_errors"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:catch_errors]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:catch_errors]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) }
|
||||
|
||||
end
|
||||
|
@ -21,10 +21,10 @@ describe 'swift::proxy::ceilometer' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/33_swift_ceilometer"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) }
|
||||
it { should contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') }
|
||||
it { should contain_user('swift').with_groups('ceilometer') }
|
||||
it { should contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) }
|
||||
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') }
|
||||
it { is_expected.to contain_user('swift').with_groups('ceilometer') }
|
||||
it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
|
||||
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ describe 'swift::proxy::container_quotas' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/81_swift_container_quotas"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) }
|
||||
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ describe 'swift::proxy::crossdomain' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:crossdomain]',
|
||||
'use = egg:swift#crossdomain',
|
||||
@ -35,7 +35,7 @@ describe 'swift::proxy::crossdomain' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:crossdomain]',
|
||||
'use = egg:swift#crossdomain',
|
||||
|
@ -15,7 +15,7 @@ describe 'swift::proxy::formpost' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/31_swift-proxy-formpost"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:formpost]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#formpost/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:formpost]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#formpost/) }
|
||||
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ describe 'swift::proxy::gatekeeper' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:gatekeeper]',
|
||||
'use = egg:swift#gatekeeper',
|
||||
@ -40,7 +40,7 @@ describe 'swift::proxy::gatekeeper' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:gatekeeper]',
|
||||
'use = egg:swift#gatekeeper',
|
||||
|
@ -15,7 +15,7 @@ describe 'swift::proxy::healthcheck' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/25_swift_healthcheck"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:healthcheck]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:healthcheck]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) }
|
||||
|
||||
end
|
||||
|
@ -17,15 +17,15 @@ describe 'swift::proxy::keystone' do
|
||||
'
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:keystone]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:keystone]/) }
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) }
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) }
|
||||
it { should contain_file(fragment_file).with_content(/is_admin = true/) }
|
||||
it { should contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/is_admin = true/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) }
|
||||
|
||||
end
|
||||
|
||||
@ -38,9 +38,9 @@ describe 'swift::proxy::keystone' do
|
||||
:reseller_prefix => 'SWIFT_'
|
||||
}
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/operator_roles = foo/) }
|
||||
it { should contain_file(fragment_file).with_content(/is_admin = false/) }
|
||||
it { should contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = foo/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/is_admin = false/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) }
|
||||
|
||||
end
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe 'swift::proxy::ratelimit' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:ratelimit]',
|
||||
'use = egg:swift#ratelimit',
|
||||
@ -42,7 +42,7 @@ describe 'swift::proxy::ratelimit' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:ratelimit]',
|
||||
'use = egg:swift#ratelimit',
|
||||
|
@ -15,11 +15,11 @@ describe 'swift::proxy::s3token' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/28_swift_s3token"
|
||||
end
|
||||
|
||||
it { should contain_class('keystone::python') }
|
||||
it { is_expected.to contain_class('keystone::python') }
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:s3token]',
|
||||
'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
|
||||
@ -40,7 +40,7 @@ describe 'swift::proxy::s3token' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:s3token]',
|
||||
'paste.filter_factory = keystonemiddleware.s3_token:filter_factory',
|
||||
|
@ -17,7 +17,7 @@ describe 'swift::proxy::slo' do
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:slo]',
|
||||
'use = egg:swift#slo',
|
||||
@ -42,7 +42,7 @@ describe 'swift::proxy::slo' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:slo]',
|
||||
'use = egg:swift#slo',
|
||||
|
@ -4,7 +4,7 @@ describe 'swift::proxy' do
|
||||
|
||||
describe 'without memcached being included' do
|
||||
it 'should raise an error' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
@ -28,9 +28,7 @@ describe 'swift::proxy' do
|
||||
end
|
||||
|
||||
describe 'without the proxy local network ip address being specified' do
|
||||
it "should fail" do
|
||||
expect { subject }.to raise_error(Puppet::Error, /Must pass proxy_local_net_ip/)
|
||||
end
|
||||
it_raises 'a Puppet::Error', /Must pass proxy_local_net_ip/
|
||||
end
|
||||
|
||||
describe 'when proxy_local_net_ip is set' do
|
||||
@ -39,7 +37,7 @@ describe 'swift::proxy' do
|
||||
{:proxy_local_net_ip => '127.0.0.1'}
|
||||
end
|
||||
|
||||
it { should contain_service('swift-proxy').with(
|
||||
it { is_expected.to contain_service('swift-proxy').with(
|
||||
{:ensure => 'running',
|
||||
:provider => 'upstart',
|
||||
:enable => true,
|
||||
@ -47,7 +45,7 @@ describe 'swift::proxy' do
|
||||
:subscribe => 'Concat[/etc/swift/proxy-server.conf]'
|
||||
}
|
||||
)}
|
||||
it { should contain_file('/etc/swift/proxy-server.conf').with(
|
||||
it { is_expected.to contain_file('/etc/swift/proxy-server.conf').with(
|
||||
{:ensure => 'present',
|
||||
:owner => 'swift',
|
||||
:group => 'swift',
|
||||
@ -56,7 +54,7 @@ describe 'swift::proxy' do
|
||||
)}
|
||||
|
||||
it 'should build the header file with all of the default contents' do
|
||||
verify_contents(subject, fragment_path,
|
||||
verify_contents(catalogue, fragment_path,
|
||||
[
|
||||
'[DEFAULT]',
|
||||
'bind_port = 8080',
|
||||
@ -80,7 +78,7 @@ describe 'swift::proxy' do
|
||||
]
|
||||
)
|
||||
end
|
||||
it { should contain_concat__fragment('swift_proxy').with_before(
|
||||
it { is_expected.to contain_concat__fragment('swift_proxy').with_before(
|
||||
[
|
||||
'Class[Swift::Proxy::Healthcheck]',
|
||||
'Class[Swift::Proxy::Cache]',
|
||||
@ -106,7 +104,7 @@ describe 'swift::proxy' do
|
||||
}
|
||||
end
|
||||
it 'should build the header file with provided values' do
|
||||
verify_contents(subject, fragment_path,
|
||||
verify_contents(catalogue, fragment_path,
|
||||
[
|
||||
'[DEFAULT]',
|
||||
'bind_port = 80',
|
||||
@ -127,7 +125,7 @@ describe 'swift::proxy' do
|
||||
]
|
||||
)
|
||||
end
|
||||
it { should contain_concat__fragment('swift_proxy').with_before(
|
||||
it { is_expected.to contain_concat__fragment('swift_proxy').with_before(
|
||||
'Class[Swift::Proxy::Swauth]'
|
||||
)}
|
||||
end
|
||||
@ -136,7 +134,7 @@ describe 'swift::proxy' do
|
||||
[:account_autocreate, :allow_account_management].each do |param|
|
||||
it "should fail when #{param} is not passed a boolean" do
|
||||
params[param] = 'false'
|
||||
expect { subject }.to raise_error(Puppet::Error, /is not a boolean/)
|
||||
expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
|
||||
end
|
||||
end
|
||||
|
||||
@ -148,7 +146,7 @@ describe 'swift::proxy' do
|
||||
end
|
||||
|
||||
it "should fail if write_affinity_node_count is used without write_affinity" do
|
||||
expect { subject }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
|
||||
expect { catalogue }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -161,13 +159,13 @@ describe 'swift::proxy' do
|
||||
|
||||
[{ :enabled => true, :manage_service => true },
|
||||
{ :enabled => false, :manage_service => true }].each do |param_hash|
|
||||
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
before do
|
||||
params.merge!(param_hash)
|
||||
end
|
||||
|
||||
it 'configures swift-proxy service' do
|
||||
should contain_service('swift-proxy').with(
|
||||
is_expected.to contain_service('swift-proxy').with(
|
||||
:ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
:name => platform_params[:service_name],
|
||||
:provider => platform_params[:service_provider],
|
||||
@ -187,7 +185,7 @@ describe 'swift::proxy' do
|
||||
end
|
||||
|
||||
it 'configures swift-proxy service' do
|
||||
should contain_service('swift-proxy').with(
|
||||
is_expected.to contain_service('swift-proxy').with(
|
||||
:ensure => nil,
|
||||
:name => platform_params[:service_name],
|
||||
:provider => platform_params[:service_provider],
|
||||
|
@ -15,7 +15,7 @@ describe 'swift::proxy::staticweb' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/32_swift-proxy-staticweb"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:staticweb]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:staticweb]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) }
|
||||
|
||||
end
|
||||
|
@ -15,15 +15,15 @@ describe 'swift::proxy::swauth' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/20_swift_proxy_swauth"
|
||||
end
|
||||
|
||||
it { should contain_package('python-swauth').with_ensure('present') }
|
||||
it { is_expected.to contain_package('python-swauth').with_ensure('present') }
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:swauth]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:swauth]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) }
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) }
|
||||
it { should contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) }
|
||||
|
||||
end
|
||||
|
||||
@ -35,9 +35,9 @@ describe 'swift::proxy::swauth' do
|
||||
:package_ensure => 'latest' }
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) }
|
||||
it { should contain_file(fragment_file).with_content(/super_admin_key = foo/) }
|
||||
it { should contain_package('python-swauth').with_ensure('latest') }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = foo/) }
|
||||
it { is_expected.to contain_package('python-swauth').with_ensure('latest') }
|
||||
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ describe 'swift::proxy::swift3' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/27_swift_swift3"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:swift3]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:swift3]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) }
|
||||
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ describe 'swift::proxy::tempurl' do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/29_swift-proxy-tempurl"
|
||||
end
|
||||
|
||||
it { should contain_file(fragment_file).with_content(/[filter:tempurl]/) }
|
||||
it { should contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:tempurl]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) }
|
||||
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ describe 'swift::ringbuilder' do
|
||||
end
|
||||
describe 'when swift class is not included' do
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
describe 'when swift class is included' do
|
||||
@ -21,14 +21,14 @@ describe 'swift::ringbuilder' do
|
||||
end
|
||||
|
||||
it 'should rebalance the ring for all ring types' do
|
||||
should contain_swift__ringbuilder__rebalance('object')
|
||||
should contain_swift__ringbuilder__rebalance('account')
|
||||
should contain_swift__ringbuilder__rebalance('container')
|
||||
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 { should contain_swift__ringbuilder__create(type).with(
|
||||
it { is_expected.to contain_swift__ringbuilder__create(type).with(
|
||||
:part_power => '18',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '24'
|
||||
@ -46,7 +46,7 @@ describe 'swift::ringbuilder' do
|
||||
end
|
||||
|
||||
['object', 'account', 'container'].each do |type|
|
||||
it { should contain_swift__ringbuilder__create(type).with(
|
||||
it { is_expected.to contain_swift__ringbuilder__create(type).with(
|
||||
:part_power => '19',
|
||||
:replicas => '3',
|
||||
:min_part_hours => '2'
|
||||
@ -75,22 +75,22 @@ describe 'swift::ringbuilder' do
|
||||
end
|
||||
|
||||
it 'should set up all of the correct dependencies' do
|
||||
should contain_swift__ringbuilder__create('object').with(
|
||||
is_expected.to contain_swift__ringbuilder__create('object').with(
|
||||
{:before => 'Ring_object_device[127.0.0.1:6000/1]'}
|
||||
)
|
||||
should contain_swift__ringbuilder__create('container').with(
|
||||
is_expected.to contain_swift__ringbuilder__create('container').with(
|
||||
{:before => 'Ring_container_device[127.0.0.1:6001/1]'}
|
||||
)
|
||||
should contain_swift__ringbuilder__create('account').with(
|
||||
is_expected.to contain_swift__ringbuilder__create('account').with(
|
||||
{:before => 'Ring_account_device[127.0.0.1:6002/1]'}
|
||||
)
|
||||
should contain_ring_object_device('127.0.0.1:6000/1').with(
|
||||
is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with(
|
||||
{:notify => 'Swift::Ringbuilder::Rebalance[object]'}
|
||||
)
|
||||
should contain_ring_container_device('127.0.0.1:6001/1').with(
|
||||
is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with(
|
||||
{:notify => 'Swift::Ringbuilder::Rebalance[container]'}
|
||||
)
|
||||
should contain_ring_account_device('127.0.0.1:6002/1').with(
|
||||
is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with(
|
||||
{:notify => 'Swift::Ringbuilder::Rebalance[account]'}
|
||||
)
|
||||
end
|
||||
|
@ -25,11 +25,11 @@ describe 'swift::ringserver' do
|
||||
end
|
||||
|
||||
it 'does not create the rsync::server class' do
|
||||
should compile
|
||||
is_expected.to compile
|
||||
end
|
||||
|
||||
it 'contain the swift_server rsync block' do
|
||||
should contain_rsync__server__module('swift_server').with({
|
||||
is_expected.to contain_rsync__server__module('swift_server').with({
|
||||
'path' => '/etc/swift',
|
||||
'lock_file' => '/var/lock/swift_server.lock',
|
||||
'uid' => 'swift',
|
||||
@ -64,7 +64,7 @@ describe 'swift::ringserver' do
|
||||
end
|
||||
|
||||
it 'does create the rsync::server class' do
|
||||
should contain_class('rsync::server').with({
|
||||
is_expected.to contain_class('rsync::server').with({
|
||||
'use_xinetd' => 'true',
|
||||
'address' => '127.0.0.1',
|
||||
'use_chroot' => 'no'
|
||||
@ -72,7 +72,7 @@ describe 'swift::ringserver' do
|
||||
end
|
||||
|
||||
it 'contain the swift_server rsync block' do
|
||||
should contain_rsync__server__module('swift_server').with({
|
||||
is_expected.to contain_rsync__server__module('swift_server').with({
|
||||
'path' => '/etc/swift',
|
||||
'lock_file' => '/var/lock/swift_server.lock',
|
||||
'uid' => 'swift',
|
||||
|
@ -18,7 +18,7 @@ describe 'swift' do
|
||||
{}
|
||||
end
|
||||
it 'should raise an exception' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
@ -31,46 +31,45 @@ describe 'swift' do
|
||||
:require => 'Package[swift]'
|
||||
}
|
||||
end
|
||||
it {should contain_user('swift')}
|
||||
it {should contain_file('/home/swift').with(
|
||||
it {is_expected.to contain_user('swift')}
|
||||
it {is_expected.to contain_file('/home/swift').with(
|
||||
{:ensure => 'directory', :mode => '0700'
|
||||
}.merge(file_defaults)
|
||||
)}
|
||||
it {should contain_file('/etc/swift').with(
|
||||
it {is_expected.to contain_file('/etc/swift').with(
|
||||
{:ensure => 'directory', :mode => '2770'
|
||||
}.merge(file_defaults)
|
||||
)}
|
||||
it {should contain_file('/var/run/swift').with(
|
||||
it {is_expected.to contain_file('/var/run/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {should contain_file('/var/lib/swift').with(
|
||||
it {is_expected.to contain_file('/var/lib/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {should contain_file('/etc/swift/swift.conf').with(
|
||||
it {is_expected.to contain_file('/etc/swift/swift.conf').with(
|
||||
{:ensure => 'present',
|
||||
:mode => '0660',
|
||||
}.merge(file_defaults)
|
||||
)}
|
||||
it 'configures swift.conf' do
|
||||
should contain_swift_config(
|
||||
is_expected.to contain_swift_config(
|
||||
'swift-hash/swift_hash_path_suffix').with_value('string')
|
||||
end
|
||||
it {should contain_package('swift').with_ensure('present')}
|
||||
it { is_expected.to contain_package('swift').with_ensure('present') }
|
||||
end
|
||||
|
||||
describe 'when overriding package_ensure parameter' do
|
||||
it 'should effect ensure state of swift package' do
|
||||
params[:package_ensure] = '1.12.0-1'
|
||||
subject.should contain_package('swift').with_ensure(params[:package_ensure])
|
||||
is_expected.to contain_package('swift').with_ensure(params[:package_ensure])
|
||||
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'
|
||||
subject.should contain_package('swiftclient').with_ensure(params[:client_package_ensure])
|
||||
is_expected.to contain_package('swiftclient').with_ensure(params[:client_package_ensure])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -23,20 +23,20 @@ describe 'swift::storage::account' do
|
||||
params.merge!(param_set)
|
||||
end
|
||||
|
||||
it { should contain_swift__storage__generic('account').with_package_ensure(params[:package_ensure]) }
|
||||
it { is_expected.to contain_swift__storage__generic('account').with_package_ensure(params[:package_ensure]) }
|
||||
end
|
||||
end
|
||||
|
||||
[{ :enabled => true, :manage_service => true },
|
||||
{ :enabled => false, :manage_service => true }].each do |param_hash|
|
||||
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
before do
|
||||
params.merge!(param_hash)
|
||||
end
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
should contain_service(service_alias).with(
|
||||
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]
|
||||
@ -55,7 +55,7 @@ describe 'swift::storage::account' do
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
should contain_service(service_alias).with(
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false
|
||||
|
@ -27,9 +27,7 @@ describe 'swift::storage::all' do
|
||||
end
|
||||
|
||||
describe 'when an internal network ip is not specified' do
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/)
|
||||
end
|
||||
it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
|
||||
end
|
||||
|
||||
[{ :storage_local_net_ip => '127.0.0.1' },
|
||||
@ -57,21 +55,21 @@ describe 'swift::storage::all' do
|
||||
end
|
||||
|
||||
['object', 'container', 'account'].each do |type|
|
||||
it { should contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { should contain_service("swift-#{type}").with(
|
||||
it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{type}").with(
|
||||
{:provider => 'upstart',
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
})}
|
||||
it { should contain_service("swift-#{type}-replicator").with(
|
||||
it { is_expected.to contain_service("swift-#{type}-replicator").with(
|
||||
{:provider => 'upstart',
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
}
|
||||
)}
|
||||
it { should contain_file("/etc/swift/#{type}-server/").with(
|
||||
it { is_expected.to contain_file("/etc/swift/#{type}-server/").with(
|
||||
{:ensure => 'directory',
|
||||
:owner => 'swift',
|
||||
:group => 'swift'}
|
||||
@ -85,24 +83,24 @@ describe 'swift::storage::all' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_swift__storage__server(param_hash[:account_port]).with(
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with(
|
||||
{:type => 'account',
|
||||
:config_file_path => 'account-server.conf',
|
||||
:pipeline => param_hash[:account_pipeline] || 'account-server' }.merge(storage_server_defaults)
|
||||
)}
|
||||
it { should contain_swift__storage__server(param_hash[:object_port]).with(
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with(
|
||||
{:type => 'object',
|
||||
:config_file_path => 'object-server.conf',
|
||||
:pipeline => param_hash[:object_pipeline] || 'object-server' }.merge(storage_server_defaults)
|
||||
)}
|
||||
it { should contain_swift__storage__server(param_hash[:container_port]).with(
|
||||
it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
|
||||
{:type => 'container',
|
||||
:config_file_path => 'container-server.conf',
|
||||
:pipeline => param_hash[:container_pipeline] || 'container-server',
|
||||
:allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults)
|
||||
)}
|
||||
|
||||
it { should contain_class('rsync::server').with(
|
||||
it { is_expected.to contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => param_hash[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
@ -138,14 +136,14 @@ describe 'swift::storage::all' do
|
||||
param_set
|
||||
end
|
||||
['object', 'container', 'account'].each do |type|
|
||||
it { should contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { should contain_service("swift-#{type}").with(
|
||||
it { is_expected.to contain_package("swift-#{type}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{type}").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
})}
|
||||
it { should contain_service("swift-#{type}-replicator").with(
|
||||
it { is_expected.to contain_service("swift-#{type}-replicator").with(
|
||||
{:provider => nil,
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
|
@ -22,21 +22,21 @@ describe 'swift::storage::container' do
|
||||
params.merge!(param_set)
|
||||
end
|
||||
|
||||
it { should contain_swift__storage__generic('container').with_package_ensure(params[:package_ensure]) }
|
||||
it { is_expected.to contain_swift__storage__generic('container').with_package_ensure(params[:package_ensure]) }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
[{ :enabled => true, :manage_service => true },
|
||||
{ :enabled => false, :manage_service => true }].each do |param_hash|
|
||||
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||
before do
|
||||
params.merge!(param_hash)
|
||||
end
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
should contain_service(service_alias).with(
|
||||
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]
|
||||
@ -55,7 +55,7 @@ describe 'swift::storage::container' do
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
should contain_service(service_alias).with(
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false
|
||||
@ -86,17 +86,17 @@ describe 'swift::storage::container' do
|
||||
|
||||
context 'Ubuntu specific resources' do
|
||||
it 'configures sync' do
|
||||
should contain_service('swift-container-sync').with(
|
||||
is_expected.to contain_service('swift-container-sync').with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:provider => 'upstart',
|
||||
:require => ['File[/etc/init/swift-container-sync.conf]', 'File[/etc/init.d/swift-container-sync]']
|
||||
)
|
||||
should contain_file('/etc/init/swift-container-sync.conf').with(
|
||||
is_expected.to contain_file('/etc/init/swift-container-sync.conf').with(
|
||||
:source => 'puppet:///modules/swift/swift-container-sync.conf.upstart',
|
||||
:require => 'Package[swift-container]'
|
||||
)
|
||||
should contain_file('/etc/init.d/swift-container-sync').with(
|
||||
is_expected.to contain_file('/etc/init.d/swift-container-sync').with(
|
||||
:ensure => 'link',
|
||||
:target => '/lib/init/upstart-job'
|
||||
)
|
||||
@ -138,7 +138,7 @@ describe 'swift::storage::container' do
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/)
|
||||
is_expected.to contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ describe 'swift::storage::object' do
|
||||
params.merge!(param_set)
|
||||
end
|
||||
|
||||
it { should contain_swift__storage__generic('object').with_package_ensure(params[:package_ensure]) }
|
||||
it { is_expected.to contain_swift__storage__generic('object').with_package_ensure(params[:package_ensure]) }
|
||||
end
|
||||
end
|
||||
|
||||
@ -37,7 +37,7 @@ describe 'swift::storage::object' do
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
should contain_service(service_alias).with(
|
||||
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]
|
||||
@ -56,7 +56,7 @@ describe 'swift::storage::object' do
|
||||
|
||||
it 'configures services' do
|
||||
platform_params[:service_names].each do |service_alias, service_name|
|
||||
should contain_service(service_alias).with(
|
||||
is_expected.to contain_service(service_alias).with(
|
||||
:ensure => nil,
|
||||
:name => service_name,
|
||||
:enable => false
|
||||
|
@ -24,7 +24,7 @@ describe 'swift::storage' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_class('rsync::server').with(
|
||||
it { is_expected.to contain_class('rsync::server').with(
|
||||
{:use_xinetd => true,
|
||||
:address => params[:storage_local_net_ip],
|
||||
:use_chroot => 'no'
|
||||
@ -32,14 +32,12 @@ describe 'swift::storage' do
|
||||
)}
|
||||
end
|
||||
describe 'when local net ip is not specified' do
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/)
|
||||
end
|
||||
it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/
|
||||
end
|
||||
end
|
||||
describe 'when the dependencies are not specified' do
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ describe 'swift::test_file' do
|
||||
end
|
||||
|
||||
it 'should create a reasonable test file' do
|
||||
verify_contents(subject, '/tmp/swift_test_file.rb',
|
||||
verify_contents(catalogue, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.1"',
|
||||
"user='openstack:admin'",
|
||||
@ -36,7 +36,7 @@ describe 'swift::test_file' do
|
||||
end
|
||||
|
||||
it 'should create a configured test file' do
|
||||
verify_contents(subject, '/tmp/swift_test_file.rb',
|
||||
verify_contents(catalogue, '/tmp/swift_test_file.rb',
|
||||
[
|
||||
'proxy_local_net_ip="127.0.0.2"',
|
||||
"user='tenant:user'",
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
describe 'swift::xfs' do
|
||||
['xfsprogs', 'parted'].each do |present_package|
|
||||
it { should contain_package(present_package).with_ensure('present') }
|
||||
it { is_expected.to contain_package(present_package).with_ensure('present') }
|
||||
end
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ describe 'swift::ringbuilder::create' do
|
||||
param_set
|
||||
end
|
||||
|
||||
it { should contain_exec("create_#{type}").with(
|
||||
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',
|
||||
:creates => "/etc/swift/#{type}.builder" }
|
||||
@ -44,7 +44,7 @@ describe 'swift::ringbuilder::create' do
|
||||
'invalid'
|
||||
end
|
||||
it 'should raise an error' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -6,7 +6,7 @@ describe 'swift::ringbuilder::rebalance' do
|
||||
let :title do
|
||||
type
|
||||
end
|
||||
it { should contain_exec("rebalance_#{type}").with(
|
||||
it { is_expected.to contain_exec("rebalance_#{type}").with(
|
||||
{:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
|
||||
:path => '/usr/bin',
|
||||
:refreshonly => true}
|
||||
@ -21,7 +21,7 @@ describe 'swift::ringbuilder::rebalance' do
|
||||
let :title do
|
||||
'object'
|
||||
end
|
||||
it { should contain_exec("rebalance_object").with(
|
||||
it { is_expected.to contain_exec("rebalance_object").with(
|
||||
{:command => "swift-ring-builder /etc/swift/object.builder rebalance 999",
|
||||
:path => '/usr/bin',
|
||||
:refreshonly => true}
|
||||
@ -35,7 +35,7 @@ describe 'swift::ringbuilder::rebalance' do
|
||||
{ :seed => 'invalid' }
|
||||
end
|
||||
it 'should raise an error' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
describe 'with an invalid title' do
|
||||
@ -43,7 +43,7 @@ describe 'swift::ringbuilder::rebalance' do
|
||||
'invalid'
|
||||
end
|
||||
it 'should raise an error' do
|
||||
expect { subject }.to raise_error(Puppet::Error)
|
||||
expect { catalogue }.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe 'swift::storage::disk' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_swift__storage__xfs('sdb').with(
|
||||
it { is_expected.to contain_swift__storage__xfs('sdb').with(
|
||||
:device => '/dev/sdb',
|
||||
:mnt_base_dir => '/srv/node',
|
||||
:byte_size => '1024',
|
||||
|
@ -19,7 +19,7 @@ describe 'swift::storage::filter::healthcheck' do
|
||||
end
|
||||
|
||||
it 'should build the fragment with correct content' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:healthcheck]',
|
||||
'use = egg:swift#healthcheck'
|
||||
|
@ -20,7 +20,7 @@ describe 'swift::storage::filter::recon' do
|
||||
|
||||
describe 'when passing default parameters' do
|
||||
it 'should build the fragment with correct content' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:recon]',
|
||||
'use = egg:swift#recon',
|
||||
@ -37,7 +37,7 @@ describe 'swift::storage::filter::recon' do
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct content' do
|
||||
verify_contents(subject, fragment_file,
|
||||
verify_contents(catalogue, fragment_file,
|
||||
[
|
||||
'[filter:recon]',
|
||||
'use = egg:swift#recon',
|
||||
|
@ -28,9 +28,7 @@ describe 'swift::storage::generic' do
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /does not match/)
|
||||
end
|
||||
it_raises 'a Puppet::Error', /does not match/
|
||||
end
|
||||
|
||||
['account', 'object', 'container'].each do |t|
|
||||
@ -48,20 +46,20 @@ describe 'swift::storage::generic' do
|
||||
let :params do
|
||||
param_set
|
||||
end
|
||||
it { should contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) }
|
||||
it { should contain_service("swift-#{t}").with(
|
||||
it { is_expected.to contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) }
|
||||
it { is_expected.to contain_service("swift-#{t}").with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:provider => param_hash[:service_provider]
|
||||
)}
|
||||
it { should contain_service("swift-#{t}-replicator").with(
|
||||
it { is_expected.to contain_service("swift-#{t}-replicator").with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:provider => param_hash[:service_provider]
|
||||
)}
|
||||
it { should contain_file("/etc/swift/#{t}-server/").with(
|
||||
it { is_expected.to contain_file("/etc/swift/#{t}-server/").with(
|
||||
:ensure => 'directory',
|
||||
:owner => 'swift',
|
||||
:group => 'swift'
|
||||
|
@ -7,7 +7,7 @@ describe 'swift::storage::loopback' do
|
||||
'dans_disk'
|
||||
end
|
||||
|
||||
it { should contain_swift__storage__xfs('dans_disk').with(
|
||||
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',
|
||||
|
@ -13,7 +13,7 @@ describe 'swift::storage::mount' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_mount('/srv/node/dans_mount_point').with(
|
||||
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
|
||||
:ensure => 'present',
|
||||
:device => '/dev/sda',
|
||||
:fstype => 'xfs',
|
||||
@ -32,7 +32,7 @@ describe 'swift::storage::mount' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_mount('/srv/node/dans_mount_point').with(
|
||||
it { is_expected.to contain_mount('/srv/node/dans_mount_point').with(
|
||||
:device => '/dev/sda',
|
||||
:options => 'noatime,nodiratime,nobarrier,loop,logbufs=8'
|
||||
)}
|
||||
@ -52,7 +52,7 @@ describe 'swift::storage::mount' do
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_exec("restorecon_mount_dans_mount_point").with(
|
||||
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}
|
||||
|
@ -26,9 +26,9 @@ describe 'swift::storage::node' do
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_ring_object_device("127.0.0.1:6010/1")
|
||||
should contain_ring_container_device("127.0.0.1:6011/1")
|
||||
should contain_ring_account_device("127.0.0.1:6012/1")
|
||||
is_expected.to contain_ring_object_device("127.0.0.1:6010/1")
|
||||
is_expected.to contain_ring_container_device("127.0.0.1:6011/1")
|
||||
is_expected.to contain_ring_account_device("127.0.0.1:6012/1")
|
||||
}
|
||||
|
||||
context 'when zone is not a number' do
|
||||
@ -38,10 +38,6 @@ describe 'swift::storage::node' do
|
||||
:mnt_base_dir => '/srv/node' }
|
||||
end
|
||||
|
||||
it 'should raise an error' do
|
||||
expect {
|
||||
subject
|
||||
}.to raise_error(Puppet::Error, /The zone parameter must be an integer/)
|
||||
end
|
||||
it_raises 'a Puppet::Error', /The zone parameter must be an integer/
|
||||
end
|
||||
end
|
||||
|
@ -34,9 +34,7 @@ describe 'swift::storage::server' do
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /does not match/)
|
||||
end
|
||||
it_raises 'a Puppet::Error', /does not match/
|
||||
end
|
||||
|
||||
['account', 'object', 'container'].each do |t|
|
||||
@ -54,8 +52,8 @@ describe 'swift::storage::server' do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { should contain_package("swift-#{t}").with_ensure('present') }
|
||||
it { should contain_service("swift-#{t}").with(
|
||||
it { is_expected.to contain_package("swift-#{t}").with_ensure('present') }
|
||||
it { is_expected.to contain_service("swift-#{t}").with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:hasstatus => true
|
||||
@ -74,7 +72,7 @@ describe 'swift::storage::server' do
|
||||
}.each do |k,v|
|
||||
describe "when #{k} is set" do
|
||||
let :params do req_params.merge({k => v}) end
|
||||
it { should contain_file(fragment_file) \
|
||||
it { is_expected.to contain_file(fragment_file) \
|
||||
.with_content(
|
||||
/^#{k.to_s}\s*=\s*#{v.is_a?(Array) ? v.join(' ') : v}\s*$/
|
||||
)
|
||||
@ -83,35 +81,33 @@ describe 'swift::storage::server' do
|
||||
end
|
||||
describe "when pipeline is passed an array" do
|
||||
let :params do req_params.merge({:pipeline => ['healthcheck','recon','test']}) end
|
||||
it { should contain_concat__fragment("swift-#{t}-#{title}").with(
|
||||
it { is_expected.to contain_concat__fragment("swift-#{t}-#{title}").with(
|
||||
:content => /^pipeline\s*=\s*healthcheck recon test\s*$/,
|
||||
:before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]", "Swift::Storage::Filter::Test[#{t}]"]
|
||||
)}
|
||||
end
|
||||
describe "when pipeline is not passed an array" do
|
||||
let :params do req_params.merge({:pipeline => 'not an array'}) end
|
||||
it "should fail" do
|
||||
expect { subject }.to raise_error(Puppet::Error, /is 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 { should contain_file(fragment_file) \
|
||||
it { is_expected.to contain_file(fragment_file) \
|
||||
.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 { should contain_file(fragment_file) \
|
||||
it { is_expected.to contain_file(fragment_file) \
|
||||
.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 { should contain_file(fragment_file) \
|
||||
it { is_expected.to contain_file(fragment_file) \
|
||||
.with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m)
|
||||
}
|
||||
end
|
||||
@ -119,7 +115,7 @@ describe 'swift::storage::server' do
|
||||
if t == 'container'
|
||||
describe "when allow_versioning is set" do
|
||||
let :params do req_params.merge({ :allow_versions => false, }) end
|
||||
it { should contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)}
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)}
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -129,7 +125,7 @@ describe 'swift::storage::server' do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { should contain_rsync__server__module("#{t}").with(
|
||||
it { is_expected.to contain_rsync__server__module("#{t}").with(
|
||||
:path => '/srv/node',
|
||||
:lock_file => "/var/lock/#{t}.lock",
|
||||
:uid => 'swift',
|
||||
@ -141,42 +137,18 @@ describe 'swift::storage::server' do
|
||||
)}
|
||||
|
||||
# verify template lines
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^devices\s*=\s*\/srv\/node\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^bind_port\s*=\s*#{title}\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^mount_check\s*=\s*false\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^user\s*=\s*swift\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^set log_name\s*=\s*#{t}-server\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^set log_level\s*=\s*INFO\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^set log_address\s*=\s*\/dev\/log\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^workers\s*=\s*1\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^concurrency\s*=\s*1\s*$/)
|
||||
}
|
||||
it { should contain_file(fragment_file) \
|
||||
.with_content(/^pipeline\s*=\s*#{t}-server\s*$/)
|
||||
}
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^devices\s*=\s*\/srv\/node\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^bind_port\s*=\s*#{title}\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^mount_check\s*=\s*false\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^user\s*=\s*swift\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^set log_name\s*=\s*#{t}-server\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^set log_level\s*=\s*INFO\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^workers\s*=\s*1\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^concurrency\s*=\s*1\s*$/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/^pipeline\s*=\s*#{t}-server\s*$/) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -32,13 +32,13 @@ describe 'swift::storage::xfs' do
|
||||
param_set
|
||||
end
|
||||
|
||||
it { should contain_exec("mkfs-foo").with(
|
||||
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/'],
|
||||
:require => 'Package[xfsprogs]'
|
||||
)}
|
||||
|
||||
it { should contain_swift__storage__mount(title).with(
|
||||
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],
|
||||
|
@ -1,5 +1,5 @@
|
||||
shared_examples_for "a Puppet::Error" do |description|
|
||||
it "with message matching #{description.inspect}" do
|
||||
expect { should have_class_count(1) }.to raise_error(Puppet::Error, description)
|
||||
expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
|
||||
end
|
||||
end
|
||||
|
@ -27,26 +27,26 @@ Devices: id region zone ip address port replication ip replicat
|
||||
'
|
||||
)
|
||||
resources = provider_class.lookup_ring
|
||||
resources['192.168.101.13:6002/1'].should_not be_nil
|
||||
resources['192.168.101.14:6002/1'].should_not be_nil
|
||||
resources['192.168.101.15:6002/1'].should_not be_nil
|
||||
resources['192.168.101.16:6002/1'].should_not be_nil
|
||||
expect(resources['192.168.101.13:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.14:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.15:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.16:6002/1']).to_not be_nil
|
||||
|
||||
resources['192.168.101.13:6002/1'][:id].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:region].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:zone].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
|
||||
resources['192.168.101.13:6002/1'][:meta].should eql ''
|
||||
expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:region]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
|
||||
|
||||
resources['192.168.101.14:6002/1'][:id].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:region].should eql '1'
|
||||
resources['192.168.101.14:6002/1'][:zone].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.14:6002/1'][:balance].should eql '200.00'
|
||||
resources['192.168.101.14:6002/1'][:meta].should eql 'm2'
|
||||
expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:region]).to eql '1'
|
||||
expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.14:6002/1'][:balance]).to eql '200.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:meta]).to eql 'm2'
|
||||
end
|
||||
|
||||
it 'should be able to lookup the local ring and build an object 1.8.0' do
|
||||
@ -65,26 +65,26 @@ Devices: id region zone ip address port name weight partitions b
|
||||
'
|
||||
)
|
||||
resources = provider_class.lookup_ring
|
||||
resources['192.168.101.13:6002/1'].should_not be_nil
|
||||
resources['192.168.101.14:6002/1'].should_not be_nil
|
||||
resources['192.168.101.15:6002/1'].should_not be_nil
|
||||
resources['192.168.101.16:6002/1'].should_not be_nil
|
||||
expect(resources['192.168.101.13:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.14:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.15:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.16:6002/1']).to_not be_nil
|
||||
|
||||
resources['192.168.101.13:6002/1'][:id].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:region].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:zone].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
|
||||
resources['192.168.101.13:6002/1'][:meta].should eql ''
|
||||
expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:region]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
|
||||
|
||||
resources['192.168.101.14:6002/1'][:id].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:region].should eql '1'
|
||||
resources['192.168.101.14:6002/1'][:zone].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.14:6002/1'][:balance].should eql '200.00'
|
||||
resources['192.168.101.14:6002/1'][:meta].should eql 'm2'
|
||||
expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:region]).to eql '1'
|
||||
expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.14:6002/1'][:balance]).to eql '200.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:meta]).to eql 'm2'
|
||||
end
|
||||
|
||||
it 'should be able to lookup the local ring and build an object 1.7' do
|
||||
@ -102,25 +102,25 @@ Devices: id region zone ip address port name weight partitions b
|
||||
'
|
||||
)
|
||||
resources = provider_class.lookup_ring
|
||||
resources['192.168.101.13:6002/1'].should_not be_nil
|
||||
resources['192.168.101.14:6002/1'].should_not be_nil
|
||||
resources['192.168.101.15:6002/1'].should_not be_nil
|
||||
expect(resources['192.168.101.13:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.14:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.15:6002/1']).to_not be_nil
|
||||
|
||||
resources['192.168.101.13:6002/1'][:id].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:region].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:zone].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
|
||||
resources['192.168.101.13:6002/1'][:meta].should eql ''
|
||||
expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:region]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
|
||||
|
||||
resources['192.168.101.14:6002/1'][:id].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:region].should eql '1'
|
||||
resources['192.168.101.14:6002/1'][:zone].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.14:6002/1'][:balance].should eql '0.00'
|
||||
resources['192.168.101.14:6002/1'][:meta].should eql ''
|
||||
expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:region]).to eql '1'
|
||||
expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.14:6002/1'][:balance]).to eql '0.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:meta]).to eql ''
|
||||
end
|
||||
|
||||
it 'should be able to lookup the local ring and build an object legacy' do
|
||||
@ -137,24 +137,24 @@ Devices: id zone ip address port name weight partitions balance m
|
||||
'
|
||||
)
|
||||
resources = provider_class.lookup_ring
|
||||
resources['192.168.101.15:6002/1'].should_not be_nil
|
||||
resources['192.168.101.13:6002/1'].should_not be_nil
|
||||
resources['192.168.101.14:6002/1'].should_not be_nil
|
||||
expect(resources['192.168.101.15:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.13:6002/1']).to_not be_nil
|
||||
expect(resources['192.168.101.14:6002/1']).to_not be_nil
|
||||
|
||||
resources['192.168.101.13:6002/1'][:id].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:region].should eql 'none'
|
||||
resources['192.168.101.13:6002/1'][:zone].should eql '1'
|
||||
resources['192.168.101.13:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.13:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.13:6002/1'][:balance].should eql '0.00'
|
||||
resources['192.168.101.13:6002/1'][:meta].should eql ''
|
||||
expect(resources['192.168.101.13:6002/1'][:id]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:region]).to eql 'none'
|
||||
expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1'
|
||||
expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00'
|
||||
expect(resources['192.168.101.13:6002/1'][:meta]).to eql ''
|
||||
|
||||
resources['192.168.101.14:6002/1'][:id].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:region].should eql 'none'
|
||||
resources['192.168.101.14:6002/1'][:zone].should eql '2'
|
||||
resources['192.168.101.14:6002/1'][:weight].should eql '1.00'
|
||||
resources['192.168.101.14:6002/1'][:partitions].should eql '262144'
|
||||
resources['192.168.101.14:6002/1'][:balance].should eql '0.00'
|
||||
resources['192.168.101.14:6002/1'][:meta].should eql ''
|
||||
expect(resources['192.168.101.14:6002/1'][:id]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:region]).to eql 'none'
|
||||
expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2'
|
||||
expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144'
|
||||
expect(resources['192.168.101.14:6002/1'][:balance]).to eql '0.00'
|
||||
expect(resources['192.168.101.14:6002/1'][:meta]).to eql ''
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user