Files
puppet-keystone/spec/classes/keystone_endpoint_spec.rb
Gilles Dubreuil 9f8ea7d7b4 Endpoints can be APIs version-less
Since Keystone V3, the endpoints don't need API versions numbers to be specified
in their respective URL [1]. Effectively, Keystone automatically adjusts to
either versions depending on the context.

For instance, using the default values will generate the following catalog:
keystone identity RegionOne
  publicURL: http://127.0.0.1:5000
  internalURL: http://127.0.0.1:5000
  adminURL: http://127.0.0.1:35357

Note:
Openstack wiki pages might not reflect this entirely yet and there are still
examples using the version number in the URLs.

This patch preserves the version parameter for the endpoint manifests but also
allows the version to be removed properly when it's blandked (version => '').

[1] https://github.com/openstack/keystone/blob/master/doc/source/http-api.rst

Change-Id: I8584d1c1e0a111d016ee507f8b004d5e131a2700
2015-09-15 06:49:24 +00:00

82 lines
2.6 KiB
Ruby

require 'spec_helper'
describe 'keystone::endpoint' do
it { is_expected.to contain_keystone_service('keystone').with(
:ensure => 'present',
:type => 'identity',
:description => 'OpenStack Identity Service'
)}
describe 'with default parameters' do
it { is_expected.to contain_keystone_endpoint('RegionOne/keystone').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:5000/v2.0',
:admin_url => 'http://127.0.0.1:35357/v2.0',
:internal_url => 'http://127.0.0.1:5000/v2.0'
)}
end
describe 'with overridden parameters' do
let :params do
{ :version => 'v42.6',
:public_url => 'https://identity.some.tld/the/main/endpoint',
:admin_url => 'https://identity-int.some.tld/some/admin/endpoint',
:internal_url => 'https://identity-int.some.tld/some/internal/endpoint' }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/keystone').with(
:ensure => 'present',
:public_url => 'https://identity.some.tld/the/main/endpoint/v42.6',
:admin_url => 'https://identity-int.some.tld/some/admin/endpoint/v42.6',
:internal_url => 'https://identity-int.some.tld/some/internal/endpoint/v42.6'
)}
end
describe 'without a version' do
# We need to test empty value '' to override the default value, using undef
# cannot un-set classes parameters.
let :params do
{ :version => '' }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/keystone').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:5000',
:admin_url => 'http://127.0.0.1:35357',
:internal_url => 'http://127.0.0.1:5000'
)}
end
describe 'without internal_url parameter' do
let :params do
{ :public_url => 'https://identity.some.tld/the/main/endpoint' }
end
it 'internal_url should default to public_url' do
is_expected.to contain_keystone_endpoint('RegionOne/keystone').with(
:ensure => 'present',
:public_url => 'https://identity.some.tld/the/main/endpoint/v2.0',
:internal_url => 'https://identity.some.tld/the/main/endpoint/v2.0'
)
end
end
describe 'with domain parameters' do
let :params do
{ :user_domain => 'userdomain',
:project_domain => 'projectdomain',
:default_domain => 'defaultdomain' }
end
it { is_expected.to contain_keystone__resource__service_identity('keystone').with(
:user_domain => 'userdomain',
:project_domain => 'projectdomain',
:default_domain => 'defaultdomain'
)}
end
end