]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/classes/mod/fcgid_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / classes / mod / fcgid_spec.rb
1 require 'spec_helper'
2
3 describe 'apache::mod::fcgid', :type => :class do
4   let :pre_condition do
5     'include apache'
6   end
7
8   context "on a Debian OS" do
9     let :facts do
10       {
11         :osfamily                  => 'Debian',
12         :operatingsystemrelease    => '6',
13         :operatingsystemmajrelease => '6',
14         :concat_basedir            => '/dne',
15         :lsbdistcodename           => 'squeeze',
16         :operatingsystem           => 'Debian',
17         :id                        => 'root',
18         :kernel                    => 'Linux',
19         :path                      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
20         :is_pe                  => false,
21       }
22     end
23     it { is_expected.to contain_class("apache::params") }
24     it { is_expected.to contain_apache__mod('fcgid') }
25     it { is_expected.to contain_package("libapache2-mod-fcgid") }
26   end
27
28   context "on a RedHat OS" do
29     let :facts do
30       {
31         :osfamily                  => 'RedHat',
32         :operatingsystemrelease    => '6',
33         :operatingsystemmajrelease => '6',
34         :concat_basedir            => '/dne',
35         :operatingsystem           => 'RedHat',
36         :id                        => 'root',
37         :kernel                    => 'Linux',
38         :path                      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
39         :is_pe                  => false,
40       }
41     end
42
43     describe 'without parameters' do
44       it { is_expected.to contain_class("apache::params") }
45       it { is_expected.to contain_apache__mod('fcgid') }
46       it { is_expected.to contain_package("mod_fcgid") }
47     end
48
49     describe 'with parameters' do
50       let :params do {
51         :options                     => {
52           'FcgidIPCDir'               => '/var/run/fcgidsock',
53           'SharememPath'              => '/var/run/fcgid_shm',
54           'FcgidMinProcessesPerClass' => '0',
55           'AddHandler'                => 'fcgid-script .fcgi',
56         }
57       } end
58
59       it 'should contain the correct config' do
60         content = catalogue.resource('file', 'fcgid.conf').send(:parameters)[:content]
61         expect(content.split("\n").reject { |c| c =~ /(^#|^$)/ }).to eq([
62           '<IfModule mod_fcgid.c>',
63           '  AddHandler fcgid-script .fcgi',
64           '  FcgidIPCDir /var/run/fcgidsock',
65           '  FcgidMinProcessesPerClass 0',
66           '  SharememPath /var/run/fcgid_shm',
67           '</IfModule>',
68         ])
69       end
70     end
71   end
72
73   context "on RHEL7" do
74     let :facts do
75       {
76         :osfamily                  => 'RedHat',
77         :operatingsystemrelease    => '7',
78         :operatingsystemmajrelease => '7',
79         :concat_basedir            => '/dne',
80         :operatingsystem           => 'RedHat',
81         :id                        => 'root',
82         :kernel                    => 'Linux',
83         :path                      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
84         :is_pe                  => false,
85       }
86     end
87
88     describe 'without parameters' do
89       it { is_expected.to contain_class("apache::params") }
90       it { is_expected.to contain_apache__mod('fcgid').with({
91         'loadfile_name' => 'unixd_fcgid.load'
92       })
93       }
94       it { is_expected.to contain_package("mod_fcgid") }
95     end
96   end
97
98   context "on a FreeBSD OS" do
99     let :facts do
100       {
101         :osfamily                  => 'FreeBSD',
102         :operatingsystemrelease    => '9',
103         :operatingsystemmajrelease => '9',
104         :concat_basedir            => '/dne',
105         :operatingsystem           => 'FreeBSD',
106         :id                        => 'root',
107         :kernel                    => 'FreeBSD',
108         :path                      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
109         :is_pe                  => false,
110       }
111     end
112
113     it { is_expected.to contain_class("apache::params") }
114     it { is_expected.to contain_apache__mod('fcgid') }
115     it { is_expected.to contain_package("www/mod_fcgid") }
116   end
117
118   context "on a Gentoo OS" do
119     let :facts do
120       {
121         :osfamily                  => 'Gentoo',
122         :operatingsystem           => 'Gentoo',
123         :operatingsystemrelease    => '3.16.1-gentoo',
124         :concat_basedir            => '/dne',
125         :id                        => 'root',
126         :kernel                    => 'Linux',
127         :path                      => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
128         :is_pe                  => false,
129       }
130     end
131
132     it { is_expected.to contain_class("apache::params") }
133     it { is_expected.to contain_apache__mod('fcgid') }
134     it { is_expected.to contain_package("www-apache/mod_fcgid") }
135   end
136 end