-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #32891 - Support new tasking system and enable it by default
This introduces a new parameter `use_rq_tasking_system` with default value false that configures pulpcore to use the same RQ worker tasking system as before. When false, it instead configures pulpcore to use the newer PostgreSQL tasking system introduced in pulpcore version 3.14. Acceptance tests are included to ensure users can switch between either worker type.
- Loading branch information
Showing
9 changed files
with
314 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,18 @@ | |
service_content => template('pulpcore/pulpcore-content.service.erb'), | ||
} | ||
|
||
systemd::unit_file { 'pulpcore-resource-manager.service': | ||
content => template('pulpcore/pulpcore-resource-manager.service.erb'), | ||
active => $pulpcore::service_ensure, | ||
enable => $pulpcore::service_enable, | ||
if $pulpcore::use_rq_tasking_system { | ||
systemd::unit_file { 'pulpcore-resource-manager.service': | ||
content => template('pulpcore/pulpcore-resource-manager.service.erb'), | ||
active => $pulpcore::service_ensure, | ||
enable => $pulpcore::service_enable, | ||
} | ||
} else { | ||
systemd::unit_file { 'pulpcore-resource-manager.service': | ||
ensure => 'absent', | ||
active => false, | ||
enable => false, | ||
} | ||
} | ||
|
||
systemd::unit_file { '[email protected]': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'change configuration from postgresql tasking system to rq tasking system' do | ||
certdir = '/etc/pulpcore-certs' | ||
|
||
context 'initial configuration with newer postgresql tasking system' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_rq_tasking_system => false, | ||
} | ||
PUPPET | ||
end | ||
end | ||
|
||
describe service('httpd') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-api') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-content') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe file('/etc/systemd/system/pulpcore-resource-manager.service') do | ||
it { is_expected.not_to exist } | ||
end | ||
|
||
describe service('pulpcore-resource-manager') do | ||
it { is_expected.not_to be_enabled } | ||
it { is_expected.not_to be_running } | ||
end | ||
|
||
describe service('pulpcore-worker@1') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe port(80) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe port(443) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe curl_command("https://#{host_inventory['fqdn']}/pulp/api/v3/status/", cacert: "#{certdir}/ca-cert.pem") do | ||
its(:response_code) { is_expected.to eq(200) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings") do | ||
its(:stdout) { is_expected.to match(/^USE_NEW_WORKER_TYPE = True/) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do | ||
its(:stdout) { is_expected.to match(/^0 workers, /) } | ||
its(:stdout) { is_expected.not_to match(/^resource-manager /) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
|
||
context 'reconfigure pulpcore to use older rq worker tasking system' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_rq_tasking_system => true, | ||
} | ||
PUPPET | ||
end | ||
end | ||
|
||
describe service('httpd') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-api') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-content') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe file('/etc/systemd/system/pulpcore-resource-manager.service') do | ||
it { is_expected.to exist } | ||
end | ||
|
||
describe service('pulpcore-resource-manager') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-worker@1') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe port(80) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe port(443) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe curl_command("https://#{host_inventory['fqdn']}/pulp/api/v3/status/", cacert: "#{certdir}/ca-cert.pem") do | ||
its(:response_code) { is_expected.to eq(200) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings") do | ||
its(:stdout) { is_expected.to match(/^USE_NEW_WORKER_TYPE = False/) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do | ||
its(:stdout) { is_expected.to match(/^2 workers, /) } | ||
its(:stdout) { is_expected.to match(/^resource-manager /) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'change configuration from rq tasking system to postgresql tasking system' do | ||
certdir = '/etc/pulpcore-certs' | ||
|
||
context 'initial configuration with older rq worker tasking system' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_rq_tasking_system => true, | ||
} | ||
PUPPET | ||
end | ||
end | ||
|
||
describe service('httpd') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-api') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-content') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe file('/etc/systemd/system/pulpcore-resource-manager.service') do | ||
it { is_expected.to exist } | ||
end | ||
|
||
describe service('pulpcore-resource-manager') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-worker@1') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe port(80) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe port(443) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe curl_command("https://#{host_inventory['fqdn']}/pulp/api/v3/status/", cacert: "#{certdir}/ca-cert.pem") do | ||
its(:response_code) { is_expected.to eq(200) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings") do | ||
its(:stdout) { is_expected.to match(/^USE_NEW_WORKER_TYPE = False/) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do | ||
its(:stdout) { is_expected.to match(/^2 workers, /) } | ||
its(:stdout) { is_expected.to match(/^resource-manager /) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
|
||
context 'reconfigure pulpcore to use newer postgresql tasking system' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_rq_tasking_system => false, | ||
} | ||
PUPPET | ||
end | ||
end | ||
|
||
describe service('httpd') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-api') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe service('pulpcore-content') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe file('/etc/systemd/system/pulpcore-resource-manager.service') do | ||
it { is_expected.not_to exist } | ||
end | ||
|
||
describe service('pulpcore-resource-manager') do | ||
it { is_expected.not_to be_enabled } | ||
it { is_expected.not_to be_running } | ||
end | ||
|
||
describe service('pulpcore-worker@1') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
describe port(80) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe port(443) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe curl_command("https://#{host_inventory['fqdn']}/pulp/api/v3/status/", cacert: "#{certdir}/ca-cert.pem") do | ||
its(:response_code) { is_expected.to eq(200) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings") do | ||
its(:stdout) { is_expected.to match(/^USE_NEW_WORKER_TYPE = True/) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
|
||
describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do | ||
its(:stdout) { is_expected.to match(/^0 workers, /) } | ||
its(:stdout) { is_expected.not_to match(/^resource-manager /) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,7 @@ | |
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') | ||
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]") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters