Debian Codegraph @

spec/classes/nova_cinder_spec.rb

raw
1 require 'spec_helper'
2
3 describe 'nova::cinder' do
4
5 shared_examples 'nova::cinder' do
6 context 'with defaults' do
7 it 'configures cinder in nova.conf' do
8 should contain_nova_config('cinder/password').with_value('<SERVICE DEFAULT>').with_secret(true)
9 should contain_nova_config('cinder/auth_type').with_value('<SERVICE DEFAULT>')
10 should contain_nova_config('cinder/auth_url').with_value('<SERVICE DEFAULT>')
11 should contain_nova_config('cinder/timeout').with_value('<SERVICE DEFAULT>')
12 should contain_nova_config('cinder/project_name').with_value('<SERVICE DEFAULT>')
13 should contain_nova_config('cinder/project_domain_name').with_value('<SERVICE DEFAULT>')
14 should contain_nova_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
15 should contain_nova_config('cinder/username').with_value('<SERVICE DEFAULT>')
16 should contain_nova_config('cinder/user_domain_name').with_value('<SERVICE DEFAULT>')
17 should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
18 should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
19 should contain_nova_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
20 should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
21 should contain_nova_config('cinder/debug').with_value('<SERVICE DEFAULT>')
22 end
23 end
24
25 context 'with password' do
26 let :params do
27 {
28 :password => 's3cr3t',
29 }
30 end
31
32 it 'configures cinder in nova.conf' do
33 should contain_nova_config('cinder/password').with_value('s3cr3t').with_secret(true)
34 should contain_nova_config('cinder/auth_type').with_value('password')
35 should contain_nova_config('cinder/auth_url').with_value('http://127.0.0.1:5000/')
36 should contain_nova_config('cinder/timeout').with_value('<SERVICE DEFAULT>')
37 should contain_nova_config('cinder/project_name').with_value('services')
38 should contain_nova_config('cinder/project_domain_name').with_value('Default')
39 should contain_nova_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
40 should contain_nova_config('cinder/username').with_value('cinder')
41 should contain_nova_config('cinder/user_domain_name').with_value('Default')
42 should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
43 should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
44 should contain_nova_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
45 should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
46 should contain_nova_config('cinder/debug').with_value('<SERVICE DEFAULT>')
47 end
48
49 end
50
51 context 'when specified parameters' do
52 let :params do
53 {
54 :password => 's3cr3t',
55 :auth_type => 'v3password',
56 :auth_url => 'http://10.0.0.10:5000/v3',
57 :timeout => 60,
58 :os_region_name => 'RegionOne',
59 :catalog_info => 'volumev3:cinderv3:publicURL',
60 :http_retries => 3,
61 :cross_az_attach => true,
62 :debug => true,
63 }
64 end
65
66 it 'configures cinder in nova.conf' do
67 should contain_nova_config('cinder/password').with_value('s3cr3t').with_secret(true)
68 should contain_nova_config('cinder/auth_type').with_value('v3password')
69 should contain_nova_config('cinder/auth_url').with_value('http://10.0.0.10:5000/v3')
70 should contain_nova_config('cinder/timeout').with_value('60')
71 should contain_nova_config('cinder/project_name').with_value('services')
72 should contain_nova_config('cinder/project_domain_name').with_value('Default')
73 should contain_nova_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
74 should contain_nova_config('cinder/username').with_value('cinder')
75 should contain_nova_config('cinder/user_domain_name').with_value('Default')
76 should contain_nova_config('cinder/os_region_name').with_value('RegionOne')
77 should contain_nova_config('cinder/catalog_info').with_value('volumev3:cinderv3:publicURL')
78 should contain_nova_config('cinder/http_retries').with_value(3)
79 should contain_nova_config('cinder/cross_az_attach').with_value(true)
80 should contain_nova_config('cinder/debug').with_value(true)
81 end
82 end
83
84 context 'when system_scope is set' do
85 let :params do
86 {
87 :password => 's3cr3t',
88 :system_scope => 'all'
89 }
90 end
91 it 'configures system-scoped credential' do
92 is_expected.to contain_nova_config('cinder/project_domain_name').with_value('<SERVICE DEFAULT>')
93 is_expected.to contain_nova_config('cinder/project_name').with_value('<SERVICE DEFAULT>')
94 is_expected.to contain_nova_config('cinder/system_scope').with_value('all')
95 end
96 end
97 end
98
99 on_supported_os({
100 :supported_os => OSDefaults.get_supported_os
101 }).each do |os,facts|
102 context "on #{os}" do
103 let (:facts) do
104 facts.merge(OSDefaults.get_facts())
105 end
106
107 it_behaves_like 'nova::cinder'
108 end
109 end
110 end