4a6e4cbb33
Remove value testing (we only check the key here), the value is nil or undef and fix resource array, according[1]. [1]https://github.com/puppetlabs/puppet/blob/3.7.5/lib/puppet/resource.rb#L446-L453 Change-Id: Ic7a9b9d1e6d6b6b1c40fbce40d0bf9ff913f191e Closes-bug: #1447620
52 lines
1.3 KiB
Ruby
52 lines
1.3 KiB
Ruby
require 'spec_helper'
|
|
describe 'swift::ringbuilder::create' do
|
|
|
|
let :default_params do
|
|
{:part_power => 18,
|
|
:replicas => 3,
|
|
:min_part_hours => 24}
|
|
end
|
|
|
|
describe 'with allowed titles' do
|
|
['object', 'container', 'account'].each do |type|
|
|
describe "when title is #{type}" do
|
|
let :title do
|
|
type
|
|
end
|
|
|
|
[{},
|
|
{:part_power => 19,
|
|
:replicas => 6,
|
|
:min_part_hours => 2}].each do |param_set|
|
|
|
|
describe "when #{param_set == {} ? "using default" : "specifying"} class parame
|
|
ters" do
|
|
let :param_hash do
|
|
default_params.merge(param_set)
|
|
end
|
|
|
|
let :params do
|
|
param_set
|
|
end
|
|
|
|
it { is_expected.to contain_exec("create_#{type}").with(
|
|
{:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
|
|
:path => ['/usr/bin'],
|
|
:creates => "/etc/swift/#{type}.builder" }
|
|
)}
|
|
end
|
|
end
|
|
end
|
|
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
|