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
|
2018-11-04 22:52:43 +01:00
|
|
|
{
|
|
|
|
:password => 'pw'
|
|
|
|
}
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
shared_examples 'cinder::keystone::auth' do
|
|
|
|
context 'with required parameters' do
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone_user('cinder').with(
|
2012-10-29 12:57:57 -07:00
|
|
|
:ensure => 'present',
|
|
|
|
:password => 'pw',
|
|
|
|
:email => 'cinder@localhost',
|
2018-11-04 22:52:43 +01:00
|
|
|
)}
|
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { 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']
|
2018-11-04 22:52:43 +01:00
|
|
|
)}
|
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone_service('cinderv3::volumev3').with(
|
2016-03-02 20:54:55 -05:00
|
|
|
:ensure => 'present',
|
|
|
|
:description => 'Cinder Service v3'
|
2018-11-04 22:52:43 +01:00
|
|
|
)}
|
2012-10-29 12:57:57 -07:00
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionOne/cinderv3::volumev3').with(
|
2016-03-02 20:54:55 -05:00
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'http://127.0.0.1:8776/v3/%(tenant_id)s',
|
|
|
|
:admin_url => 'http://127.0.0.1:8776/v3/%(tenant_id)s',
|
|
|
|
:internal_url => 'http://127.0.0.1:8776/v3/%(tenant_id)s'
|
2018-11-04 22:52:43 +01:00
|
|
|
)}
|
2014-02-04 19:03:42 -05:00
|
|
|
end
|
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
context 'when overriding parameters' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
2020-11-13 15:42:59 +09:00
|
|
|
:roles => ['admin', 'service'],
|
|
|
|
:region => 'RegionThree',
|
|
|
|
:public_url_v3 => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
|
|
|
|
:admin_url_v3 => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
|
|
|
|
:internal_url_v3 => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
|
2018-11-04 22:52:43 +01:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2019-06-25 09:11:15 +09:00
|
|
|
it { is_expected.to contain_keystone_user_role('cinder@services').with(
|
|
|
|
:ensure => 'present',
|
|
|
|
:roles => ['admin', 'service']
|
|
|
|
)}
|
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionThree/cinderv3::volumev3').with(
|
2018-11-04 22:52:43 +01:00
|
|
|
:ensure => 'present',
|
|
|
|
:public_url => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
|
|
|
|
:admin_url => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
|
|
|
|
:internal_url => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
|
|
|
|
)}
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
context 'when endpoint should not be configured' do
|
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:configure_endpoint_v3 => false
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.not_to contain_keystone_endpoint('RegionOne/cinderv3::volumev3') }
|
2014-08-22 15:37:23 +03:00
|
|
|
end
|
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
context 'when user should not be configured' do
|
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:configure_user => false
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.not_to contain_keystone_user('cinder') }
|
|
|
|
it { is_expected.to contain_keystone_user_role('cinder@services') }
|
2018-11-04 22:52:43 +01:00
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone_service('cinderv3::volumev3').with(
|
2014-08-22 15:37:23 +03:00
|
|
|
:ensure => 'present',
|
2019-02-12 16:20:26 -05:00
|
|
|
:description => 'Cinder Service v3'
|
2018-11-04 22:52:43 +01:00
|
|
|
)}
|
|
|
|
end
|
2014-08-22 15:37:23 +03:00
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
context 'when user and user role should not be configured' do
|
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:configure_user => false,
|
|
|
|
:configure_user_role => false
|
|
|
|
)
|
|
|
|
end
|
2014-08-22 15:37:23 +03:00
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.not_to contain_keystone_user('cinder') }
|
|
|
|
it { is_expected.not_to contain_keystone_user_role('cinder@services') }
|
2014-08-22 15:37:23 +03:00
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone_service('cinderv3::volumev3').with(
|
2014-08-22 15:37:23 +03:00
|
|
|
:ensure => 'present',
|
2019-02-12 16:20:26 -05:00
|
|
|
:description => 'Cinder Service v3'
|
2018-11-04 22:52:43 +01:00
|
|
|
)}
|
2015-10-05 11:50:13 +02:00
|
|
|
end
|
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
context 'when user and user role for v3 should be configured' do
|
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:configure_user_v3 => true,
|
|
|
|
:configure_user_role_v3 => true,
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-03-04 20:08:44 +00:00
|
|
|
it { is_expected.to contain_keystone__resource__service_identity('cinderv3').with(
|
2018-11-04 22:52:43 +01:00
|
|
|
:configure_user => true,
|
|
|
|
:configure_user_role => true,
|
|
|
|
:email => 'cinderv3@localhost',
|
|
|
|
:tenant => 'services'
|
|
|
|
)}
|
|
|
|
end
|
2016-03-02 20:54:55 -05:00
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
context 'when overriding service names' do
|
|
|
|
before do
|
|
|
|
params.merge!(
|
|
|
|
:service_name_v3 => 'cinder_service_v3',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-03-04 20:08:44 +00: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_v3::volumev3') }
|
|
|
|
it { is_expected.to contain_keystone_endpoint('RegionOne/cinder_service_v3::volumev3') }
|
2018-11-04 22:52:43 +01:00
|
|
|
end
|
2016-03-02 20:54:55 -05:00
|
|
|
end
|
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
on_supported_os({
|
|
|
|
:supported_os => OSDefaults.get_supported_os
|
|
|
|
}).each do |os,facts|
|
|
|
|
context "on #{os}" do
|
|
|
|
let (:facts) do
|
|
|
|
facts.merge!(OSDefaults.get_facts())
|
|
|
|
end
|
2015-01-28 10:40:48 +08:00
|
|
|
|
2018-11-04 22:52:43 +01:00
|
|
|
it_behaves_like 'cinder::keystone::auth'
|
2015-01-28 10:40:48 +08:00
|
|
|
end
|
|
|
|
end
|
2012-10-29 12:57:57 -07:00
|
|
|
end
|