2012-10-29 12:57:57 -07:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'cinder::keystone::auth' do
|
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
let :params do
|
2012-10-29 12:57:57 -07:00
|
|
|
{:password => 'pw'}
|
|
|
|
end
|
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
context 'with required parameters' do
|
2012-10-29 12:57:57 -07:00
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
it 'configures keystone user and service' do
|
2012-10-29 12:57:57 -07:00
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_keystone_user('cinder').with(
|
2012-10-29 12:57:57 -07:00
|
|
|
:ensure => 'present',
|
|
|
|
:password => 'pw',
|
|
|
|
:email => 'cinder@localhost',
|
|
|
|
:tenant => 'services'
|
|
|
|
)
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_keystone_user_role('cinder@services').with(
|
2012-10-29 12:57:57 -07:00
|
|
|
:ensure => 'present',
|
2015-04-28 03:06:01 +02:00
|
|
|
:roles => ['admin']
|
2012-10-29 12:57:57 -07:00
|
|
|
)
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_keystone_service('cinder').with(
|
2012-10-29 12:57:57 -07:00
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volume',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
)
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_keystone_service('cinderv2').with(
|
2014-01-29 18:06:22 +01:00
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volumev2',
|
|
|
|
:description => 'Cinder Service v2'
|
|
|
|
)
|
2012-10-29 12:57:57 -07:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
it 'configures keystone endpoints' do
|
|
|
|
is_expected.to 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'
|
|
|
|
)
|
|
|
|
|
|
|
|
is_expected.to 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'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when overriding parameters' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:region => 'RegionThree',
|
|
|
|
:public_url => 'https://10.0.42.1:4242/v41/%(tenant_id)s',
|
|
|
|
:admin_url => 'https://10.0.42.2:4242/v41/%(tenant_id)s',
|
|
|
|
:internal_url => 'https://10.0.42.3:4242/v41/%(tenant_id)s',
|
|
|
|
:public_url_v2 => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
|
|
|
|
:admin_url_v2 => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
|
|
|
|
:internal_url_v2 => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'configures keystone endpoints' do
|
|
|
|
is_expected.to contain_keystone_endpoint('RegionThree/cinder').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'https://10.0.42.1:4242/v41/%(tenant_id)s',
|
|
|
|
:admin_url => 'https://10.0.42.2:4242/v41/%(tenant_id)s',
|
|
|
|
:internal_url => 'https://10.0.42.3:4242/v41/%(tenant_id)s'
|
|
|
|
)
|
|
|
|
|
|
|
|
is_expected.to contain_keystone_endpoint('RegionThree/cinderv2').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'
|
|
|
|
)
|
|
|
|
end
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
context 'with deprecated parameters' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
2014-03-07 08:11:14 +01:00
|
|
|
: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'
|
2014-02-04 19:03:42 -05:00
|
|
|
})
|
2014-03-07 08:11:14 +01:00
|
|
|
end
|
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
it 'configures keystone endpoints' do
|
|
|
|
is_expected.to 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'
|
|
|
|
)
|
|
|
|
|
|
|
|
is_expected.to 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'
|
|
|
|
)
|
|
|
|
end
|
2014-03-07 08:11:14 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
describe 'when endpoint is_expected.to not be configured' do
|
2014-02-04 19:03:42 -05:00
|
|
|
before do
|
|
|
|
params.merge!(
|
2014-01-29 18:06:22 +01:00
|
|
|
:configure_endpoint => false,
|
|
|
|
:configure_endpoint_v2 => false
|
|
|
|
)
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
2015-02-22 22:29:32 +01:00
|
|
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinder') }
|
|
|
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinderv2') }
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
describe 'when user is_expected.to not be configured' do
|
2014-02-04 19:03:42 -05:00
|
|
|
before do
|
|
|
|
params.merge!(
|
2014-08-22 15:37:23 +03:00
|
|
|
:configure_user => false
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
it { is_expected.to_not contain_keystone_user('cinder') }
|
|
|
|
it { is_expected.to contain_keystone_user_role('cinder@services') }
|
|
|
|
it { is_expected.to contain_keystone_service('cinder').with(
|
2014-08-22 15:37:23 +03:00
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volume',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
) }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
describe 'when user and user role is_expected.to not be configured' do
|
2014-02-04 19:03:42 -05:00
|
|
|
before do
|
|
|
|
params.merge!(
|
2014-08-22 15:37:23 +03:00
|
|
|
:configure_user => false,
|
|
|
|
:configure_user_role => false
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
it { is_expected.to_not contain_keystone_user('cinder') }
|
|
|
|
it { is_expected.to_not contain_keystone_user_role('cinder@services') }
|
|
|
|
it { is_expected.to contain_keystone_service('cinder').with(
|
2014-08-22 15:37:23 +03:00
|
|
|
:ensure => 'present',
|
|
|
|
:type => 'volume',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
) }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-01-28 10:40:48 +08:00
|
|
|
describe 'when overriding service names' do
|
|
|
|
|
2014-02-04 19:03:42 -05:00
|
|
|
before do
|
|
|
|
params.merge!(
|
2015-01-28 10:40:48 +08:00
|
|
|
:service_name => 'cinder_service',
|
|
|
|
:service_name_v2 => 'cinder_service_v2',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2015-07-20 15:42:25 +02:00
|
|
|
it { is_expected.to contain_keystone_user('cinder') }
|
|
|
|
it { is_expected.to contain_keystone_user_role('cinder@services') }
|
|
|
|
it { is_expected.to contain_keystone_service('cinder_service') }
|
|
|
|
it { is_expected.to contain_keystone_service('cinder_service_v2') }
|
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionOne/cinder_service') }
|
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionOne/cinder_service_v2') }
|
2015-01-28 10:40:48 +08:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|