
This patch aim to update our specs test in order to work with the rspec-puppet release 2.0.0, in the mean time, we update rspec syntax in order to be prepared for rspec 3.x move. In details: * Use shared_examples "a Puppet::Error" for puppet::error tests * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x) * Fix spec tests for rspec-puppet 2.0.0 * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0 * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper) * Remove un-used puppet-lint (name_containing_dash config) Change-Id: I5488507176d4665895eef65ddb4b6f0fb4eda3e7 Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
76 lines
2.1 KiB
Ruby
76 lines
2.1 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'swift' do
|
|
|
|
let :params do
|
|
{:swift_hash_suffix => 'string'}
|
|
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('/home/swift').with(
|
|
{:ensure => 'directory', :mode => '0700'
|
|
}.merge(file_defaults)
|
|
)}
|
|
it {is_expected.to contain_file('/etc/swift').with(
|
|
{:ensure => 'directory', :mode => '2770'
|
|
}.merge(file_defaults)
|
|
)}
|
|
it {is_expected.to contain_file('/var/run/swift').with(
|
|
{:ensure => 'directory'}.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 => 'present',
|
|
:mode => '0660',
|
|
}.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 { 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'
|
|
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'
|
|
is_expected.to contain_package('swiftclient').with_ensure(params[:client_package_ensure])
|
|
end
|
|
end
|
|
|
|
end
|