]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/classes/mod/prefork_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / classes / mod / prefork_spec.rb
1 require 'spec_helper'
2
3 describe 'apache::mod::prefork', :type => :class do
4   let :pre_condition do
5     'class { "apache": mpm_module => false, }'
6   end
7   context "on a Debian OS" do
8     let :facts do
9       {
10         :osfamily               => 'Debian',
11         :operatingsystemrelease => '6',
12         :concat_basedir         => '/dne',
13         :lsbdistcodename        => 'squeeze',
14         :operatingsystem        => 'Debian',
15         :id                     => 'root',
16         :kernel                 => 'Linux',
17         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
18         :is_pe                  => false,
19       }
20     end
21     it { is_expected.to contain_class("apache::params") }
22     it { is_expected.not_to contain_apache__mod('prefork') }
23     it { is_expected.to contain_file("/etc/apache2/mods-available/prefork.conf").with_ensure('file') }
24     it { is_expected.to contain_file("/etc/apache2/mods-enabled/prefork.conf").with_ensure('link') }
25
26     context "with Apache version < 2.4" do
27       let :params do
28         {
29           :apache_version => '2.2',
30         }
31       end
32
33       it { is_expected.not_to contain_file("/etc/apache2/mods-available/prefork.load") }
34       it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/prefork.load") }
35
36       it { is_expected.to contain_package("apache2-mpm-prefork") }
37     end
38
39     context "with Apache version >= 2.4" do
40       let :params do
41         {
42           :apache_version => '2.4',
43         }
44       end
45
46       it { is_expected.to contain_file("/etc/apache2/mods-available/prefork.load").with({
47         'ensure'  => 'file',
48         'content' => "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n"
49         })
50       }
51       it { is_expected.to contain_file("/etc/apache2/mods-enabled/prefork.load").with_ensure('link') }
52     end
53   end
54   context "on a RedHat OS" do
55     let :facts do
56       {
57         :osfamily               => 'RedHat',
58         :operatingsystemrelease => '6',
59         :concat_basedir         => '/dne',
60         :operatingsystem        => 'RedHat',
61         :id                     => 'root',
62         :kernel                 => 'Linux',
63         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
64         :is_pe                  => false,
65       }
66     end
67     it { is_expected.to contain_class("apache::params") }
68     it { is_expected.not_to contain_apache__mod('prefork') }
69     it { is_expected.to contain_file("/etc/httpd/conf.d/prefork.conf").with_ensure('file') }
70
71     context "with Apache version < 2.4" do
72       let :params do
73         {
74           :apache_version => '2.2',
75         }
76       end
77
78       it { is_expected.to contain_file_line("/etc/sysconfig/httpd prefork enable").with({
79         'require' => 'Package[httpd]',
80         })
81       }
82     end
83
84     context "with Apache version >= 2.4" do
85       let :params do
86         {
87           :apache_version => '2.4',
88         }
89       end
90
91       it { is_expected.not_to contain_apache__mod('event') }
92
93       it { is_expected.to contain_file("/etc/httpd/conf.d/prefork.load").with({
94         'ensure'  => 'file',
95         'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n",
96         })
97       }
98     end
99   end
100   context "on a FreeBSD OS" do
101     let :facts do
102       {
103         :osfamily               => 'FreeBSD',
104         :operatingsystemrelease => '9',
105         :concat_basedir         => '/dne',
106         :operatingsystem        => 'FreeBSD',
107         :id                     => 'root',
108         :kernel                 => 'FreeBSD',
109         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
110         :is_pe                  => false,
111       }
112     end
113     it { is_expected.to contain_class("apache::params") }
114     it { is_expected.not_to contain_apache__mod('prefork') }
115     it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/prefork.conf").with_ensure('file') }
116   end
117   context "on a Gentoo OS" do
118     let :facts do
119       {
120         :osfamily               => 'Gentoo',
121         :operatingsystem        => 'Gentoo',
122         :operatingsystemrelease => '3.16.1-gentoo',
123         :concat_basedir         => '/dne',
124         :id                     => 'root',
125         :kernel                 => 'Linux',
126         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
127         :is_pe                  => false,
128       }
129     end
130     it { is_expected.to contain_class("apache::params") }
131     it { is_expected.not_to contain_apache__mod('prefork') }
132     it { is_expected.to contain_file("/etc/apache2/modules.d/prefork.conf").with_ensure('file') }
133   end
134 end