puppet-swift/spec/acceptance/swift_config_spec.rb
Gael Chamoulaud 86851f4a2f Fix rspec 3.x syntax
- Convert 'should' keyword to 'is_expected.to',
- The old ':should' syntax in rspec 3.x is deprecated in favor of ':expect'
  syntax,
- Expectations on attribute of subject with 'its'.

Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>

Change-Id: Id2892bb493cdd8357b74bf81c8606ba00c74b93c
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2015-09-10 12:43:56 +02:00

191 lines
5.3 KiB
Ruby

require 'spec_helper_acceptance'
describe 'basic swift_config resource' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
File <||> -> Swift_config <||>
File <||> -> Swift_account_config <||>
File <||> -> Swift_bench_config <||>
File <||> -> Swift_container_config <||>
File <||> -> Swift_dispersion_config <||>
File <||> -> Swift_object_config <||>
File <||> -> Swift_proxy_config <||>
file { '/etc/swift' :
ensure => directory,
}
$swift_files = [ '/etc/swift/swift.conf',
'/etc/swift/account-server.conf',
'/etc/swift/swift-bench.conf',
'/etc/swift/container-server.conf',
'/etc/swift/dispersion.conf',
'/etc/swift/object-server.conf',
'/etc/swift/proxy-server.conf']
file { $swift_files :
ensure => file,
}
swift_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
swift_account_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_account_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_account_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_account_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
swift_bench_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_bench_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_bench_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_bench_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
swift_container_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_container_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_container_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_container_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
swift_dispersion_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_dispersion_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_dispersion_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_dispersion_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
swift_object_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_object_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_object_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_object_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
swift_proxy_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
swift_proxy_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
swift_proxy_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
swift_proxy_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
$swift_files = [ '/etc/swift/swift.conf',
'/etc/swift/account-server.conf',
'/etc/swift/swift-bench.conf',
'/etc/swift/container-server.conf',
'/etc/swift/dispersion.conf',
'/etc/swift/object-server.conf',
'/etc/swift/proxy-server.conf']
$swift_files.each do |swift_conf_file|
describe file(swift_conf_file) do
it { is_expected.to exist }
it { is_expected.to contain('thisshouldexist=foo') }
it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
describe '#content' do
subject { super().content }
it { is_expected.to_not match /thisshouldnotexist/ }
end
end
end
end
end