puppet-cinder/spec/acceptance/99_cinder_config_spec.rb
Takashi Kajinami bcc2e678e0 Add acceptance tests for config management resources
Change-Id: I3516381afe6bae49a78ed9ab2c98b23a7cb6e258
2022-07-10 12:31:16 +09:00

135 lines
3.7 KiB
Ruby

require 'spec_helper_acceptance'
describe 'basic cinder_config resource' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
File <||> -> Cinder_config <||>
File <||> -> Cinder_api_paste_ini <||>
File <||> -> Cinder_rootwrap_config <||>
file { '/etc/cinder' :
ensure => directory,
}
file { '/etc/cinder/cinder.conf' :
ensure => file,
}
file { '/etc/cinder/api-paste.ini' :
ensure => file,
}
file { '/etc/cinder/rootwrap.conf' :
ensure => file,
}
cinder_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
cinder_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
cinder_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
cinder_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
cinder_config { 'DEFAULT/thisshouldexist3' :
value => ['foo', 'bar'],
}
cinder_api_paste_ini { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
cinder_api_paste_ini { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
cinder_api_paste_ini { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
cinder_api_paste_ini { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
cinder_api_paste_ini { 'DEFAULT/thisshouldexist3' :
value => 'foo',
key_val_separator => ':'
}
cinder_rootwrap_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
cinder_rootwrap_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
cinder_rootwrap_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
cinder_rootwrap_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
describe file('/etc/cinder/cinder.conf') do
it { is_expected.to exist }
it { is_expected.to contain('thisshouldexist=foo') }
it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
it { is_expected.to contain('thisshouldexist3=foo') }
it { is_expected.to contain('thisshouldexist3=bar') }
describe '#content' do
subject { super().content }
it { is_expected.to_not match /thisshouldnotexist/ }
end
end
describe file('/etc/cinder/api-paste.ini') do
it { is_expected.to exist }
it { is_expected.to contain('thisshouldexist=foo') }
it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
it { is_expected.to contain('thisshouldexist3:foo') }
describe '#content' do
subject { super().content }
it { is_expected.to_not match /thisshouldnotexist/ }
end
end
describe file('/etc/cinder/rootwrap.conf') 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