Skip to content

Commit

Permalink
Merge pull request #791 from mhaskel/rhel7-test-fixes
Browse files Browse the repository at this point in the history
Mark tests depending on passenger as pending on RHEL7.
  • Loading branch information
Ashley Penney committed Jul 8, 2014
2 parents e4e7b5b + b62bb06 commit d00631c
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 107 deletions.
176 changes: 89 additions & 87 deletions spec/acceptance/mod_passenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,108 +130,110 @@ class { 'apache::mod::passenger': }
# no fedora 18 passenger package yet, and rhel5 packages only exist for ruby 1.8.5
unless (fact('operatingsystem') == 'Fedora' and fact('operatingsystemrelease').to_f >= 18) or (fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') == '5' and fact('rubyversion') != '1.8.5')

context "default passenger config" do
it 'succeeds in puppeting passenger' do
pp = <<-EOS
/* EPEL and passenger repositories */
class { 'epel': }
exec { 'passenger.repo GPG key':
command => '/usr/bin/curl -o /etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc',
creates => '/etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc',
}
file { 'passenger.repo GPG key':
ensure => file,
path => '/etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc',
require => Exec['passenger.repo GPG key'],
}
epel::rpm_gpg_key { 'passenger.stealthymonkeys.com':
path => '/etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc',
require => [
Class['epel'],
File['passenger.repo GPG key'],
]
}
$releasever_string = $operatingsystem ? {
'Scientific' => '6',
default => '$releasever',
}
yumrepo { 'passenger':
baseurl => "http://passenger.stealthymonkeys.com/rhel/${releasever_string}/\\$basearch" ,
descr => "Red Hat Enterprise ${releasever_string} - Phusion Passenger",
enabled => 1,
gpgcheck => 1,
gpgkey => 'http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc',
mirrorlist => 'http://passenger.stealthymonkeys.com/rhel/mirrors',
require => [
Epel::Rpm_gpg_key['passenger.stealthymonkeys.com'],
],
}
/* apache and mod_passenger */
class { 'apache':
if fact('operatingsystem') == 'RedHat' and fact('operatingsystemmajrelease') == '7'
pending('test passenger - RHEL7 packages don\'t exist')
else
context "default passenger config" do
it 'succeeds in puppeting passenger' do
pp = <<-EOS
/* EPEL and passenger repositories */
class { 'epel': }
exec { 'passenger.repo GPG key':
command => '/usr/bin/curl -o /etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc',
creates => '/etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc',
}
file { 'passenger.repo GPG key':
ensure => file,
path => '/etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc',
require => Exec['passenger.repo GPG key'],
}
epel::rpm_gpg_key { 'passenger.stealthymonkeys.com':
path => '/etc/yum.repos.d/RPM-GPG-KEY-stealthymonkeys.asc',
require => [
Class['epel'],
],
}
class { 'apache::mod::passenger':
require => [
Yumrepo['passenger']
],
}
#{pp_rackapp}
EOS
apply_manifest(pp, :catch_failures => true)
end
File['passenger.repo GPG key'],
]
}
$releasever_string = $operatingsystem ? {
'Scientific' => '6',
default => '$releasever',
}
yumrepo { 'passenger':
baseurl => "http://passenger.stealthymonkeys.com/rhel/${releasever_string}/\\$basearch" ,
descr => "Red Hat Enterprise ${releasever_string} - Phusion Passenger",
enabled => 1,
gpgcheck => 1,
gpgkey => 'http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc',
mirrorlist => 'http://passenger.stealthymonkeys.com/rhel/mirrors',
require => [
Epel::Rpm_gpg_key['passenger.stealthymonkeys.com'],
],
}
/* apache and mod_passenger */
class { 'apache':
require => [
Class['epel'],
],
}
class { 'apache::mod::passenger':
require => [
Yumrepo['passenger']
],
}
#{pp_rackapp}
EOS
apply_manifest(pp, :catch_failures => true)
end

describe service(service_name) do
it { should be_enabled }
it { should be_running }
end
describe service(service_name) do
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 "PassengerTempDir #{passenger_tempdir}" }
end
describe file(conf_file) do
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
describe file(load_file) do
it { should contain "LoadModule passenger_module #{passenger_module_path}" }
end

it 'should output status via passenger-memory-stats' do
shell("/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/
it 'should output status via passenger-memory-stats' do
shell("/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
r.exit_code.should == 0
end
end
end

it 'should output status via passenger-status' do
shell("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]+/
it 'should output status via passenger-status' do
shell("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
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
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
end

end

end
end
44 changes: 24 additions & 20 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -814,29 +814,33 @@ class { 'apache': }

# Passenger isn't even in EPEL on el-5
if default['platform'] !~ /^el-5/
describe 'rack_base_uris' do
if fact('osfamily') == 'RedHat'
it 'adds epel' do
pp = "class { 'epel': }"
apply_manifest(pp, :catch_failures => true)
if fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') == '7'
pending('Since we don\'t have passenger on RHEL7 rack_base_uris tests will fail')
else
describe 'rack_base_uris' do
if fact('osfamily') == 'RedHat'
it 'adds epel' do
pp = "class { 'epel': }"
apply_manifest(pp, :catch_failures => true)
end
end
end

it 'applies cleanly' do
pp = <<-EOS
class { 'apache': }
host { 'test.server': ip => '127.0.0.1' }
apache::vhost { 'test.server':
docroot => '/tmp',
rack_base_uris => ['/test'],
}
EOS
apply_manifest(pp, :catch_failures => true)
end
it 'applies cleanly' do
pp = <<-EOS
class { 'apache': }
host { 'test.server': ip => '127.0.0.1' }
apache::vhost { 'test.server':
docroot => '/tmp',
rack_base_uris => ['/test'],
}
EOS
apply_manifest(pp, :catch_failures => true)
end

describe file("#{$vhost_dir}/25-test.server.conf") do
it { should be_file }
it { should contain 'RackBaseURI /test' }
describe file("#{$vhost_dir}/25-test.server.conf") do
it { should be_file }
it { should contain 'RackBaseURI /test' }
end
end
end
end
Expand Down

0 comments on commit d00631c

Please sign in to comment.