Skip to content

Commit

Permalink
Fixes #29148 - Use Puma instead of Passenger by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sthirugn authored and ehelms committed Feb 28, 2020
1 parent 0e86214 commit 8bc1ba3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 30 deletions.
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# configure foreman via apache
$apache = true
# configure apache with passenger
$passenger = true
$passenger = false
# Server name of the VirtualHost
$servername = $::fqdn
# Server aliases of the VirtualHost
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/foreman_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

let :params do
{
passenger: true,
passenger: false,
apache: true,
app_root: '/usr/share/foreman',
ssl: true,
use_foreman_service: false,
use_foreman_service: true,
foreman_service: 'foreman',
foreman_service_ensure: 'running',
foreman_service_enable: true,
Expand All @@ -20,7 +20,7 @@
end

context 'with passenger' do
let(:params) { super().merge(passenger: true) }
let(:params) { super().merge(passenger: true, use_foreman_service: false) }
let(:pre_condition) { 'include ::apache' }

context 'with ssl' do
Expand Down
60 changes: 34 additions & 26 deletions spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

if facts[:operatingsystem] != 'Fedora'
it { should contain_package('tfm-rubygem-passenger-native') }
it { should_not contain_package('tfm-rubygem-passenger-native') }
end
when 'Debian'
it {
Expand All @@ -36,7 +36,7 @@
it { should contain_class('foreman::install') }
it { should contain_package('foreman-postgresql').with_ensure('present') }
it { should_not contain_package('foreman-journald') }
it { should_not contain_package('foreman-service') }
it { should contain_package('foreman-service') }

# config
it do
Expand All @@ -60,9 +60,9 @@
.with_content(/^:logging:\n\s*:level:\s*info$/)
.with_content(/^:dynflow:\n\s*:pool_size:\s*5$/)
.with_content(/^:hsts_enabled:\s*true$/)
.without_content(/^:ssl_client_dn_env:/)
.without_content(/^:ssl_client_verify_env:/)
.without_content(/^:ssl_client_cert_env:/)
.with_content(/^:ssl_client_dn_env:/)
.with_content(/^:ssl_client_verify_env:/)
.with_content(/^:ssl_client_cert_env:/)

should contain_concat('/etc/foreman/settings.yaml')
.with_owner('root')
Expand All @@ -78,7 +78,7 @@
.with_content(/adapter: postgresql/)
end

it { should_not contain_systemd__dropin_file('installer.conf') }
it { should contain_systemd__dropin_file('installer.conf') }

it { should contain_file('/usr/share/foreman').with_ensure('directory') }

Expand Down Expand Up @@ -146,20 +146,24 @@

# service
it { should contain_class('foreman::service') }
it { should_not contain_service('foreman') }
it { should contain_service('foreman') }
it { is_expected.to contain_service('dynflow-sidekiq@orchestrator').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('dynflow-sidekiq@worker').with_ensure('running').with_enable(true) }

it 'should restart passenger' do
# settings
it { should contain_class('foreman::settings').that_requires('Class[foreman::database]') }
end

context 'should restart passenger' do
let(:params) { super().merge(passenger: true) }

it do
should contain_exec('restart_foreman')
.with_command('/bin/touch /usr/share/foreman/tmp/restart.txt')
.with_refreshonly(true)
.with_cwd('/usr/share/foreman')
.with_path('/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin')
end

# settings
it { should contain_class('foreman::settings').that_requires('Class[foreman::database]') }
end

context 'without passenger' do
Expand Down Expand Up @@ -325,24 +329,28 @@
}
end

describe 'with url ending with trailing slash' do
let(:params) { super().merge(foreman_url: 'https://example.com/') }
it { should contain_apache__vhost('foreman').without_custom_fragment(/Alias/) }
end
context 'with passenger' do
let(:params) { super().merge(passenger: true) }

describe 'with sub-uri' do
let(:params) { super().merge(foreman_url: 'https://example.com/foreman') }
it { should contain_apache__vhost('foreman').with_custom_fragment(%r{Alias /foreman}) }
end
describe 'with url ending with trailing slash' do
let(:params) { super().merge(foreman_url: 'https://example.com/') }
it { should contain_apache__vhost('foreman').without_custom_fragment(/Alias/) }
end

describe 'with sub-uri ending with trailing slash' do
let(:params) { super().merge(foreman_url: 'https://example.com/foreman/') }
it { should contain_apache__vhost('foreman').with_custom_fragment(%r{Alias /foreman}) }
end
describe 'with sub-uri' do
let(:params) { super().merge(foreman_url: 'https://example.com/foreman') }
it { should contain_apache__vhost('foreman').with_custom_fragment(%r{Alias /foreman}) }
end

describe 'with sub-uri ending with trailing slash' do
let(:params) { super().merge(foreman_url: 'https://example.com/foreman/') }
it { should contain_apache__vhost('foreman').with_custom_fragment(%r{Alias /foreman}) }
end

describe 'with sub-uri ending with more levels' do
let(:params) { super().merge(foreman_url: 'https://example.com/apps/foreman/') }
it { should contain_apache__vhost('foreman').with_custom_fragment(%r{Alias /apps/foreman}) }
describe 'with sub-uri ending with more levels' do
let(:params) { super().merge(foreman_url: 'https://example.com/apps/foreman/') }
it { should contain_apache__vhost('foreman').with_custom_fragment(%r{Alias /apps/foreman}) }
end
end

describe 'with loggers' do
Expand Down

0 comments on commit 8bc1ba3

Please sign in to comment.