fix typo in templates/openidc.conf.erb

- the erb template referenced _memcached_servers, but the manifest
  uses memcached_servers_real.

- add a variety of spec tests to verify that templated content is
  getting generated as expected.

Change-Id: Ic2cf0a4490fa68c424cf77c09c9c93fb282c66d6
This commit is contained in:
Lars Kellogg-Stedman 2019-03-19 16:06:15 -04:00 committed by Emilien Macchi
parent 2d5637bebe
commit dcbd368d5c
2 changed files with 41 additions and 3 deletions

View File

@ -2,6 +2,10 @@ require 'spec_helper'
describe 'keystone::federation::openidc' do describe 'keystone::federation::openidc' do
def get_param(type, title, param)
catalogue.resource(type, title).send(:parameters)[param.to_sym]
end
let(:pre_condition) do let(:pre_condition) do
<<-EOS <<-EOS
class { 'keystone': class { 'keystone':
@ -65,6 +69,8 @@ describe 'keystone::federation::openidc' do
end end
end end
it { is_expected.to contain_package(platform_parameters[:openidc_package_name]) }
context 'with only required parameters' do context 'with only required parameters' do
it 'should have basic params for openidc in Keystone configuration' do it 'should have basic params for openidc in Keystone configuration' do
is_expected.to contain_keystone_config('auth/methods').with_value('password, token, openid') is_expected.to contain_keystone_config('auth/methods').with_value('password, token, openid')
@ -75,6 +81,14 @@ describe 'keystone::federation::openidc' do
:target => "10-keystone_wsgi.conf", :target => "10-keystone_wsgi.conf",
:order => params[:template_order], :order => params[:template_order],
})} })}
it 'should contain expected config' do
content = get_param('concat::fragment', 'configure_openidc_keystone', 'content')
expect(content).to match('OIDCProviderMetadataURL "https://accounts.google.com/.well-known/openid-configuration"')
expect(content).to match('OIDCClientID "openid_client_id"')
expect(content).to match('OIDCClientSecret "openid_client_secret"')
expect(content).to match('OS-FEDERATION/identity_providers/myidp/protocols/openid/auth')
end
end end
context 'with remote id attribute' do context 'with remote id attribute' do
@ -90,6 +104,30 @@ describe 'keystone::federation::openidc' do
end end
it { is_expected.to contain_package(platform_parameters[:openidc_package_name]) } context 'with memcached_servers attribute' do
before do
params.merge!({
:memcached_servers => ['127.0.0.1:11211', '127.0.0.2:11211'],
})
end
it 'should contain memcache servers' do
content = get_param('concat::fragment', 'configure_openidc_keystone', 'content')
expect(content).to match('OIDCMemCacheServers "127.0.0.1:11211 127.0.0.2:11211"')
end
end
context 'with redis_server attribute' do
before do
params.merge!({
:redis_server => '127.0.0.1',
})
end
it 'should contain redis server' do
content = get_param('concat::fragment', 'configure_openidc_keystone', 'content')
expect(content).to match('OIDCRedisCacheServer "127.0.0.1"')
end
end
end end
end end

View File

@ -23,10 +23,10 @@
OIDCCacheFileCleanInterval scope['::keystone::federation::openidc::openidc_cache_clean_interval'] %> OIDCCacheFileCleanInterval scope['::keystone::federation::openidc::openidc_cache_clean_interval'] %>
<%- end -%> <%- end -%>
<%- if scope['::keystone::federation::openidc::memcached_servers_real'] -%> <%- if scope['::keystone::federation::openidc::memcached_servers_real'] -%>
OIDCMemCacheServers "<%= scope['::keystone::federation::openidc::_memcached_servers'] %>" OIDCMemCacheServers "<%= scope['::keystone::federation::openidc::memcached_servers_real'] %>"
<%- end -%> <%- end -%>
<%- if scope['::keystone::federation::openidc::redis_server'] != nil -%> <%- if scope['::keystone::federation::openidc::redis_server'] != nil -%>
OIDCRedisCacheServer scope['::keystone::federation::openidc::redis_server'] %> OIDCRedisCacheServer "<%= scope['::keystone::federation::openidc::redis_server'] %>"
<%- end -%> <%- end -%>
<%- if scope['::keystone::federation::openidc::redis_password'] != nil -%> <%- if scope['::keystone::federation::openidc::redis_password'] != nil -%>
OIDCRedisCachecPassword scope['::keystone::federation::openidc::redis_password'] %> OIDCRedisCachecPassword scope['::keystone::federation::openidc::redis_password'] %>