Files
puppet-openstacklib/spec/classes/openstacklib_policy_spec.rb
beagles 4622709879 Add support for yaml format policy files
This patch adds a 'file_format' field to the policies definition to
allow overriding the default file format which is currently json.

Change-Id: Iec610053a9250cb78c2a17bfc2c197bf55d9df86
Related-Bug: #1885602
2020-07-13 20:36:11 +00:00

58 lines
1.4 KiB
Ruby

require 'spec_helper'
describe 'openstacklib::policy' do
shared_examples 'openstacklib::policy' do
context 'with basic configuration' do
let :params do
{
:policies => {
'foo' => {
'file_path' => '/etc/nova/policy.json',
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
}
}
end
it { should contain_openstacklib__policy__base('foo').with(
:file_path => '/etc/nova/policy.json',
:key => 'context_is_admin',
:value => 'foo:bar'
)}
end
context 'with yaml configuration' do
let :params do
{
:policies => {
'foo' => {
'file_path' => '/etc/octavia/policy.yaml',
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
}
}
end
it { should contain_openstacklib__policy__base('foo').with(
:file_path => '/etc/octavia/policy.yaml',
:key => 'context_is_admin',
:value => 'foo:bar'
)}
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