| 1 |
# Copyright (C) 2017 VEXXHOST, 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: Mohammed Naser <[email protected]> |
| 16 |
# |
| 17 |
require 'spec_helper' |
| 18 |
|
| 19 |
describe 'ceph::mgr' do |
| 20 |
let (:title) { 'foo' } |
| 21 |
|
| 22 |
shared_examples 'ceph::mgr' do |
| 23 |
context 'with cephx configured but no key specified' do |
| 24 |
let :params do |
| 25 |
{ |
| 26 |
:authentication_type => 'cephx' |
| 27 |
} |
| 28 |
end |
| 29 |
|
| 30 |
it { should raise_error(Puppet::Error, /cephx requires a specified key for the manager daemon/) } |
| 31 |
end |
| 32 |
|
| 33 |
context 'cephx authentication_type' do |
| 34 |
let :params do |
| 35 |
{ |
| 36 |
:authentication_type => 'cephx', |
| 37 |
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==', |
| 38 |
} |
| 39 |
end |
| 40 |
|
| 41 |
it { should contain_file('/var/lib/ceph/mgr').with( |
| 42 |
:ensure => 'directory', |
| 43 |
:owner => 'ceph', |
| 44 |
:group => 'ceph' |
| 45 |
)} |
| 46 |
|
| 47 |
it { should contain_file('/var/lib/ceph/mgr/ceph-foo').with( |
| 48 |
:ensure => 'directory', |
| 49 |
:owner => 'ceph', |
| 50 |
:group => 'ceph' |
| 51 |
)} |
| 52 |
|
| 53 |
it { should contain_ceph__key('mgr.foo').with( |
| 54 |
:secret => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==', |
| 55 |
:cluster => 'ceph', |
| 56 |
:keyring_path => '/var/lib/ceph/mgr/ceph-foo/keyring', |
| 57 |
:cap_mon => 'allow profile mgr', |
| 58 |
:cap_osd => 'allow *', |
| 59 |
:cap_mds => 'allow *', |
| 60 |
:user => 'ceph', |
| 61 |
:group => 'ceph', |
| 62 |
:inject => false, |
| 63 |
)} |
| 64 |
|
| 65 |
it { should contain_service('ceph-mgr@foo').with( |
| 66 |
:ensure => 'running', |
| 67 |
:enable => true, |
| 68 |
)} |
| 69 |
end |
| 70 |
end |
| 71 |
|
| 72 |
on_supported_os({ |
| 73 |
:supported_os => OSDefaults.get_supported_os |
| 74 |
}).each do |os,facts| |
| 75 |
context "on #{os}" do |
| 76 |
let (:facts) do |
| 77 |
facts.merge!(OSDefaults.get_facts()) |
| 78 |
end |
| 79 |
|
| 80 |
it_behaves_like 'ceph::mgr' |
| 81 |
end |
| 82 |
end |
| 83 |
end |