]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/defines/fastcgi_server_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / defines / fastcgi_server_spec.rb
1 require 'spec_helper'
2
3 describe 'apache::fastcgi::server', :type => :define do
4   let :pre_condition do
5     'include apache'
6   end
7   let :title do
8     'www'
9   end
10   describe 'os-dependent items' do
11     context "on RedHat based systems" do
12       let :default_facts do
13         {
14           :osfamily               => 'RedHat',
15           :operatingsystem        => 'CentOS',
16           :operatingsystemrelease => '6',
17           :kernel                 => 'Linux',
18           :id                     => 'root',
19           :concat_basedir         => '/dne',
20           :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
21           :is_pe                  => false,
22         }
23       end
24       let :facts do default_facts end
25       it { should contain_class("apache") }
26       it { should contain_class("apache::mod::fastcgi") }
27       it { should contain_file("fastcgi-pool-#{title}.conf").with(
28         :ensure => 'present',
29         :path => "/etc/httpd/conf.d/fastcgi-pool-#{title}.conf"
30       ) }
31     end
32     context "on Debian based systems" do
33       let :default_facts do
34         {
35           :osfamily               => 'Debian',
36           :operatingsystem        => 'Debian',
37           :operatingsystemrelease => '6',
38           :lsbdistcodename        => 'squeeze',
39           :kernel                 => 'Linux',
40           :id                     => 'root',
41           :concat_basedir         => '/dne',
42           :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
43           :is_pe                  => false,
44         }
45       end
46       let :facts do default_facts end
47       it { should contain_class("apache") }
48       it { should contain_class("apache::mod::fastcgi") }
49       it { should contain_file("fastcgi-pool-#{title}.conf").with(
50         :ensure => 'present',
51         :path   => "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf"
52       ) }
53     end
54     context "on FreeBSD systems" do
55       let :default_facts do
56         {
57           :osfamily               => 'FreeBSD',
58           :operatingsystem        => 'FreeBSD',
59           :operatingsystemrelease => '9',
60           :kernel                 => 'FreeBSD',
61           :id                     => 'root',
62           :concat_basedir         => '/dne',
63           :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
64           :is_pe                  => false,
65         }
66       end
67       let :facts do default_facts end
68       it { should contain_class("apache") }
69       it { should contain_class("apache::mod::fastcgi") }
70       it { should contain_file("fastcgi-pool-#{title}.conf").with(
71         :ensure => 'present',
72         :path   => "/usr/local/etc/apache24/Includes/fastcgi-pool-#{title}.conf"
73       ) }
74     end
75     context "on Gentoo systems" do
76       let :default_facts do
77         {
78           :osfamily               => 'Gentoo',
79           :operatingsystem        => 'Gentoo',
80           :operatingsystemrelease => '3.16.1-gentoo',
81           :concat_basedir         => '/dne',
82           :kernel                 => 'Linux',
83           :id                     => 'root',
84           :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
85           :is_pe                  => false,
86         }
87       end
88       let :facts do default_facts end
89       it { should contain_class("apache") }
90       it { should contain_class("apache::mod::fastcgi") }
91       it { should contain_file("fastcgi-pool-#{title}.conf").with(
92         :ensure => 'present',
93         :path   => "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf"
94       ) }
95     end
96   end
97   describe 'os-independent items' do
98     let :facts do
99       {
100         :osfamily               => 'Debian',
101         :operatingsystem        => 'Debian',
102         :operatingsystemrelease => '6',
103         :lsbdistcodename        => 'squeeze',
104         :kernel                 => 'Linux',
105         :id                     => 'root',
106         :concat_basedir         => '/dne',
107         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
108         :is_pe                  => false,
109       }
110     end
111     describe ".conf content" do
112       let :params do
113         {
114           :host       => '127.0.0.1:9001',
115           :timeout    => 30,
116           :flush      => true,
117           :faux_path  => '/var/www/php-www.fcgi',
118           :fcgi_alias => '/php-www.fcgi',
119           :file_type  => 'application/x-httpd-php'
120         }
121       end
122       let :expected do
123 'FastCGIExternalServer /var/www/php-www.fcgi -idle-timeout 30 -flush -host 127.0.0.1:9001
124 Alias /php-www.fcgi /var/www/php-www.fcgi
125 Action application/x-httpd-php /php-www.fcgi
126 '
127       end
128       it do
129         should contain_file("fastcgi-pool-www.conf").with_content(expected)
130       end
131     end
132   end
133 end