File: nova_cinder_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 (110 lines) | stat: -rw-r--r-- 5,317 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
require 'spec_helper'

describe 'nova::cinder' do

  shared_examples 'nova::cinder' do
    context 'with defaults' do
      it 'configures cinder in nova.conf' do
        should contain_nova_config('cinder/password').with_value('<SERVICE DEFAULT>').with_secret(true)
        should contain_nova_config('cinder/auth_type').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/auth_url').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/timeout').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/project_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/project_domain_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/username').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/user_domain_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/debug').with_value('<SERVICE DEFAULT>')
      end
    end

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

      it 'configures cinder in nova.conf' do
        should contain_nova_config('cinder/password').with_value('s3cr3t').with_secret(true)
        should contain_nova_config('cinder/auth_type').with_value('password')
        should contain_nova_config('cinder/auth_url').with_value('http://127.0.0.1:5000/')
        should contain_nova_config('cinder/timeout').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/project_name').with_value('services')
        should contain_nova_config('cinder/project_domain_name').with_value('Default')
        should contain_nova_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/username').with_value('cinder')
        should contain_nova_config('cinder/user_domain_name').with_value('Default')
        should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/debug').with_value('<SERVICE DEFAULT>')
      end

    end

    context 'when specified parameters' do
      let :params do
        {
          :password        => 's3cr3t',
          :auth_type       => 'v3password',
          :auth_url        => 'http://10.0.0.10:5000/v3',
          :timeout         => 60,
          :os_region_name  => 'RegionOne',
          :catalog_info    => 'volumev3:cinderv3:publicURL',
          :http_retries    => 3,
          :cross_az_attach => true,
          :debug           => true,
        }
      end

      it 'configures cinder in nova.conf' do
        should contain_nova_config('cinder/password').with_value('s3cr3t').with_secret(true)
        should contain_nova_config('cinder/auth_type').with_value('v3password')
        should contain_nova_config('cinder/auth_url').with_value('http://10.0.0.10:5000/v3')
        should contain_nova_config('cinder/timeout').with_value('60')
        should contain_nova_config('cinder/project_name').with_value('services')
        should contain_nova_config('cinder/project_domain_name').with_value('Default')
        should contain_nova_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
        should contain_nova_config('cinder/username').with_value('cinder')
        should contain_nova_config('cinder/user_domain_name').with_value('Default')
        should contain_nova_config('cinder/os_region_name').with_value('RegionOne')
        should contain_nova_config('cinder/catalog_info').with_value('volumev3:cinderv3:publicURL')
        should contain_nova_config('cinder/http_retries').with_value(3)
        should contain_nova_config('cinder/cross_az_attach').with_value(true)
        should contain_nova_config('cinder/debug').with_value(true)
      end
    end

    context 'when system_scope is set' do
      let :params do
        {
          :password     => 's3cr3t',
          :system_scope => 'all'
        }
      end
      it 'configures system-scoped credential' do
        is_expected.to contain_nova_config('cinder/project_domain_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_nova_config('cinder/project_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_nova_config('cinder/system_scope').with_value('all')
      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::cinder'
    end
  end
end