Skip to content

Commit

Permalink
revert apache::mod::passenger default parameters for RedHat
Browse files Browse the repository at this point in the history
The prior commit modified the default parameters for mod::passenger for
RedHat, hardcoding paths related to the installed package; these changes
were unnecessary and are being reverted.

The changes were originally prompted by (new) spec acceptance temps
leveraging passenger-status (to verify that passenger is running); these
tests were not working under RedHat; revisiting with the original
default parameters revealed that the RedHat tests were misconfigured
(the required PASSENGER_TMPDIR environment was not being set), so those
have been corrected.

Also, spec/class tests have be reverted to reflect the (reverted)
expected parameters.
  • Loading branch information
jonoterc committed Apr 7, 2014
1 parent 8f0da04 commit 73f9487
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
8 changes: 4 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
$default_ssl_cert = '/etc/pki/tls/certs/localhost.crt'
$default_ssl_key = '/etc/pki/tls/private/localhost.key'
$ssl_certs_dir = '/etc/pki/tls/certs'
$passenger_conf_file = 'passenger.conf'
$passenger_conf_package_file = undef
$passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19'
$passenger_ruby = '/usr/bin/ruby'
$passenger_conf_file = 'passenger_extra.conf'
$passenger_conf_package_file = 'passenger.conf'
$passenger_root = undef
$passenger_ruby = undef
$suphp_addhandler = 'php5-script'
$suphp_engine = 'off'
$suphp_configpath = undef
Expand Down
41 changes: 27 additions & 14 deletions spec/acceptance/mod_passenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
mod_dir = '/etc/httpd/conf.d/'
conf_file = "#{mod_dir}passenger.conf"
load_file = "#{mod_dir}passenger.load"
passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19'
# sometimes installs as 3.0.12, sometimes as 3.0.19 - so just check for the stable part
passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.1'
passenger_ruby = '/usr/bin/ruby'
passenger_tempdir = '/var/run/rubygem-passenger'
passenger_module_path = 'modules/mod_passenger.so'
rackapp_user = 'apache'
rackapp_group = 'apache'
Expand Down Expand Up @@ -67,7 +69,7 @@ class { 'apache::mod::passenger': }
it { should be_enabled }
it { should be_running }
end

describe file(conf_file) do
it { should contain "PassengerRoot \"#{passenger_root}\"" }
it { should contain "PassengerRuby \"#{passenger_ruby}\"" }
Expand All @@ -84,11 +86,11 @@ class { 'apache::mod::passenger': }
r.stdout.should =~ /Passenger processes/
r.stdout.should =~ /### Processes: [0-9]+/
r.stdout.should =~ /### Total private dirty RSS: [0-9\.]+ MB/

r.exit_code.should == 0
end
end

# passenger-status fails under stock ubuntu-server-12042-x64 + mod_passenger,
# even when the passenger process is successfully installed and running
unless fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '12.04'
Expand All @@ -102,19 +104,19 @@ class { 'apache::mod::passenger': }
r.stdout.should =~ /active[ ]+= [0-9]+/
r.stdout.should =~ /inactive[ ]+= [0-9]+/
r.stdout.should =~ /Waiting on global queue: [0-9]+/

r.exit_code.should == 0
end
end
end

it 'should answer to passenger.example.com' do
shell("/usr/bin/curl passenger.example.com:80") do |r|
r.stdout.should =~ /^hello <b>world<\/b>$/
r.exit_code.should == 0
end
end

end

when 'RedHat'
Expand Down Expand Up @@ -173,32 +175,43 @@ class { 'apache::mod::passenger':
it { should be_enabled }
it { should be_running }
end

describe file(conf_file) do
it { should contain "PassengerRoot \"#{passenger_root}\"" }
it { should contain "PassengerRuby \"#{passenger_ruby}\"" }
it { should contain "PassengerRoot #{passenger_root}" }
it { should contain "PassengerRuby #{passenger_ruby}" }
it { should contain "PassengerTempDir #{passenger_tempdir}" }
end

describe file(load_file) do
it { should contain "LoadModule passenger_module #{passenger_module_path}" }
end

# note: passenger-memory-stats is not installed on Redhat
it 'should output status via passenger-memory-stats' do
shell("sudo /usr/bin/passenger-memory-stats") do |r|
r.stdout.should =~ /Apache processes/
r.stdout.should =~ /Nginx processes/
r.stdout.should =~ /Passenger processes/
r.stdout.should =~ /### Processes: [0-9]+/
r.stdout.should =~ /### Total private dirty RSS: [0-9\.]+ MB/

r.exit_code.should == 0
end
end

it 'should output status via passenger-status' do
shell("sudo /usr/bin/passenger-status") do |r|
shell("sudo PASSENGER_TMPDIR=/var/run/rubygem-passenger /usr/bin/passenger-status") do |r|
# spacing may vary
r.stdout.should =~ /[\-]+ General information [\-]+/
r.stdout.should =~ /max[ ]+= [0-9]+/
r.stdout.should =~ /count[ ]+= [0-9]+/
r.stdout.should =~ /active[ ]+= [0-9]+/
r.stdout.should =~ /inactive[ ]+= [0-9]+/
r.stdout.should =~ /Waiting on global queue: [0-9]+/

r.exit_code.should == 0
end
end

it 'should answer to passenger.example.com' do
shell("/usr/bin/curl passenger.example.com:80") do |r|
r.stdout.should =~ /^hello <b>world<\/b>$/
Expand Down
9 changes: 7 additions & 2 deletions spec/classes/mod/passenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,16 @@
it { should contain_class("apache::params") }
it { should contain_apache__mod('passenger') }
it { should contain_package("mod_passenger") }
it { should contain_file('passenger_package.conf').with({
'path' => '/etc/httpd/conf.d/passenger.conf',
}) }
it { should contain_file('passenger_package.conf').without_content }
it { should contain_file('passenger_package.conf').without_source }
it { should contain_file('passenger.load').with({
'path' => '/etc/httpd/conf.d/passenger.load',
}) }
it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/ruby\/gems\/1.8\/gems\/passenger-3\.0\.19"$/) }
it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/bin\/ruby"/) }
it { should contain_file('passenger.conf').without_content(/PassengerRoot/) }
it { should contain_file('passenger.conf').without_content(/PassengerRuby/) }
describe "with passenger_root => '/usr/lib/example'" do
let :params do
{ :passenger_root => '/usr/lib/example' }
Expand Down

0 comments on commit 73f9487

Please sign in to comment.