-
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 - Add feature to optionally enable new tasking system
This introduces a new parameter `use_legacy_tasking_system` which defaults to true and configures the application the same as before. When set to false, pulpcore is configured with the new tasking system instead. Acceptance tests are included to ensure that users can switch between the two tasking systems. This is backwards compatible with Pulpcore versions older than 3.13 ONLY when configured to use the legacy tasking system. The newer tasking system requires Pulpcore version >= 3.13.
- Loading branch information
Showing
6 changed files
with
305 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,139 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'initial configuration with new tasking system' do | ||
certdir = '/etc/pulpcore-certs' | ||
|
||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_legacy_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 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 = 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 | ||
|
||
describe command("ps -e -o command") do | ||
its(:stdout) { is_expected.to match(%r(^/usr/libexec/pulpcore/pulpcore-worker$)) } | ||
its(:stdout) { is_expected.to match(%r(^/usr/libexec/pulpcore/pulpcore-worker --resource-manager$)) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
|
||
describe 'disable new tasking system' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_legacy_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 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 | ||
|
||
describe command("ps -e -o command") do | ||
its(:stdout) { is_expected.not_to match(%r(^/usr/libexec/pulpcore/pulpcore-worker$)) } | ||
its(:stdout) { is_expected.not_to match(%r(^/usr/libexec/pulpcore/pulpcore-worker --resource-manager$)) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
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,139 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'initial configuration with legacy tasking system' do | ||
certdir = '/etc/pulpcore-certs' | ||
|
||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_legacy_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 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 | ||
|
||
describe command("ps -e -o command") do | ||
its(:stdout) { is_expected.not_to match(%r(^/usr/libexec/pulpcore/pulpcore-worker$)) } | ||
its(:stdout) { is_expected.not_to match(%r(^/usr/libexec/pulpcore/pulpcore-worker --resource-manager$)) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
|
||
describe 'enable new tasking system' do | ||
it_behaves_like 'an idempotent resource' do | ||
let(:manifest) do | ||
<<-PUPPET | ||
class { 'pulpcore': | ||
worker_count => 1, | ||
use_legacy_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 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 = 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 | ||
|
||
describe command("ps -e -o command") do | ||
its(:stdout) { is_expected.to match(%r(^/usr/libexec/pulpcore/pulpcore-worker$)) } | ||
its(:stdout) { is_expected.to match(%r(^/usr/libexec/pulpcore/pulpcore-worker --resource-manager$)) } | ||
its(:exit_status) { is_expected.to eq 0 } | ||
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