Fix spec tests for RSpec 3.x and Puppet 4.x

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
This commit is contained in:
Sebastien Badia 2015-05-20 18:09:58 -07:00
parent 5e814f1b5f
commit 4a6e4cbb33
7 changed files with 23 additions and 17 deletions

View File

@ -93,7 +93,7 @@ describe 'swift::keystone::auth' do
it { is_expected.to contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with( it { is_expected.to contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with(
:ensure => 'present', :ensure => 'present',
:roles => 'admin', :roles => ['admin'],
)} )}
it { is_expected.to contain_keystone_service(p[:auth_name]).with( it { is_expected.to contain_keystone_service(p[:auth_name]).with(

View File

@ -22,7 +22,11 @@ describe 'swift::proxy::ceilometer' do
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) } it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) } it { is_expected.to contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) }
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') } if Puppet.version.to_f < 4.0
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]')}
else
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[Ceilometer]')}
end
it { is_expected.to contain_user('swift').with_groups('ceilometer') } it { is_expected.to contain_user('swift').with_groups('ceilometer') }
it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') } it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }

View File

@ -125,9 +125,11 @@ describe 'swift::proxy' do
] ]
) )
end end
it { is_expected.to contain_concat__fragment('swift_proxy').with_before( if Puppet.version.to_f < 4.0
'Class[Swift::Proxy::Swauth]' it { is_expected.to contain_concat__fragment('swift_proxy').with_before('Class[Swift::Proxy::Swauth]')}
)} else
it { is_expected.to contain_concat__fragment('swift_proxy').with_before(['Class[Swift::Proxy::Swauth]'])}
end
end end
describe "when log udp port is set" do describe "when log udp port is set" do
context 'and log_udp_host is not set' do context 'and log_udp_host is not set' do

View File

@ -76,22 +76,22 @@ describe 'swift::ringbuilder' do
it 'should set up all of the correct dependencies' do it 'should set up all of the correct dependencies' do
is_expected.to contain_swift__ringbuilder__create('object').with( is_expected.to contain_swift__ringbuilder__create('object').with(
{:before => 'Ring_object_device[127.0.0.1:6000/1]'} {:before => ['Ring_object_device[127.0.0.1:6000/1]']}
) )
is_expected.to contain_swift__ringbuilder__create('container').with( is_expected.to contain_swift__ringbuilder__create('container').with(
{:before => 'Ring_container_device[127.0.0.1:6001/1]'} {:before => ['Ring_container_device[127.0.0.1:6001/1]']}
) )
is_expected.to contain_swift__ringbuilder__create('account').with( is_expected.to contain_swift__ringbuilder__create('account').with(
{:before => 'Ring_account_device[127.0.0.1:6002/1]'} {:before => ['Ring_account_device[127.0.0.1:6002/1]']}
) )
is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with( is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with(
{:notify => 'Swift::Ringbuilder::Rebalance[object]'} {:notify => ['Swift::Ringbuilder::Rebalance[object]']}
) )
is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with( is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with(
{:notify => 'Swift::Ringbuilder::Rebalance[container]'} {:notify => ['Swift::Ringbuilder::Rebalance[container]']}
) )
is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with( is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with(
{:notify => 'Swift::Ringbuilder::Rebalance[account]'} {:notify => ['Swift::Ringbuilder::Rebalance[account]']}
) )
end end
end end

View File

@ -84,17 +84,17 @@ describe 'swift::storage::all' do
it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with( it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with(
{:type => 'account', {:type => 'account',
:config_file_path => 'account-server.conf', :config_file_path => 'account-server.conf',
:pipeline => param_hash[:account_pipeline] || 'account-server' }.merge(storage_server_defaults) :pipeline => param_hash[:account_pipeline] || ['account-server'] }.merge(storage_server_defaults)
)} )}
it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with( it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with(
{:type => 'object', {:type => 'object',
:config_file_path => 'object-server.conf', :config_file_path => 'object-server.conf',
:pipeline => param_hash[:object_pipeline] || 'object-server' }.merge(storage_server_defaults) :pipeline => param_hash[:object_pipeline] || ['object-server'] }.merge(storage_server_defaults)
)} )}
it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with( it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
{:type => 'container', {:type => 'container',
:config_file_path => 'container-server.conf', :config_file_path => 'container-server.conf',
:pipeline => param_hash[:container_pipeline] || 'container-server', :pipeline => param_hash[:container_pipeline] || ['container-server'],
:allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults) :allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults)
)} )}

View File

@ -31,7 +31,7 @@ describe 'swift::ringbuilder::create' do
it { is_expected.to contain_exec("create_#{type}").with( 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]}", {:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}",
:path => '/usr/bin', :path => ['/usr/bin'],
:creates => "/etc/swift/#{type}.builder" } :creates => "/etc/swift/#{type}.builder" }
)} )}
end end

View File

@ -8,7 +8,7 @@ describe 'swift::ringbuilder::rebalance' do
end end
it { is_expected.to contain_exec("rebalance_#{type}").with( it { is_expected.to contain_exec("rebalance_#{type}").with(
{:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance", {:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance",
:path => '/usr/bin', :path => ['/usr/bin'],
:refreshonly => true} :refreshonly => true}
)} )}
end end
@ -23,7 +23,7 @@ describe 'swift::ringbuilder::rebalance' do
end end
it { is_expected.to contain_exec("rebalance_object").with( it { is_expected.to contain_exec("rebalance_object").with(
{:command => "swift-ring-builder /etc/swift/object.builder rebalance 999", {:command => "swift-ring-builder /etc/swift/object.builder rebalance 999",
:path => '/usr/bin', :path => ['/usr/bin'],
:refreshonly => true} :refreshonly => true}
)} )}
end end