view modules/apache/spec/acceptance/mod_suphp_spec.rb @ 121:6709f2052217 puppet-3.6

Add eBay to Postscreen whitelist
author IBBoard <dev@ibboard.co.uk>
date Fri, 02 Sep 2016 13:40:26 +0100
parents 37675581a273
children 675c1cc61eaf
line wrap: on
line source

require 'spec_helper_acceptance'

describe 'apache::mod::suphp class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
  case fact('osfamily')
  when 'Debian'
    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",
          }
        EOS
        apply_manifest(pp, :catch_failures => true)
      end

      describe service('apache2') do
        it { is_expected.to be_enabled }
        it { is_expected.to be_running }
      end

      it 'should answer to suphp.example.com' do
        shell("/bin/sleep 10")
        shell("/usr/bin/curl suphp.example.com:80") do |r|
          expect(r.stdout).to match(/^daemon$/)
          expect(r.exit_code).to eq(0)
        end
      end
    end
  when 'RedHat'
    # Not implemented yet
  end
end