Skip to content

Commit

Permalink
Refs #32917 - Don't deploy or configure Redis with new tasking system
Browse files Browse the repository at this point in the history
  • Loading branch information
wbclark committed Jul 7, 2021
1 parent 4ccdb94 commit 760d795
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 1 deletion.
4 changes: 3 additions & 1 deletion manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
require => Pulpcore::Admin['migrate --noinput'],
}

include redis
if $pulpcore::use_rq_tasking_system or $pulpcore::cache_enabled {
include redis
}

}
89 changes: 89 additions & 0 deletions spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
require 'spec_helper'

describe 'pulpcore' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { override_facts(os_facts, os: {selinux: {enabled: true}}) }

context 'postgresql tasking system and content cache disabled' do
let(:params) do
{
use_rq_tasking_system: false,
cache_enabled: false,
}
end

it 'does not include redis' do
is_expected.not_to contain_class('redis')
end

it 'does not configure pulpcore connection to redis' do
is_expected.to contain_concat__fragment('base')
.without_content(/REDIS_HOST/)
.without_content(/REDIS_PORT/)
.without_content(/REDIS_DB/)
end
end

context 'rq tasking system and content cache disabled' do
let(:params) do
{
use_rq_tasking_system: true,
cache_enabled: false,
}
end

it 'includes redis' do
is_expected.to contain_class('redis')
end

it 'configures pulpcore connection to redis' do
is_expected.to contain_concat__fragment('base')
.with_content(/REDIS_HOST/)
.with_content(/REDIS_PORT/)
.with_content(/REDIS_DB/)
end
end

context 'postgresql tasking system and content cache enabled' do
let(:params) do
{
use_rq_tasking_system: false,
cache_enabled: true,
}
end

it 'includes redis' do
is_expected.to contain_class('redis')
end

it 'configures pulpcore connection to redis' do
is_expected.to contain_concat__fragment('base')
.with_content(/REDIS_HOST/)
.with_content(/REDIS_PORT/)
.with_content(/REDIS_DB/)
end
end

context 'rq tasking system and content cache enabled' do
let(:params) do
{
use_rq_tasking_system: true,
cache_enabled: true,
}
end

it 'includes redis' do
is_expected.to contain_class('redis')
end

it 'configures pulpcore connection to redis' do
is_expected.to contain_concat__fragment('base')
.with_content(/REDIS_HOST/)
.with_content(/REDIS_PORT/)
.with_content(/REDIS_DB/)
end
end
end
end
end
3 changes: 3 additions & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ DATABASES = {
<% end -%>
},
}

<% if scope['pulpcore::use_rq_tasking_system'] || scope['pulpcore::cache_enabled'] -%>
REDIS_HOST = "localhost"
REDIS_PORT = "<%= scope['redis::port'] %>"
REDIS_DB = <%= scope['pulpcore::redis_db'] %>
<% end -%>

USE_NEW_WORKER_TYPE = <%= scope['pulpcore::use_rq_tasking_system'] ? "False" : "True" %>

Expand Down

0 comments on commit 760d795

Please sign in to comment.