Debian Codegraph @

spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb

raw
1 #
2 # Copyright (C) 2014 Catalyst IT Limited.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Author: Ricardo Rocha <[email protected]>
17 # Author: David Gurtner <[email protected]>
18 # Author: Oleksiy Molchanov <[email protected]>
19 #
20 require 'spec_helper'
21
22 describe 'ceph::rgw::apache_proxy_fcgi' do
23 shared_examples 'ceph::rgw::apache_proxy_fcgi on Debian' do
24 before do
25 facts.merge!( :operatingsystem => 'Ubuntu',
26 :lsbdistid => 'Ubuntu',
27 :operatingsystemrelease => '14.04',
28 :lsbdistcodename => 'trusty' )
29 end
30
31 context 'activated with default params' do
32 let :title do
33 'radosgw.gateway'
34 end
35
36 it { should contain_apache__vhost('myhost.domain-radosgw').with(
37 :servername => 'myhost.domain',
38 :serveradmin => 'root@localhost',
39 :port => 80,
40 :docroot => '/var/www',
41 :access_log => true,
42 :error_log => true,
43 :rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
44 :setenv => 'proxy-nokeepalive 1',
45 :proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
46 )}
47
48 it { should contain_class('apache').with(
49 :default_mods => false,
50 :default_vhost => false,
51 :purge_configs => true,
52 :purge_vhost_dir => true,
53 )}
54
55 it { should contain_class('apache::mod::alias') }
56 it { should contain_class('apache::mod::auth_basic') }
57 it { should contain_class('apache::mod::env') }
58 it { should contain_class('apache::mod::proxy') }
59 it { should contain_class('apache::mod::mime') }
60 it { should contain_class('apache::mod::rewrite') }
61 end
62
63 context 'activated with custom params' do
64 let :title do
65 'myid'
66 end
67
68 let :params do
69 {
70 :rgw_dns_name => 'mydns.hostname',
71 :rgw_port => 1111,
72 :admin_email => 'admin@hostname',
73 :syslog => false,
74 :proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
75 :apache_mods => true,
76 :apache_vhost => true,
77 :apache_purge_configs => false,
78 :apache_purge_vhost => false,
79 :custom_apache_ports => '8888',
80 }
81 end
82
83 it { should contain_class('apache').with(
84 :default_mods => true,
85 :default_vhost => true,
86 :purge_configs => false,
87 :purge_vhost_dir => false,
88 )}
89
90 it { should contain_apache__listen('8888') }
91
92 it { should contain_apache__vhost('mydns.hostname-radosgw').with(
93 :servername => 'mydns.hostname',
94 :serveradmin => 'admin@hostname',
95 :port => 1111,
96 :docroot => '/var/www',
97 :access_log => false,
98 :error_log => false,
99 :rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
100 :setenv => 'proxy-nokeepalive 1',
101 :proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
102 )}
103
104 it { should contain_class('apache::mod::alias') }
105 it { should contain_class('apache::mod::proxy') }
106 it { should contain_class('apache::mod::mime') }
107 it { should contain_class('apache::mod::rewrite') }
108 end
109 end
110
111 shared_examples 'ceph::rgw::apache_proxy_fcgi on RedHat' do
112 before do
113 facts.merge!( :operatingsystem => 'RedHat',
114 :operatingsystemrelease => '7.2',
115 :operatingsystemmajrelease => '7' )
116 end
117
118 context 'activated with default params' do
119 let :title do
120 'radosgw.gateway'
121 end
122
123 it { should contain_apache__vhost('myhost.domain-radosgw').with(
124 :servername => 'myhost.domain',
125 :serveradmin => 'root@localhost',
126 :port => 80,
127 :docroot => '/var/www',
128 :access_log => true,
129 :error_log => true,
130 :rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
131 :setenv => 'proxy-nokeepalive 1',
132 :proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
133 )}
134
135 it { should contain_class('apache').with(
136 :default_mods => false,
137 :default_vhost => false,
138 :purge_configs => true,
139 :purge_vhost_dir => true,
140 )}
141
142 it { should contain_class('apache::mod::alias') }
143 it { should contain_class('apache::mod::auth_basic') }
144 it { should contain_class('apache::mod::env') }
145 it { should contain_class('apache::mod::proxy') }
146 it { should contain_class('apache::mod::mime') }
147 it { should contain_class('apache::mod::rewrite') }
148 end
149
150 context 'activated with custom params' do
151 let :title do
152 'myid'
153 end
154
155 let :params do
156 {
157 :rgw_dns_name => 'mydns.hostname',
158 :rgw_port => 1111,
159 :admin_email => 'admin@hostname',
160 :syslog => false,
161 :proxy_pass => {'path'=>'/', 'url'=>'fcgi://127.0.0.1:9999/'},
162 :apache_mods => true,
163 :apache_vhost => true,
164 :apache_purge_configs => false,
165 :apache_purge_vhost => false,
166 :custom_apache_ports => '8888',
167 }
168 end
169
170 it { should contain_class('apache').with(
171 :default_mods => true,
172 :default_vhost => true,
173 :purge_configs => false,
174 :purge_vhost_dir => false,
175 )}
176
177 it { should contain_apache__listen('8888') }
178
179 it { should contain_apache__vhost('mydns.hostname-radosgw').with(
180 :servername => 'mydns.hostname',
181 :serveradmin => 'admin@hostname',
182 :port => 1111,
183 :docroot => '/var/www',
184 :access_log => false,
185 :error_log => false,
186 :rewrite_rule => '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
187 :setenv => 'proxy-nokeepalive 1',
188 :proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
189 )}
190
191 it { should contain_class('apache::mod::alias') }
192 it { should contain_class('apache::mod::proxy') }
193 it { should contain_class('apache::mod::mime') }
194 it { should contain_class('apache::mod::rewrite') }
195 end
196 end
197
198 on_supported_os({
199 :supported_os => OSDefaults.get_supported_os
200 }).each do |os,facts|
201 context "on #{os}" do
202 let (:facts) do
203 facts.merge!(OSDefaults.get_facts( :concat_basedir => '/var/lib/puppet/concat',
204 :fqdn => 'myhost.domain',
205 :hostname => 'myhost' ))
206 end
207
208 it_behaves_like "ceph::rgw::apache_proxy_fcgi on #{facts[:osfamily]}"
209 end
210 end
211 end