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
changes/22/644722/2
Lars Kellogg-Stedman 4 years ago committed by Emilien Macchi
parent 2d5637bebe
commit dcbd368d5c
  1. 40
      spec/classes/keystone_federation_openidc_spec.rb
  2. 4
      templates/openidc.conf.erb

@ -2,6 +2,10 @@ require 'spec_helper'
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
<<-EOS
class { 'keystone':
@ -65,6 +69,8 @@ describe 'keystone::federation::openidc' do
end
end
it { is_expected.to contain_package(platform_parameters[:openidc_package_name]) }
context 'with only required parameters' 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')
@ -75,6 +81,14 @@ describe 'keystone::federation::openidc' do
:target => "10-keystone_wsgi.conf",
: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
context 'with remote id attribute' do
@ -90,6 +104,30 @@ describe 'keystone::federation::openidc' do
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

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

Loading…
Cancel
Save