| 1 |
# |
| 2 |
# Copyright (C) 2014 Nine Internet Solutions AG |
| 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: David Gurtner <[email protected]> |
| 17 |
# Author: David Moreau Simard <[email protected]> |
| 18 |
# |
| 19 |
require 'spec_helper' |
| 20 |
|
| 21 |
describe 'ceph::profile::client' do |
| 22 |
|
| 23 |
shared_examples 'ceph profile client' do |
| 24 |
context 'with the default client keys defined in common.yaml' do |
| 25 |
|
| 26 |
it { should contain_class('ceph::profile::base') } |
| 27 |
it { should contain_class('ceph::keys').with( |
| 28 |
'args' => { |
| 29 |
'client.admin' => { |
| 30 |
'secret' => 'AQBMGHJTkC8HKhAAJ7NH255wYypgm1oVuV41MA==', |
| 31 |
'mode' => '0600', |
| 32 |
'cap_mon' => 'allow *', |
| 33 |
'cap_osd' => 'allow *', |
| 34 |
'cap_mds' => 'allow *' |
| 35 |
}, |
| 36 |
'client.bootstrap-osd' => { |
| 37 |
'secret' => 'AQARG3JTsDDEHhAAVinHPiqvJkUi5Mww/URupw==', |
| 38 |
'keyring_path' => '/var/lib/ceph/bootstrap-osd/ceph.keyring', |
| 39 |
'cap_mon' => 'allow profile bootstrap-osd' |
| 40 |
}, |
| 41 |
'client.bootstrap-mds' => { |
| 42 |
'secret' => 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw==', |
| 43 |
'keyring_path' => '/var/lib/ceph/bootstrap-mds/ceph.keyring', |
| 44 |
'cap_mon' => 'allow profile bootstrap-mds' |
| 45 |
}, |
| 46 |
'client.volumes' => { |
| 47 |
'secret' => 'AQA4MPZTOGU0ARAAXH9a0fXxVq0X25n2yPREDw==', |
| 48 |
'mode' => '0644', |
| 49 |
'user' => 'root', |
| 50 |
'group' => 'root', |
| 51 |
'cap_mon' => 'allow r', |
| 52 |
'cap_osd' => 'allow class-read object_prefix rbd_children, allow rwx pool=volumes' |
| 53 |
} |
| 54 |
} |
| 55 |
)} |
| 56 |
end |
| 57 |
|
| 58 |
context 'with the specific client keys defined in client.yaml' do |
| 59 |
|
| 60 |
before :each do |
| 61 |
facts.merge!( :hostname => 'client') |
| 62 |
end |
| 63 |
|
| 64 |
it { should contain_class('ceph::profile::base') } |
| 65 |
it { should contain_class('ceph::keys').with( |
| 66 |
'args' => { |
| 67 |
'client.volumes' => { |
| 68 |
'secret' => 'AQA4MPZTOGU0ARAAXH9a0fXxVq0X25n2yPREDw==', |
| 69 |
'mode' => '0644', |
| 70 |
'user' => 'root', |
| 71 |
'group' => 'root', |
| 72 |
'cap_mon' => 'allow r', |
| 73 |
'cap_osd' => 'allow class-read object_prefix rbd_children, allow rwx pool=volumes' |
| 74 |
} |
| 75 |
} |
| 76 |
)} |
| 77 |
end |
| 78 |
|
| 79 |
context 'without cephx and client_keys' do |
| 80 |
let :pre_condition do |
| 81 |
"class { 'ceph::profile::params': |
| 82 |
authentication_type => 'undef', |
| 83 |
client_keys => {} |
| 84 |
}" |
| 85 |
end |
| 86 |
|
| 87 |
it { should contain_class('ceph::profile::base') } |
| 88 |
it { should_not contain_class('ceph::keys') } |
| 89 |
end |
| 90 |
end |
| 91 |
|
| 92 |
on_supported_os.each do |os, facts| |
| 93 |
context "on #{os}" do |
| 94 |
let(:facts) do |
| 95 |
facts.merge({}) |
| 96 |
end |
| 97 |
|
| 98 |
it_behaves_like 'ceph profile client' |
| 99 |
end |
| 100 |
end |
| 101 |
end |