2012-10-29 12:57:57 -07:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'cinder::keystone::auth' do
|
|
|
|
|
|
|
|
let :req_params do
|
|
|
|
{:password => 'pw'}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with only required params' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
req_params
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should contain auth info' do
|
|
|
|
|
|
|
|
should contain_keystone_user('cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:password => 'pw',
|
|
|
|
:email => 'cinder@localhost',
|
|
|
|
:tenant => 'services'
|
|
|
|
)
|
|
|
|
should contain_keystone_user_role('cinder@services').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:roles => 'admin'
|
|
|
|
)
|
|
|
|
should contain_keystone_service('cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volume',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
)
|
2014-01-29 18:06:22 +01:00
|
|
|
should contain_keystone_service('cinderv2').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volumev2',
|
|
|
|
:description => 'Cinder Service v2'
|
|
|
|
)
|
2012-10-29 12:57:57 -07:00
|
|
|
|
|
|
|
end
|
|
|
|
it { should contain_keystone_endpoint('RegionOne/cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
|
|
|
|
:admin_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
|
|
|
|
:internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s'
|
|
|
|
) }
|
2014-01-29 18:06:22 +01:00
|
|
|
it { should contain_keystone_endpoint('RegionOne/cinderv2').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
|
|
|
|
:admin_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
|
|
|
|
:internal_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s'
|
|
|
|
) }
|
2012-10-29 12:57:57 -07:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2014-03-07 08:11:14 +01:00
|
|
|
context 'when overriding endpoint params' do
|
|
|
|
let :params do
|
|
|
|
req_params.merge(
|
|
|
|
:public_address => '10.0.42.1',
|
|
|
|
:admin_address => '10.0.42.2',
|
|
|
|
:internal_address => '10.0.42.3',
|
|
|
|
:region => 'RegionThree',
|
|
|
|
:port => '4242',
|
|
|
|
:admin_protocol => 'https',
|
|
|
|
:internal_protocol => 'https',
|
|
|
|
:public_protocol => 'https',
|
|
|
|
:volume_version => 'v42'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should contain_keystone_endpoint('RegionThree/cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
|
|
|
|
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
|
|
|
|
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
|
|
|
|
)}
|
|
|
|
|
2014-06-24 11:48:12 +02:00
|
|
|
it { should contain_keystone_endpoint('RegionThree/cinderv2').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'https://10.0.42.1:4242/v2/%(tenant_id)s',
|
|
|
|
:admin_url => 'https://10.0.42.2:4242/v2/%(tenant_id)s',
|
|
|
|
:internal_url => 'https://10.0.42.3:4242/v2/%(tenant_id)s'
|
|
|
|
)}
|
2014-03-07 08:11:14 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-10-29 12:57:57 -07:00
|
|
|
describe 'when endpoint should not be configured' do
|
|
|
|
let :params do
|
2014-01-29 18:06:22 +01:00
|
|
|
req_params.merge(
|
|
|
|
:configure_endpoint => false,
|
|
|
|
:configure_endpoint_v2 => false
|
|
|
|
)
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
|
|
|
it { should_not contain_keystone_endpoint('RegionOne/cinder') }
|
2014-01-29 18:06:22 +01:00
|
|
|
it { should_not contain_keystone_endpoint('RegionOne/cinderv2') }
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
|
|
|
|
2014-08-22 15:37:23 +03:00
|
|
|
describe 'when user should not be configured' do
|
|
|
|
let :params do
|
|
|
|
req_params.merge(
|
|
|
|
:configure_user => false
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should_not contain_keystone_user('cinder') }
|
|
|
|
|
|
|
|
it { should contain_keystone_user_role('cinder@services') }
|
|
|
|
|
|
|
|
it { should contain_keystone_service('cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volume',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
) }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when user and user role should not be configured' do
|
|
|
|
let :params do
|
|
|
|
req_params.merge(
|
|
|
|
:configure_user => false,
|
|
|
|
:configure_user_role => false
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should_not contain_keystone_user('cinder') }
|
|
|
|
|
|
|
|
it { should_not contain_keystone_user_role('cinder@services') }
|
|
|
|
|
|
|
|
it { should contain_keystone_service('cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volume',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
) }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|