2012-02-26 20:51:17 -08:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'swift' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
{:swift_hash_suffix => 'string'}
|
|
|
|
end
|
|
|
|
|
2012-03-13 16:30:19 -07:00
|
|
|
let :facts do
|
2012-03-20 09:30:58 -07:00
|
|
|
{
|
|
|
|
:operatingsystem => 'Ubuntu',
|
|
|
|
:osfamily => 'Debian'
|
|
|
|
}
|
2012-03-13 16:30:19 -07:00
|
|
|
end
|
|
|
|
|
2012-02-26 20:51:17 -08:00
|
|
|
describe 'when no swift hash is specified' do
|
|
|
|
let :params do
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
it 'should raise an exception' do
|
2012-07-12 15:24:03 -07:00
|
|
|
expect { subject }.to raise_error(Puppet::Error)
|
2012-02-26 20:51:17 -08:00
|
|
|
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 {should contain_file('/home/swift').with(
|
|
|
|
{:ensure => 'directory', :mode => '0700'
|
|
|
|
}.merge(file_defaults)
|
|
|
|
)}
|
|
|
|
it {should contain_file('/etc/swift').with(
|
|
|
|
{:ensure => 'directory', :mode => '2770'
|
|
|
|
}.merge(file_defaults)
|
|
|
|
)}
|
|
|
|
it {should contain_file('/var/run/swift').with(
|
|
|
|
{:ensure => 'directory'}.merge(file_defaults)
|
|
|
|
)}
|
|
|
|
it {should contain_file('/etc/swift/swift.conf').with(
|
|
|
|
{:ensure => 'present',
|
|
|
|
:mode => '0660',
|
|
|
|
}.merge(file_defaults)
|
|
|
|
)}
|
2013-08-26 08:34:45 -04:00
|
|
|
it 'configures swift.conf' do
|
|
|
|
should contain_swift_config(
|
|
|
|
'swift-hash/swift_hash_path_suffix').with_value('string')
|
|
|
|
end
|
2012-02-26 20:51:17 -08:00
|
|
|
it {should contain_package('swift').with_ensure('present')}
|
2012-11-19 18:47:03 +04:00
|
|
|
it {should contain_user('swift')}
|
|
|
|
it {should contain_file('/var/lib/swift').with_ensure('directory')}
|
2012-02-26 20:51:17 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when overriding package_ensure parameter' do
|
|
|
|
it 'should effect ensure state of swift package' do
|
|
|
|
params[:package_ensure] = 'latest'
|
|
|
|
subject.should contain_package('swift').with_ensure('latest')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|