2012-02-26 20:51:17 -08:00
|
|
|
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
|
2015-03-23 18:23:07 +01:00
|
|
|
it { is_expected.to contain_exec("rebalance_#{type}").with(
|
2012-02-26 20:51:17 -08:00
|
|
|
{:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
|
2015-05-20 18:09:58 -07:00
|
|
|
:path => ['/usr/bin'],
|
2012-02-26 20:51:17 -08:00
|
|
|
:refreshonly => true}
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-01-08 16:20:04 -05:00
|
|
|
describe 'with valid seed' do
|
|
|
|
let :params do
|
|
|
|
{ :seed => '999' }
|
|
|
|
end
|
|
|
|
let :title do
|
|
|
|
'object'
|
|
|
|
end
|
2015-03-23 18:23:07 +01:00
|
|
|
it { is_expected.to contain_exec("rebalance_object").with(
|
2015-01-08 16:20:04 -05:00
|
|
|
{:command => "swift-ring-builder /etc/swift/object.builder rebalance 999",
|
2015-05-20 18:09:58 -07:00
|
|
|
:path => ['/usr/bin'],
|
2015-01-08 16:20:04 -05:00
|
|
|
: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
|
2015-03-23 18:23:07 +01:00
|
|
|
expect { catalogue }.to raise_error(Puppet::Error)
|
2015-01-08 16:20:04 -05:00
|
|
|
end
|
|
|
|
end
|
2012-02-26 20:51:17 -08:00
|
|
|
describe 'with an invalid title' do
|
|
|
|
let :title do
|
|
|
|
'invalid'
|
|
|
|
end
|
|
|
|
it 'should raise an error' do
|
2015-03-23 18:23:07 +01:00
|
|
|
expect { catalogue }.to raise_error(Puppet::Error)
|
2012-02-26 20:51:17 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|