
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
51 lines
1.3 KiB
Ruby
51 lines
1.3 KiB
Ruby
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
|
|
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
|
|
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
|