diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index c2622725..b46ebd73 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -254,7 +254,7 @@ describe 'horizon' do it { is_expected.to contain_exec('refresh_horizon_django_compress') } end - context 'with overridden parameters and cache_server_url' do + context 'with overridden parameters and cache_server_url (string)' do before do params.merge!({ :cache_server_url => 'redis://:password@10.0.0.1:6379/1', @@ -271,6 +271,23 @@ describe 'horizon' do it { is_expected.to contain_exec('refresh_horizon_django_compress') } end + context 'with overridden parameters and cache_server_url (array)' do + before do + params.merge!({ + :cache_server_url => ['192.0.2.1:11211', '192.0.2.2:11211'], + }) + end + + it 'generates local_settings.py' do + verify_concat_fragment_contents(catalogue, 'local_settings.py', [ + " 'LOCATION': ['192.0.2.1:11211','192.0.2.2:11211'],", + ]) + end + + it { is_expected.to contain_exec('refresh_horizon_django_cache') } + it { is_expected.to contain_exec('refresh_horizon_django_compress') } + end + context 'installs python memcache library when cache_backend is set to memcache' do before do params.merge!({ diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 489757d4..3aaf140c 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -243,7 +243,11 @@ CACHES = { <%- end -%> <%- end -%> <%- if @cache_server_url -%> + <%- if @cache_server_url.kind_of?(Array) -%> + 'LOCATION': ['<%= @cache_server_url.join("','") %>'], + <%- else -%> 'LOCATION': '<%= @cache_server_url %>', + <%- end -%> <%- end -%> } }