File: openstacklib_policy_spec.rb

package info (click to toggle)
puppet-module-openstacklib 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 968 kB
  • sloc: ruby: 4,500; python: 38; sh: 22; makefile: 10
file content (67 lines) | stat: -rw-r--r-- 1,564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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