Merge "Convert spec testing to rspec-puppet-facts"
This commit is contained in:
commit
f9b6c2e305
@ -1,28 +1,22 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'glare::backend::rbd' do
|
describe 'glare::backend::rbd' do
|
||||||
let (:facts) do
|
shared_examples 'glare::backend::rbd' do
|
||||||
OSDefaults.get_facts({
|
context 'with default params' do
|
||||||
:osfamily => 'Debian',
|
it { should contain_glare_config('glance_store/default_store').with_value('rbd') }
|
||||||
})
|
it { should contain_glare_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>') }
|
||||||
end
|
it { should contain_glare_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>') }
|
||||||
|
it { should contain_glare_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>') }
|
||||||
|
it { should contain_glare_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')}
|
||||||
|
it { should contain_glare_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')}
|
||||||
|
|
||||||
describe 'with default params' do
|
it { should contain_package('python-ceph').with(
|
||||||
|
:name => platform_params[:pyceph_package_name],
|
||||||
it { is_expected.to contain_glare_config('glance_store/default_store').with_value('rbd') }
|
|
||||||
it { is_expected.to contain_glare_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>') }
|
|
||||||
it { is_expected.to contain_glare_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>') }
|
|
||||||
it { is_expected.to contain_glare_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>') }
|
|
||||||
it { is_expected.to contain_glare_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')}
|
|
||||||
it { is_expected.to contain_glare_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')}
|
|
||||||
it { is_expected.to contain_package('python-ceph').with(
|
|
||||||
:name => 'python-ceph',
|
|
||||||
:ensure => 'present'
|
:ensure => 'present'
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when passing params' do
|
context 'when passing params' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:rbd_store_user => 'user',
|
:rbd_store_user => 'user',
|
||||||
@ -31,53 +25,83 @@ describe 'glare::backend::rbd' do
|
|||||||
:rados_connect_timeout => '30',
|
:rados_connect_timeout => '30',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_glare_config('glance_store/rbd_store_user').with_value('user') }
|
|
||||||
it { is_expected.to contain_glare_config('glance_store/rbd_store_chunk_size').with_value('2') }
|
it { should contain_glare_config('glance_store/rbd_store_user').with_value('user') }
|
||||||
it { is_expected.to contain_glare_config('glance_store/rados_connect_timeout').with_value('30')}
|
it { should contain_glare_config('glance_store/rbd_store_chunk_size').with_value('2') }
|
||||||
it { is_expected.to contain_package('python-ceph').with(
|
it { should contain_glare_config('glance_store/rados_connect_timeout').with_value('30')}
|
||||||
:name => 'python-ceph',
|
|
||||||
|
it { should contain_package('python-ceph').with(
|
||||||
|
:name => platform_params[:pyceph_package_name],
|
||||||
:ensure => 'latest'
|
:ensure => 'latest'
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with not managed ceph package' do
|
context 'with not managed ceph package' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:package_manage => false
|
:package_manage => false
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not configure ceph package' do
|
it { should_not contain_package('python-ceph') }
|
||||||
is_expected.not_to contain_package('python-ceph').with(
|
|
||||||
:name => 'python-ceph')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'package on RedHat platform el6' do
|
shared_examples 'glare::backend::rbd on RedHat' do
|
||||||
let :facts do
|
context 'with el6' do
|
||||||
OSDefaults.get_facts({
|
before do
|
||||||
:osfamily => 'RedHat',
|
facts.merge!( :operatingsystemrelease => '6.5' )
|
||||||
:operatingsystemrelease => '6.5',
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_package('python-ceph').with(
|
|
||||||
|
it { should contain_package('python-ceph').with(
|
||||||
:name => 'python-ceph',
|
:name => 'python-ceph',
|
||||||
:ensure => 'present'
|
:ensure => 'present'
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
end
|
end
|
||||||
describe 'package on RedHat platform el7' do
|
|
||||||
let :facts do
|
context 'with el7' do
|
||||||
OSDefaults.get_facts({
|
before do
|
||||||
:osfamily => 'RedHat',
|
facts.merge!( :operatingsystemrelease => '7.0' )
|
||||||
:operatingsystemrelease => '7.0'
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_package('python-ceph').with(
|
|
||||||
|
it { should contain_package('python-ceph').with(
|
||||||
:name => 'python-rbd',
|
:name => 'python-rbd',
|
||||||
:ensure => 'present'
|
:ensure => 'present'
|
||||||
)
|
)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:platform_params) do
|
||||||
|
case facts[:osfamily]
|
||||||
|
when 'Debian'
|
||||||
|
if facts[:os_package_type] == 'debian' then
|
||||||
|
pyceph_pkg = 'python3-ceph'
|
||||||
|
else
|
||||||
|
pyceph_pkg = 'python-ceph'
|
||||||
|
end
|
||||||
|
{
|
||||||
|
:pyceph_package_name => pyceph_pkg,
|
||||||
|
}
|
||||||
|
when 'RedHat'
|
||||||
|
{
|
||||||
|
:pyceph_package_name => 'python-rbd',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'glare::backend::rbd'
|
||||||
|
|
||||||
|
if facts[:osfamily] == 'RedHat'
|
||||||
|
it_behaves_like 'glare::backend::rbd on RedHat'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user