]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/acceptance/mod_suphp_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / acceptance / mod_suphp_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'apache::mod::suphp class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
4   case fact('operatingsystem')
5     when 'Ubuntu'
6       context "default suphp config" do
7         it 'succeeds in puppeting suphp' do
8           pp = <<-EOS
9 class { 'apache':
10   mpm_module => 'prefork',
11 }
12 host { 'suphp.example.com': ip => '127.0.0.1', }
13 apache::vhost { 'suphp.example.com':
14   port    => '80',
15   docroot => '/var/www/suphp',
16 }
17 file { '/var/www/suphp/index.php':
18   ensure  => file,
19   owner   => 'daemon',
20   group   => 'daemon',
21   content => "<?php echo get_current_user(); ?>\\n",
22   require => File['/var/www/suphp'],
23   before  => Class['apache::mod::php'],
24 }
25 class { 'apache::mod::php': }
26 class { 'apache::mod::suphp': }
27           EOS
28           apply_manifest(pp, :catch_failures => true)
29         end
30
31         describe service('apache2') do
32           it { is_expected.to be_enabled }
33           it { is_expected.to be_running }
34         end
35
36         it 'should answer to suphp.example.com' do
37           timeout = 0
38           loop do
39             r = shell('curl suphp.example.com:80')
40             timeout += 1
41             break if r.stdout =~ /^daemon$/
42             if timeout > 40
43               expect(timeout < 40).to be true
44               break
45             end
46             sleep(1)
47           end
48           shell("/usr/bin/curl suphp.example.com:80") do |r|
49             expect(r.stdout).to match(/^daemon$/)
50             expect(r.exit_code).to eq(0)
51           end
52         end
53       end
54   end
55 end