puppet-trove/spec/classes/trove_config_spec.rb
Alex Schultz e8be948eb7 Update tests to use rspec-puppet-facts
This change updates the tests to properly use rspec-puppet-facts and
on_supported_os.

Change-Id: Ia96c837440b1df3785d9abfd3a3ac8bfdf21c9ab
2016-10-26 08:19:13 -06:00

79 lines
3.1 KiB
Ruby

require 'spec_helper'
describe 'trove::config' do
shared_examples_for 'trove::config' do
let :params do
{ :trove_config => {
'DEFAULT/foo' => { 'value' => 'fooValue' },
'DEFAULT/bar' => { 'value' => 'barValue' },
'DEFAULT/baz' => { 'ensure' => 'absent' }
},
:trove_taskmanager_config => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
},
:trove_conductor_config => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
},
:trove_guestagent_config => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
},
:trove_api_paste_ini => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
}
}
end
it 'configures arbitrary trove configurations' do
is_expected.to contain_trove_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_trove_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_trove_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary trove taskmanager configurations' do
is_expected.to contain_trove_taskmanager_config('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_trove_taskmanager_config('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_trove_taskmanager_config('DEFAULT/baz2').with_ensure('absent')
end
it 'configures arbitrary trove conductor configurations' do
is_expected.to contain_trove_conductor_config('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_trove_conductor_config('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_trove_conductor_config('DEFAULT/baz2').with_ensure('absent')
end
it 'configures arbitrary trove guestagent configurations' do
is_expected.to contain_trove_guestagent_config('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_trove_guestagent_config('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_trove_guestagent_config('DEFAULT/baz2').with_ensure('absent')
end
it 'configures arbitrary trove api-paste configurations' do
is_expected.to contain_trove_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_trove_api_paste_ini('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_trove_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'trove::config'
end
end
end