-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refs #32917 - Don't deploy or configure Redis with new tasking system #207
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ | |
require => Pulpcore::Admin['migrate --noinput'], | ||
} | ||
|
||
include redis | ||
if $pulpcore::uses_redis { | ||
include redis | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,7 @@ | |
.with_content(%r{ALLOWED_EXPORT_PATHS = \[\]}) | ||
.with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports"\]}) | ||
.with_content(%r{ALLOWED_CONTENT_CHECKSUMS = \["sha224", "sha256", "sha384", "sha512"\]}) | ||
.with_content(%r{CACHE_ENABLED = False}) | ||
.without_content(/sslmode/) | ||
.without_content(%r{sslmode}) | ||
is_expected.to contain_file('/etc/pulp') | ||
is_expected.to contain_file('/var/lib/pulp') | ||
is_expected.to contain_file('/var/lib/pulp/sync_imports') | ||
|
@@ -41,7 +40,7 @@ | |
is_expected.to contain_exec('pulpcore-manager collectstatic --noinput') | ||
end | ||
|
||
it 'configures the database' do | ||
it 'configures the PostgreSQL database' do | ||
is_expected.to contain_class('pulpcore::database') | ||
is_expected.to contain_class('postgresql::server') | ||
is_expected.to contain_postgresql__server__db('pulpcore') | ||
|
@@ -51,6 +50,30 @@ | |
is_expected.to contain_exec('pulpcore-manager reset-admin-password --random') | ||
end | ||
|
||
it 'does not install 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(%r{REDIS_HOST}) | ||
.without_content(%r{REDIS_POST}) | ||
.without_content(%r{REDIS_DB}) | ||
end | ||
|
||
it 'does not configure content caching' do | ||
is_expected.to contain_concat__fragment('base') | ||
.with_content(/CACHE_ENABLED = False/) | ||
.without_content(%r{CACHE_SETTINGS}) | ||
.without_content(%r{'EXPIRES_TTL':}) | ||
end | ||
|
||
it 'configures pulpcore to use PostgreSQL tasking system' do | ||
is_expected.to contain_concat__fragment('base') | ||
.with_content(%r{USE_NEW_WORKER_TYPE = True}) | ||
is_expected.to contain_systemd__unit_file('pulpcore-resource-manager.service').with_ensure('absent') | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This are OK here, but they feel better up here https://github.com/theforeman/puppet-pulpcore/pull/207/files#diff-257fe3136ecfdbfcb123b6445ff2de6c21d1fe08b0d6af54c08dde40637d2594R19 for me as it connects all of the configuration file together. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I started to think that it makes sense to structure the tests around the real world use case rather than the specific object being tested.. So instead of having all tests for the configuration file in the same place, have a test for 'content caching is disabled', 'postgresql tasking system is used', and so on. I see two primary benefits: 1. This feels more maintainable in the longer term (when we make modifications to a specific feature, the tests for that feature are all located in that block, rather than spread out across different components the feature touches). 2. This should lead to more readable test output, and particularly failures. So instead of getting a failure like I want to pursue this idea more consistently in my planned refactoring. For this PR I thought, it makes sense to write the net-new tests using this style, to minimize the amount of re-writing I have to do later. |
||
|
||
it 'configures apache' do | ||
is_expected.to contain_class('pulpcore::apache') | ||
is_expected.to contain_apache__vhost('pulpcore') | ||
|
@@ -128,7 +151,6 @@ | |
is_expected.to contain_systemd__unit_file('pulpcore-content.socket') | ||
is_expected.to contain_systemd__unit_file('pulpcore-content.service') | ||
is_expected.to contain_file('/etc/systemd/system/pulpcore-content.socket').that_comes_before('Service[pulpcore-content.service]') | ||
is_expected.to contain_systemd__unit_file('pulpcore-resource-manager.service').with_ensure('absent') | ||
is_expected.to contain_systemd__unit_file('[email protected]') | ||
is_expected.to contain_service("[email protected]").with_ensure(true) | ||
is_expected.not_to contain_service("[email protected]") | ||
|
@@ -491,11 +513,46 @@ | |
} | ||
end | ||
|
||
it do | ||
it 'configures content caching' do | ||
is_expected.to contain_concat__fragment('base') | ||
.with_content(%r{CACHE_ENABLED = True}) | ||
.with_content(%r{CACHE_SETTINGS = \{\n 'EXPIRES_TTL': 60,\n\}}) | ||
end | ||
|
||
it 'installs 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(%r{REDIS_HOST}) | ||
.with_content(%r{REDIS_PORT}) | ||
.with_content(%r{REDIS_DB}) | ||
end | ||
end | ||
|
||
context 'can enable RQ tasking system' do | ||
let :params do | ||
{ | ||
use_rq_tasking_system: true, | ||
} | ||
end | ||
|
||
it 'configures RQ tasking system' do | ||
is_expected.to contain_concat__fragment('base') | ||
.with_content(%r{USE_NEW_WORKER_TYPE = False}) | ||
end | ||
|
||
it 'installs 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(%r{REDIS_HOST}) | ||
.with_content(%r{REDIS_PORT}) | ||
.with_content(%r{REDIS_DB}) | ||
end | ||
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already covered by https://github.com/theforeman/puppet-pulpcore/pull/207/files#diff-257fe3136ecfdbfcb123b6445ff2de6c21d1fe08b0d6af54c08dde40637d2594R26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, thank you.