| 1 |
# Copyright (C) 2016 Keith Schincke |
| 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: Keith Schincke <[email protected]> |
| 16 |
# |
| 17 |
require 'spec_helper' |
| 18 |
|
| 19 |
describe 'ceph::mirror' do |
| 20 |
shared_examples 'ceph::mirror on Debian' do |
| 21 |
before do |
| 22 |
facts.merge!( :operatingsystem => 'Ubuntu', |
| 23 |
:operatingsystemrelease => '16.04', |
| 24 |
:service_provider => 'systemd' ) |
| 25 |
end |
| 26 |
|
| 27 |
context 'with default params' do |
| 28 |
let :title do |
| 29 |
'A' |
| 30 |
end |
| 31 |
|
| 32 |
it { should contain_service('ceph-rbd-mirror@A').with('ensure' => 'running') } |
| 33 |
end |
| 34 |
end |
| 35 |
|
| 36 |
shared_examples 'ceph::mirror on RedHat' do |
| 37 |
before do |
| 38 |
facts.merge!( :operatingsystem => 'RedHat', |
| 39 |
:operatingsystemrelease => '7.2', |
| 40 |
:operatingsystemmajrelease => '7', |
| 41 |
:service_provider => 'systemd' ) |
| 42 |
end |
| 43 |
|
| 44 |
context 'with default params' do |
| 45 |
let :title do |
| 46 |
'A' |
| 47 |
end |
| 48 |
|
| 49 |
it { should contain_service('ceph-rbd-mirror@A').with('ensure' => 'running') } |
| 50 |
end |
| 51 |
end |
| 52 |
|
| 53 |
on_supported_os({ |
| 54 |
:supported_os => OSDefaults.get_supported_os |
| 55 |
}).each do |os,facts| |
| 56 |
context "on #{os}" do |
| 57 |
let (:facts) do |
| 58 |
facts.merge!(OSDefaults.get_facts()) |
| 59 |
end |
| 60 |
|
| 61 |
it_behaves_like "ceph::mirror on #{facts[:osfamily]}" |
| 62 |
end |
| 63 |
end |
| 64 |
end |