puppet-manila/spec/classes/manila_api_spec.rb
Erno Kuvaja 2a13d46a43 Add CephFSNative driver logic
Adds the manifest for CephFSNative driver.

Change-Id: Ie97b1eb5fbb96417310fbfeb83bca67a96a01881
2016-08-18 10:40:19 +01:00

110 lines
3.1 KiB
Ruby

require 'spec_helper'
describe 'manila::api' do
let :req_params do
{:keystone_password => 'foo'}
end
let :facts do
@default_facts.merge({:osfamily => 'Debian'})
end
describe 'with only required params' do
let :params do
req_params
end
it { is_expected.to contain_service('manila-api').with(
'hasstatus' => true,
'ensure' => 'running',
'tag' => 'manila-service',
)}
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/auth_strategy').with(:value => 'keystone')
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(:value => '0.0.0.0')
is_expected.to contain_manila_config('DEFAULT/enabled_share_protocols').with(:value => '<SERVICE DEFAULT>')
is_expected.to_not contain_manila_config('DEFAULT/os_region_name')
is_expected.to contain_manila_config('oslo_middleware/enable_proxy_headers_parsing').with_value('<SERVICE DEFAULT>')
end
it 'should run db sync' do
is_expected.to contain_class('manila::db::sync')
end
end
describe 'with a custom region for nova' do
let :params do
req_params.merge({'os_region_name' => 'MyRegion'})
end
it 'should configure the region for nova' do
is_expected.to contain_manila_config('DEFAULT/os_region_name').with(
:value => 'MyRegion'
)
end
end
describe 'with only required params' do
let :params do
req_params.merge({'bind_host' => '192.168.1.3'})
end
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(
:value => '192.168.1.3'
)
end
end
describe 'with only required params' do
let :params do
req_params.merge({'enable_proxy_headers_parsing' => true})
end
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('oslo_middleware/enable_proxy_headers_parsing').with(
:value => true
)
end
end
describe 'with enabled false' do
let :params do
req_params.merge({'enabled' => false})
end
it 'should stop the service' do
is_expected.to contain_service('manila-api').with_ensure('stopped')
end
it 'includes manila::db::sync' do
is_expected.to contain_class('manila::db::sync')
end
end
describe 'with sync_db false' do
let :params do
req_params.merge({'sync_db' => false})
end
it 'should not include manila::db::sync' do
is_expected.to_not contain_class('manila::db::sync')
end
end
describe 'with manage_service false' do
let :params do
req_params.merge({'manage_service' => false})
end
it 'should not change the state of the service' do
is_expected.to contain_service('manila-api').without_ensure
end
end
describe 'with ratelimits' do
let :params do
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
end
it { is_expected.to contain_manila_api_paste_ini('filter:ratelimit/limits').with(
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
)}
end
end