forked from puppetlabs/puppetlabs-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastcgi_server_spec.rb
156 lines (154 loc) · 5.46 KB
/
fastcgi_server_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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
require 'spec_helper'
describe 'apache::fastcgi::server', :type => :define do
let :pre_condition do
'include apache'
end
let :title do
'www'
end
describe 'os-dependent items' do
context "on RedHat based systems" do
let :default_facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '6',
:kernel => 'Linux',
:id => 'root',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:is_pe => false,
}
end
let :facts do default_facts end
it { should contain_class("apache") }
it { should contain_class("apache::mod::fastcgi") }
it { should contain_file("fastcgi-pool-#{title}.conf").with(
:ensure => 'present',
:path => "/etc/httpd/conf.d/fastcgi-pool-#{title}.conf"
) }
end
context "on Debian based systems" do
let :default_facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:lsbdistcodename => 'squeeze',
:kernel => 'Linux',
:id => 'root',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:is_pe => false,
}
end
let :facts do default_facts end
it { should contain_class("apache") }
it { should contain_class("apache::mod::fastcgi") }
it { should contain_file("fastcgi-pool-#{title}.conf").with(
:ensure => 'present',
:path => "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf"
) }
end
context "on FreeBSD systems" do
let :default_facts do
{
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
:kernel => 'FreeBSD',
:id => 'root',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:is_pe => false,
}
end
let :facts do default_facts end
it { should contain_class("apache") }
it { should contain_class("apache::mod::fastcgi") }
it { should contain_file("fastcgi-pool-#{title}.conf").with(
:ensure => 'present',
:path => "/usr/local/etc/apache24/Includes/fastcgi-pool-#{title}.conf"
) }
end
context "on Gentoo systems" do
let :default_facts do
{
:osfamily => 'Gentoo',
:operatingsystem => 'Gentoo',
:operatingsystemrelease => '3.16.1-gentoo',
:concat_basedir => '/dne',
:kernel => 'Linux',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
:is_pe => false,
}
end
let :facts do default_facts end
it { should contain_class("apache") }
it { should contain_class("apache::mod::fastcgi") }
it { should contain_file("fastcgi-pool-#{title}.conf").with(
:ensure => 'present',
:path => "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf"
) }
end
end
describe 'os-independent items' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:lsbdistcodename => 'squeeze',
:kernel => 'Linux',
:id => 'root',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:is_pe => false,
}
end
describe ".conf content using TCP communication" do
let :params do
{
:host => '127.0.0.1:9001',
:timeout => 30,
:flush => true,
:faux_path => '/var/www/php-www.fcgi',
:fcgi_alias => '/php-www.fcgi',
:file_type => 'application/x-httpd-php',
:pass_header => 'Authorization'
}
end
let :expected do
'FastCGIExternalServer /var/www/php-www.fcgi -idle-timeout 30 -flush -host 127.0.0.1:9001 -pass-header Authorization
Alias /php-www.fcgi /var/www/php-www.fcgi
Action application/x-httpd-php /php-www.fcgi
'
end
it do
should contain_file("fastcgi-pool-www.conf").with_content(expected)
end
end
describe ".conf content using socket communication" do
let :params do
{
:host => '/var/run/fcgi.sock',
:timeout => 30,
:flush => true,
:faux_path => '/var/www/php-www.fcgi',
:fcgi_alias => '/php-www.fcgi',
:file_type => 'application/x-httpd-php'
}
end
let :expected do
'FastCGIExternalServer /var/www/php-www.fcgi -idle-timeout 30 -flush -socket /var/run/fcgi.sock
Alias /php-www.fcgi /var/www/php-www.fcgi
Action application/x-httpd-php /php-www.fcgi
'
end
it do
should contain_file("fastcgi-pool-www.conf").with_content(expected)
end
end
end
end