3 describe 'cinder::api' do
6 {:keystone_password => 'foo'}
9 {:osfamily => 'Debian',
10 :processorcount => 8 }
13 describe 'with only required params' do
18 it { should contain_service('cinder-api').with(
23 it 'should configure cinder api correctly' do
24 should contain_cinder_config('DEFAULT/auth_strategy').with(
27 should contain_cinder_config('DEFAULT/osapi_volume_listen').with(
30 should contain_cinder_config('DEFAULT/osapi_volume_workers').with(
33 should contain_cinder_config('DEFAULT/default_volume_type').with(
36 should contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
39 should contain_cinder_api_paste_ini('filter:authtoken/service_host').with(
42 should contain_cinder_api_paste_ini('filter:authtoken/service_port').with(
45 should contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with(
48 should contain_cinder_api_paste_ini('filter:authtoken/auth_host').with(
51 should contain_cinder_api_paste_ini('filter:authtoken/auth_port').with(
54 should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
57 should contain_cinder_api_paste_ini('filter:authtoken/admin_tenant_name').with(
60 should contain_cinder_api_paste_ini('filter:authtoken/admin_user').with(
63 should contain_cinder_api_paste_ini('filter:authtoken/admin_password').with(
68 should contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
69 :value => 'http://localhost:5000/'
72 should_not contain_cinder_config('DEFAULT/os_region_name')
76 describe 'with a custom region for nova' do
78 req_params.merge({'os_region_name' => 'MyRegion'})
80 it 'should configure the region for nova' do
81 should contain_cinder_config('DEFAULT/os_region_name').with(
87 describe 'with a default volume type' do
89 req_params.merge({'default_volume_type' => 'foo'})
91 it 'should configure the default volume type for cinder' do
92 should contain_cinder_config('DEFAULT/default_volume_type').with(
98 describe 'with custom auth_uri' do
100 req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'})
102 it 'should configure cinder auth_uri correctly' do
103 should contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
104 :value => 'http://foo.bar:8080/v2.0/'
109 describe 'with only required params' do
111 req_params.merge({'bind_host' => '192.168.1.3'})
113 it 'should configure cinder api correctly' do
114 should contain_cinder_config('DEFAULT/osapi_volume_listen').with(
115 :value => '192.168.1.3'
120 [ '/keystone', '/keystone/admin', '' ].each do |keystone_auth_admin_prefix|
121 describe "with keystone_auth_admin_prefix containing incorrect value #{keystone_auth_admin_prefix}" do
124 :keystone_auth_admin_prefix => keystone_auth_admin_prefix,
125 :keystone_password => 'dummy'
129 it { should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
130 :value => keystone_auth_admin_prefix
142 ].each do |keystone_auth_admin_prefix|
143 describe "with keystone_auth_admin_prefix containing incorrect value #{keystone_auth_admin_prefix}" do
146 :keystone_auth_admin_prefix => keystone_auth_admin_prefix,
147 :keystone_password => 'dummy'
151 it { expect { should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix') }.to \
152 raise_error(Puppet::Error, /validate_re\(\): "#{keystone_auth_admin_prefix}" does not match/) }
156 describe 'with enabled false' do
158 req_params.merge({'enabled' => false})
160 it 'should stop the service' do
161 should contain_service('cinder-api').with_ensure('stopped')
163 it 'should contain db_sync exec' do
164 should_not contain_exec('cinder-manage db_sync')
168 describe 'with manage_service false' do
170 req_params.merge({'manage_service' => false})
172 it 'should not change the state of the service' do
173 should contain_service('cinder-api').without_ensure
177 describe 'with ratelimits' do
179 req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
182 it { should contain_cinder_api_paste_ini('filter:ratelimit/limits').with(
183 :value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
187 describe 'while validating the service with default command' do
193 it { should contain_exec('execute cinder-api validation').with(
194 :path => '/usr/bin:/bin:/usr/sbin:/sbin',
195 :provider => 'shell',
198 :command => 'cinder --os-auth-url http://localhost:5000/ --os-tenant-name services --os-username cinder --os-password foo list',
201 it { should contain_anchor('create cinder-api anchor').with(
202 :require => 'Exec[execute cinder-api validation]',
206 describe 'while validating the service with custom command' do
210 :validation_options => { 'cinder-api' => { 'command' => 'my-script' } }
213 it { should contain_exec('execute cinder-api validation').with(
214 :path => '/usr/bin:/bin:/usr/sbin:/sbin',
215 :provider => 'shell',
218 :command => 'my-script',
221 it { should contain_anchor('create cinder-api anchor').with(
222 :require => 'Exec[execute cinder-api validation]',