forked from puppetlabs/puppetlabs-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_suphp_spec.rb
61 lines (58 loc) · 1.82 KB
/
mod_suphp_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require 'spec_helper_acceptance'
describe 'apache::mod::suphp class', if: (fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemmajrelease') != '16.04') do
context 'default suphp config' do
# rubocop:disable Layout/IndentHeredoc : Manifest must have zero base indents
pp = <<-MANIFEST
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': }
MANIFEST
# rubocop:enable Layout/IndentHeredoc
it 'succeeds in puppeting suphp' do
apply_manifest(pp, catch_failures: true)
end
describe service('apache2') do
if fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8'
pending 'Should be enabled - Bug 760616 on Debian 8'
else
it { is_expected.to be_enabled }
end
it { is_expected.to be_running }
end
it 'answers to suphp.example.com #timeout' do
timeout = 0
loop do
r = shell('curl suphp.example.com:80')
timeout += 1
break if r.stdout =~ %r{^daemon$}
break expect(timeout < 40).to be true if timeout > 40
sleep(1)
end
end
it 'answers to suphp.example.com #stdout' do
shell('/usr/bin/curl suphp.example.com:80') do |r|
expect(r.stdout).to match(%r{^daemon$})
end
end
it 'answers to suphp.example.com #exit_code' do
shell('/usr/bin/curl suphp.example.com:80') do |r|
expect(r.exit_code).to eq(0)
end
end
end
end