Debian Codegraph @

spec/classes/ceph_init_spec.rb

raw
1 # Copyright (C) 2013, 2014 iWeb Technologies Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 # Author: David Moreau Simard <[email protected]>
16
17 require 'spec_helper'
18
19 describe 'ceph' do
20
21 shared_examples 'ceph' do
22 describe "with default params and specified fsid" do
23 let :params do
24 {
25 :fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b',
26 }
27 end
28
29 it { should contain_package('ceph').with(
30 'name' => 'ceph',
31 'ensure' => 'present') }
32
33 it { should contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') }
34 it { should_not contain_ceph_config('global/keyring').with_value('/etc/ceph/keyring') }
35 it { should_not contain_ceph_config('global/osd_pool_default_pg_num').with_value('128') }
36 it { should_not contain_ceph_config('global/osd_pool_default_pgp_num').with_value('128') }
37 it { should_not contain_ceph_config('global/osd_pool_default_size').with_value('3') }
38 it { should_not contain_ceph_config('global/osd_pool_default_min_size').with_value('2') }
39 it { should_not contain_ceph_config('global/osd_pool_default_crush_rule').with_value('0') }
40 it { should_not contain_ceph_config('global/osd_crush_update_on_start').with_value(false) }
41 it { should_not contain_ceph_config('global/mon_osd_full_ratio').with_value('90') }
42 it { should_not contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('85') }
43 it { should_not contain_ceph_config('global/mon_initial_members').with_value('mon.01') }
44 it { should_not contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') }
45 it { should_not contain_ceph_config('global/ms_bind_ipv6').with_value('false') }
46 it { should_not contain_ceph_config('global/require_signatures').with_value('false') }
47 it { should_not contain_ceph_config('global/cluster_require_signatures').with_value('false') }
48 it { should_not contain_ceph_config('global/service_require_signatures').with_value('false') }
49 it { should_not contain_ceph_config('global/sign_messages').with_value('true') }
50 it { should_not contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') }
51 it { should_not contain_ceph_config('global/public_network').with_value('192.168.0.0/24') }
52 it { should_not contain_ceph_config('global/public_addr').with_value('192.168.0.2') }
53 it { should_not contain_ceph_config('osd/osd_journal_size').with_value('4096') }
54 it { should_not contain_ceph_config('client/rbd_default_features').with_value('15') }
55 it { should contain_ceph_config('global/auth_cluster_required').with_value('cephx') }
56 it { should contain_ceph_config('global/auth_service_required').with_value('cephx') }
57 it { should contain_ceph_config('global/auth_client_required').with_value('cephx') }
58 it { should contain_ceph_config('global/auth_supported').with_value('cephx') }
59 it { should_not contain_ceph_config('global/auth_cluster_required').with_value('none') }
60 it { should_not contain_ceph_config('global/auth_service_required').with_value('none') }
61 it { should_not contain_ceph_config('global/auth_client_required').with_value('none') }
62 it { should_not contain_ceph_config('global/auth_supported').with_value('none') }
63 end
64
65 describe "with custom params and specified fsid" do
66 let :params do
67 {
68 :fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b',
69 :authentication_type => 'none',
70 :keyring => '/usr/local/ceph/etc/keyring',
71 :osd_journal_size => '1024',
72 :osd_max_object_name_len => '1024',
73 :osd_max_object_namespace_len => '256',
74 :osd_pool_default_pg_num => '256',
75 :osd_pool_default_pgp_num => '256',
76 :osd_pool_default_size => '2',
77 :osd_pool_default_min_size => '1',
78 :osd_pool_default_crush_rule => '10',
79 :osd_crush_update_on_start => false,
80 :mon_osd_full_ratio => '95',
81 :mon_osd_nearfull_ratio => '90',
82 :mon_initial_members => 'mon.01',
83 :mon_host => 'mon01.ceph, mon02.ceph',
84 :ms_bind_ipv6 => 'true',
85 :require_signatures => 'true',
86 :cluster_require_signatures => 'true',
87 :service_require_signatures => 'true',
88 :sign_messages => 'false',
89 :cluster_network => '10.0.0.0/24',
90 :public_network => '192.168.0.0/24',
91 :public_addr => '192.168.0.2',
92 :set_osd_params => 'true',
93 :osd_max_backfills => '1',
94 :osd_recovery_max_active => '1',
95 :osd_recovery_op_priority => '1',
96 :osd_recovery_max_single_start => '1',
97 :osd_max_scrubs => '1',
98 :osd_op_threads => '2',
99 :rbd_default_features => '12',
100 }
101 end
102
103 it { should contain_package('ceph').with(
104 'name' => 'ceph',
105 'ensure' => 'present') }
106
107 it { should contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') }
108 it { should contain_ceph_config('global/keyring').with_value('/usr/local/ceph/etc/keyring') }
109 it { should contain_ceph_config('global/osd_max_object_name_len').with_value('1024') }
110 it { should contain_ceph_config('global/osd_max_object_namespace_len').with_value('256') }
111 it { should contain_ceph_config('global/osd_pool_default_pg_num').with_value('256') }
112 it { should contain_ceph_config('global/osd_pool_default_pgp_num').with_value('256') }
113 it { should contain_ceph_config('global/osd_pool_default_size').with_value('2') }
114 it { should contain_ceph_config('global/osd_pool_default_min_size').with_value('1') }
115 it { should contain_ceph_config('global/osd_pool_default_crush_rule').with_value('10') }
116 it { should contain_ceph_config('global/osd_crush_update_on_start').with_value(false) }
117 it { should contain_ceph_config('global/mon_osd_full_ratio').with_value('95') }
118 it { should contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('90') }
119 it { should contain_ceph_config('global/mon_initial_members').with_value('mon.01') }
120 it { should contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') }
121 it { should contain_ceph_config('global/ms_bind_ipv6').with_value('true') }
122 it { should contain_ceph_config('global/require_signatures').with_value('true') }
123 it { should contain_ceph_config('global/cluster_require_signatures').with_value('true') }
124 it { should contain_ceph_config('global/service_require_signatures').with_value('true') }
125 it { should contain_ceph_config('global/sign_messages').with_value('false') }
126 it { should contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') }
127 it { should contain_ceph_config('global/public_network').with_value('192.168.0.0/24') }
128 it { should contain_ceph_config('global/public_addr').with_value('192.168.0.2') }
129 it { should contain_ceph_config('osd/osd_journal_size').with_value('1024') }
130 it { should contain_ceph_config('client/rbd_default_features').with_value('12') }
131 it { should_not contain_ceph_config('global/auth_cluster_required').with_value('cephx') }
132 it { should_not contain_ceph_config('global/auth_service_required').with_value('cephx') }
133 it { should_not contain_ceph_config('global/auth_client_required').with_value('cephx') }
134 it { should_not contain_ceph_config('global/auth_supported').with_value('cephx') }
135 it { should contain_ceph_config('global/auth_cluster_required').with_value('none') }
136 it { should contain_ceph_config('global/auth_service_required').with_value('none') }
137 it { should contain_ceph_config('global/auth_client_required').with_value('none') }
138 it { should contain_ceph_config('global/auth_supported').with_value('none') }
139 it { should contain_ceph_config('osd/osd_max_backfills').with_value('1') }
140 it { should contain_ceph_config('osd/osd_recovery_max_active').with_value('1') }
141 it { should contain_ceph_config('osd/osd_recovery_op_priority').with_value('1') }
142 it { should contain_ceph_config('osd/osd_recovery_max_single_start').with_value('1') }
143 it { should contain_ceph_config('osd/osd_max_scrubs').with_value('1') }
144 it { should contain_ceph_config('osd/osd_op_threads').with_value('2') }
145 end
146 end
147
148 on_supported_os({
149 :supported_os => OSDefaults.get_supported_os
150 }).each do |os,facts|
151 context "on #{os}" do
152 let (:facts) do
153 facts.merge!(OSDefaults.get_facts())
154 end
155
156 it_behaves_like 'ceph'
157 end
158 end
159
160 end