]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/acceptance/mod_fcgid_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / acceptance / mod_fcgid_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'apache::mod::fcgid class', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) or (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7')) do
4   context "default fcgid config", :if => (fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') != '5') do
5     it 'succeeds in puppeting fcgid' do
6       pp = <<-EOS
7         class { 'epel': } # mod_fcgid lives in epel
8         class { 'apache': }
9         class { 'apache::mod::php': } # For /usr/bin/php-cgi
10         class { 'apache::mod::fcgid':
11           options => {
12             'FcgidIPCDir'  => '/var/run/fcgidsock',
13           },
14         }
15         apache::vhost { 'fcgid.example.com':
16           port        => '80',
17           docroot     => '/var/www/fcgid',
18           directories => {
19             path        => '/var/www/fcgid',
20             options     => '+ExecCGI',
21             addhandlers => {
22               handler    => 'fcgid-script',
23               extensions => '.php',
24             },
25             fcgiwrapper => {
26               command => '/usr/bin/php-cgi',
27               suffix  => '.php',
28             }
29           },
30         }
31         file { '/var/www/fcgid/index.php':
32           ensure  => file,
33           owner   => 'root',
34           group   => 'root',
35           content => "<?php echo 'Hello world'; ?>\\n",
36         }
37       EOS
38       apply_manifest(pp, :catch_failures => true)
39     end
40
41     describe service('httpd') do
42       it { is_expected.to be_enabled }
43       it { is_expected.to be_running }
44     end
45
46     it 'should answer to fcgid.example.com' do
47       shell("/usr/bin/curl -H 'Host: fcgid.example.com' 127.0.0.1:80") do |r|
48         expect(r.stdout).to match(/^Hello world$/)
49         expect(r.exit_code).to eq(0)
50       end
51     end
52
53     it 'should run a php-cgi process' do
54       shell("pgrep -u apache php-cgi", :acceptable_exit_codes => [0])
55     end
56   end
57 end