Skip to content

Commit

Permalink
Merge pull request #1032 from cyberious/SuPhpFixed
Browse files Browse the repository at this point in the history
Fixed an order of operations issue in the test that caused some weird behavior when apache would delay or not restart and added a check with timeout to ensure proper wait
  • Loading branch information
Morgan Haskel committed Feb 19, 2015
2 parents cd4b1aa + 7f97336 commit 1491619
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions spec/acceptance/mod_suphp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@
context "default suphp config" do
it 'succeeds in puppeting suphp' do
pp = <<-EOS
class { 'apache':
mpm_module => 'prefork',
}
class { 'apache::mod::php': }
class { 'apache::mod::suphp': }
apache::vhost { 'suphp.example.com':
port => '80',
docroot => '/var/www/suphp',
}
host { 'suphp.example.com': ip => '127.0.0.1', }
file { '/var/www/suphp/index.php':
ensure => file,
owner => 'daemon',
group => 'daemon',
content => "<?php echo get_current_user(); ?>\\n",
}
class { 'apache':
mpm_module => 'prefork',
}
host { 'suphp.example.com': ip => '127.0.0.1', }
apache::vhost { 'suphp.example.com':
port => '80',
docroot => '/var/www/suphp',
}
file { '/var/www/suphp/index.php':
ensure => file,
owner => 'daemon',
group => 'daemon',
content => "<?php echo get_current_user(); ?>\\n",
require => File['/var/www/suphp'],
before => Class['apache::mod::php'],
}
class { 'apache::mod::php': }
class { 'apache::mod::suphp': }
EOS
apply_manifest(pp, :catch_failures => true)
end
Expand All @@ -36,7 +38,11 @@ class { 'apache::mod::suphp': }
loop do
r = shell('curl suphp.example.com:80')
timeout += 1
break if timeout > 20 || r.stdout =~ /^daemon$/
break if r.stdout =~ /^daemon$/
if timeout > 40
expect(timeout < 40).to be true
break
end
sleep(1)
end
shell("/usr/bin/curl suphp.example.com:80") do |r|
Expand Down

0 comments on commit 1491619

Please sign in to comment.