Files
puppet-swift/spec/defines/swift_ringbuilder_rebalance_spec.rb
Dan Prince b8b443416d Add seed parameter to ringbuilder::rebalance.
This patch adds an optional seed parameter to the
swift::ringbuilder::rebalance definition. The seed
parameter can be useful if you want to (manually)
generate rings on independant servers and ensure that
the partition assignments are the same.

Change-Id: I840b8fe0125ed25e84f7681fada1b1102e48f32b
2015-01-08 17:36:24 -05:00

51 lines
1.2 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 { should 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 { should 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 { subject }.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 { subject }.to raise_error(Puppet::Error)
end
end
end