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',
|
|
|
|
)
|
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
|
|
|
)
|
2016-01-11 20:24:45 +00:00
|
|
|
is_expected.to contain_keystone_service('cinder::volume').with(
|
2012-10-29 12:57:57 -07:00
|
|
|
:ensure => 'present',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
)
|
2016-01-11 20:24:45 +00:00
|
|
|
is_expected.to contain_keystone_service('cinderv2::volumev2').with(
|
2014-01-29 18:06:22 +01:00
|
|
|
:ensure => 'present',
|
|
|
|
: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
|
2016-01-11 20:24:45 +00:00
|
|
|
is_expected.to contain_keystone_endpoint('RegionOne/cinder::volume').with(
|
2014-02-04 19:03:42 -05:00
|
|
|
: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'
|
|
|
|
)
|
|
|
|
|
2016-01-11 20:24:45 +00:00
|
|
|
is_expected.to contain_keystone_endpoint('RegionOne/cinderv2::volumev2').with(
|
2014-02-04 19:03:42 -05:00
|
|
|
: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
|
2016-01-11 20:24:45 +00:00
|
|
|
is_expected.to contain_keystone_endpoint('RegionThree/cinder::volume').with(
|
2014-02-04 19:03:42 -05:00
|
|
|
: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'
|
|
|
|
)
|
|
|
|
|
2016-01-11 20:24:45 +00:00
|
|
|
is_expected.to contain_keystone_endpoint('RegionThree/cinderv2::volumev2').with(
|
2014-02-04 19:03:42 -05:00
|
|
|
: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
|
|
|
|
|
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
|
2016-01-11 20:24:45 +00:00
|
|
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinder::volume') }
|
|
|
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinderv2::volumev2') }
|
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') }
|
2016-01-11 20:24:45 +00:00
|
|
|
it { is_expected.to contain_keystone_service('cinder::volume').with(
|
2014-08-22 15:37:23 +03:00
|
|
|
:ensure => 'present',
|
|
|
|
: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') }
|
2016-01-11 20:24:45 +00:00
|
|
|
it { is_expected.to contain_keystone_service('cinder::volume').with(
|
2014-08-22 15:37:23 +03:00
|
|
|
:ensure => 'present',
|
|
|
|
:description => 'Cinder Service'
|
|
|
|
) }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-10-05 11:50:13 +02:00
|
|
|
describe 'when user and user role for v2 is_expected.to be configured' do
|
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:configure_user_v2 => true,
|
|
|
|
:configure_user_role_v2 => true,
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to contain_keystone__resource__service_identity('cinderv2').with(
|
|
|
|
:configure_user => true,
|
|
|
|
:configure_user_role => true,
|
|
|
|
:email => 'cinderv2@localhost',
|
|
|
|
:tenant => 'services'
|
|
|
|
) }
|
|
|
|
|
|
|
|
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') }
|
2015-12-21 19:46:52 +01:00
|
|
|
it { is_expected.to contain_keystone_service('cinder_service::volume') }
|
|
|
|
it { is_expected.to contain_keystone_service('cinder_service_v2::volumev2') }
|
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionOne/cinder_service::volume') }
|
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionOne/cinder_service_v2::volumev2') }
|
2015-01-28 10:40:48 +08:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|