Files
puppet-openstacklib/spec/defines/openstacklib_policy_spec.rb
Takashi Kajinami d689704739 Remove support for json format policy files
Json format was deprecated multiple cycles ago in favor of the new
yaml format.

Change-Id: Ie43d9cc2441bd864e13ec792e1f6ce76dda354cf
2024-06-10 15:26:14 +09:00

68 lines
1.5 KiB
Ruby

require 'spec_helper'
describe 'openstacklib::policy' do
shared_examples 'openstacklib::policy' do
context 'with basic configuration' do
let :title do
'/etc/nova/policy.yaml'
end
let :params do
{
:policies => {
'foo' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
},
:file_mode => '0644',
:file_user => 'foo',
:file_group => 'baa',
}
end
it { should contain_openstacklib__policy__base('foo').with(
:file_path => '/etc/nova/policy.yaml',
:key => 'context_is_admin',
:value => 'foo:bar'
)}
end
context 'with empty policies and purge_config enabled' do
let :title do
'/etc/nova/policy.yaml'
end
let :params do
{
:file_mode => '0644',
:file_user => 'foo',
:file_group => 'baa',
:purge_config => true,
}
end
it { should contain_openstacklib__policy__default('/etc/nova/policy.yaml').with(
:file_mode => '0644',
:file_user => 'foo',
:file_group => 'baa',
:file_format => 'yaml',
:purge_config => true,
)}
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_behaves_like 'openstacklib::policy'
end
end
end