
This change adds the ability to configure the swift_hash_path_prefix for swift. Additionally it deprecated swift_hash_suffix in favor of a new parameter called swift_hash_path_suffix for consistency. Change-Id: I26935fe21af42b488f4479c4e50e8f481a75ea40 Closes-Bug: #1505269
90 lines
2.7 KiB
Ruby
90 lines
2.7 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'swift' do
|
|
|
|
let :params do
|
|
{
|
|
:swift_hash_suffix => 'string',
|
|
:max_header_size => '16384',
|
|
}
|
|
end
|
|
|
|
let :facts do
|
|
{
|
|
:operatingsystem => 'Ubuntu',
|
|
:osfamily => 'Debian'
|
|
}
|
|
end
|
|
|
|
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',
|
|
:require => 'Package[swift]'
|
|
}
|
|
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') }
|
|
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
|