Debian Codegraph @

spec/defines/ceph_rgw_civetweb_spec.rb

raw
1 #
2 # Copyright (C) 2016 Keith Schincke
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: Keith Schincke <[email protected]>
17 #
18 require 'spec_helper'
19
20 describe 'ceph::rgw' do
21 let :pre_condition do
22 'include ceph::params'
23 end
24
25 shared_examples 'ceph rgw civetweb' do
26 describe "activated with civetweb params" do
27 let :title do
28 'radosgw.civetweb'
29 end
30
31 let :params do
32 {
33 :frontend_type => 'civetweb',
34 }
35 end
36
37 it { should contain_ceph_config('client.radosgw.civetweb/user').with_value("#{platform_params[:user]}") }
38 it { should contain_ceph_config('client.radosgw.civetweb/host').with_value('myhost') }
39 it { should contain_ceph_config('client.radosgw.civetweb/keyring').with_value('/etc/ceph/ceph.client.radosgw.civetweb.keyring') }
40 it { should contain_ceph_config('client.radosgw.civetweb/log_file').with_value('/var/log/ceph/radosgw.log') }
41 it { should contain_ceph_config('client.radosgw.civetweb/rgw_frontends').with_value('civetweb port=7480') }
42 it { should contain_ceph_config('client.radosgw.civetweb/rgw_dns_name').with_value('myhost.domain') }
43 it { should contain_ceph_config('client.radosgw.civetweb/rgw_swift_url').with_value('http://myhost.domain:7480') }
44 end
45
46 describe "activated with custom civetweb params" do
47 let :title do
48 'radosgw.custom'
49 end
50
51 let :params do
52 {
53 :frontend_type => 'civetweb',
54 :rgw_frontends => 'civetweb port=7481',
55 :user => 'root',
56 :rgw_dns_name => 'mydns.hostname',
57 :rgw_swift_url => 'https://mydns.hostname:443'
58 }
59 end
60
61 it { should contain_ceph_config('client.radosgw.custom/rgw_frontends').with_value('civetweb port=7481') }
62 it { should contain_ceph_config('client.radosgw.custom/user').with_value('root') }
63 it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
64 it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') }
65 it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') }
66 it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') }
67 it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url').with_value('https://mydns.hostname:443') }
68 end
69 end
70
71 on_supported_os({
72 :supported_os => OSDefaults.get_supported_os
73 }).each do |os,facts|
74 context "on #{os}" do
75 let (:facts) do
76 facts.merge!(OSDefaults.get_facts({
77 :concat_basedir => '/var/lib/puppet/concat',
78 :fqdn => 'myhost.domain',
79 :hostname => 'myhost',
80 }))
81 end
82
83 let :platform_params do
84 case facts[:osfamily]
85 when 'Debian'
86 {
87 :pkg_radosgw => 'radosgw',
88 :user => 'www-data',
89 }
90 when 'RedHat'
91 {
92 :pkg_radosgw => 'ceph-radosgw',
93 :user => 'apache',
94 }
95 end
96 end
97
98 it_behaves_like 'ceph rgw civetweb'
99 end
100 end
101 end