File: nova_keystone_spec.rb

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (93 lines) | stat: -rw-r--r-- 4,000 bytes parent folder | download | duplicates (2)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
require 'spec_helper'

describe 'nova::keystone' do

  shared_examples 'nova::keystone' do

    let :params do
      {
        :password => 's3cr3t'
      }
    end

    context 'with required parameters' do
      it 'configures keystone in nova.conf' do
        should contain_nova_config('keystone/password').with_value('s3cr3t').with_secret(true)
        should contain_nova_config('keystone/auth_type').with_value('password')
        should contain_nova_config('keystone/auth_url').with_value('http://127.0.0.1:5000')
        should contain_nova_config('keystone/timeout').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/service_type').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/valid_interfaces').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/endpoint_override').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/region_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/project_name').with_value('services')
        should contain_nova_config('keystone/project_domain_name').with_value('Default')
        should contain_nova_config('keystone/username').with_value('nova')
        should contain_nova_config('keystone/user_domain_name').with_value('Default')
      end

    end

    context 'with parameters' do
      before do
        params.merge!({
          :auth_type           => 'v3password',
          :auth_url            => 'http://10.0.0.10:5000/',
          :timeout             => 60,
          :service_type        => 'identity',
          :valid_interfaces    => ['internal', 'public'],
          :endpoint_override   => 'http://10.0.0.11:5000/',
          :region_name         => 'RegionOne',
          :project_name        => 'alt_service',
          :project_domain_name => 'DomainX',
          :username            => 'alt_nova',
          :user_domain_name    => 'DomainY',
        })
      end

      it 'configures keystone in nova.conf' do
        should contain_nova_config('keystone/password').with_value('s3cr3t').with_secret(true)
        should contain_nova_config('keystone/auth_type').with_value('v3password')
        should contain_nova_config('keystone/auth_url').with_value('http://10.0.0.10:5000/')
        should contain_nova_config('keystone/timeout').with_value(60)
        should contain_nova_config('keystone/service_type').with_value('identity')
        should contain_nova_config('keystone/valid_interfaces').with_value('internal,public')
        should contain_nova_config('keystone/endpoint_override').with_value('http://10.0.0.11:5000/')
        should contain_nova_config('keystone/region_name').with_value('RegionOne')
        should contain_nova_config('keystone/system_scope').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/project_name').with_value('alt_service')
        should contain_nova_config('keystone/project_domain_name').with_value('DomainX')
        should contain_nova_config('keystone/username').with_value('alt_nova')
        should contain_nova_config('keystone/user_domain_name').with_value('DomainY')
      end
    end

    context 'when specified parameters' do
      before do
        params.merge!({
          :system_scope        => 'all',
          :project_name        => 'alt_service',
          :project_domain_name => 'DomainX',
        })
      end

      it 'configures system_scope' do
        should contain_nova_config('keystone/system_scope').with_value('all')
        should contain_nova_config('keystone/project_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('keystone/project_domain_name').with_value('<SERVICE DEFAULT>')
      end
    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 'nova::keystone'
    end
  end
end