| 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::mds' do |
| 20 |
|
| 21 |
shared_examples 'ceph mds' do |
| 22 |
describe "activated with default params" do |
| 23 |
|
| 24 |
it { should contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/ceph-myhostname') } |
| 25 |
it { should contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/ceph-myhostname/keyring') } |
| 26 |
it { should contain_package('ceph-mds').with('ensure' => 'present') } |
| 27 |
end |
| 28 |
|
| 29 |
describe "activated with custom params" do |
| 30 |
let :params do |
| 31 |
{ |
| 32 |
:public_addr => '1.2.3.4', |
| 33 |
:mds_id => 'mymds', |
| 34 |
:mds_data => '/usr/local/ceph/var/lib/mds/_cluster-_id', |
| 35 |
:keyring => '/usr/local/ceph/var/lib/mds/_cluster-_id/keyring' |
| 36 |
} |
| 37 |
end |
| 38 |
|
| 39 |
it { should contain_ceph_config('mds/mds_data').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id') } |
| 40 |
it { should contain_ceph_config('mds/keyring').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id/keyring') } |
| 41 |
it { should contain_package('ceph-mds').with('ensure' => 'present') } |
| 42 |
it { |
| 43 |
should contain_service('ceph-mds@mymds').with('ensure' => 'running') |
| 44 |
} |
| 45 |
it { should contain_ceph_config('mds.mymds/public_addr').with_value('1.2.3.4') } |
| 46 |
it { should contain_file('/usr/local/ceph/var/lib/mds/_cluster-_id').with( { |
| 47 |
'ensure' => 'directory', |
| 48 |
'owner' => 'ceph', |
| 49 |
'group' => 'ceph', |
| 50 |
'mode' => '0750', |
| 51 |
'selinux_ignore_defaults' => true, |
| 52 |
} ) } |
| 53 |
end |
| 54 |
|
| 55 |
describe "not activated" do |
| 56 |
let :params do |
| 57 |
{ |
| 58 |
:mds_activate => false |
| 59 |
} |
| 60 |
end |
| 61 |
|
| 62 |
it { should contain_ceph_config('mds/mds_data').with_ensure('absent') } |
| 63 |
it { should contain_ceph_config('mds/keyring').with_ensure('absent') } |
| 64 |
|
| 65 |
end |
| 66 |
end |
| 67 |
|
| 68 |
on_supported_os({ |
| 69 |
:supported_os => OSDefaults.get_supported_os |
| 70 |
}).each do |os,facts| |
| 71 |
context "on #{os}" do |
| 72 |
let (:facts) do |
| 73 |
facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'})) |
| 74 |
end |
| 75 |
|
| 76 |
it_behaves_like 'ceph mds' |
| 77 |
end |
| 78 |
end |
| 79 |
|
| 80 |
end |