Create a separate spec file for the base glance class
... and removes the test case for non-supported OS as that is not globally implemented. Change-Id: Ifa5bd8913099280b130cd7698b46914ab19ca364
This commit is contained in:
parent
a38593fd16
commit
5dd2f27a7e
|
@ -492,7 +492,7 @@ describe 'glance::api' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'glance::api Debian' do
|
shared_examples_for 'glance::api on Debian' do
|
||||||
let(:params) { default_params }
|
let(:params) { default_params }
|
||||||
|
|
||||||
# We only test this on Debian platforms, since on RedHat there isn't a
|
# We only test this on Debian platforms, since on RedHat there isn't a
|
||||||
|
@ -501,21 +501,13 @@ describe 'glance::api' do
|
||||||
context "with package_ensure '#{package_ensure}'" do
|
context "with package_ensure '#{package_ensure}'" do
|
||||||
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
|
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
|
||||||
it { is_expected.to contain_package('glance-api').with(
|
it { is_expected.to contain_package('glance-api').with(
|
||||||
:ensure => package_ensure,
|
:ensure => package_ensure,
|
||||||
:tag => ['openstack', 'glance-package']
|
:tag => ['openstack', 'glance-package']
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'glance::api RedHat' do
|
|
||||||
let(:params) { default_params }
|
|
||||||
|
|
||||||
it { is_expected.to contain_package('openstack-glance').with(
|
|
||||||
:tag => ['openstack', 'glance-package'],
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
:supported_os => OSDefaults.get_supported_os
|
:supported_os => OSDefaults.get_supported_os
|
||||||
}).each do |os,facts|
|
}).each do |os,facts|
|
||||||
|
@ -525,17 +517,9 @@ describe 'glance::api' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'glance::api'
|
it_configures 'glance::api'
|
||||||
it_configures "glance::api #{facts[:osfamily]}"
|
if facts[:osfamily] == 'Debian'
|
||||||
|
it_configures "glance::api on #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'on unknown platforms' do
|
|
||||||
let :facts do
|
|
||||||
OSDefaults.get_facts({ :osfamily => 'unknown', :os => { :family => 'unknown', :release => { :major => '1'}}})
|
|
||||||
end
|
|
||||||
let(:params) { default_params }
|
|
||||||
|
|
||||||
it_raises 'a Puppet::Error', /module glance only support osfamily RedHat and Debian/
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'glance' do
|
||||||
|
|
||||||
|
shared_examples_for 'glance' do
|
||||||
|
it 'includes common classes' do
|
||||||
|
is_expected.to contain_class('glance::deps')
|
||||||
|
is_expected.to contain_class('glance::params')
|
||||||
|
is_expected.to contain_class('openstacklib::openstackclient')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'glance on RedHat' do
|
||||||
|
['present', 'latest'].each do |package_ensure|
|
||||||
|
context "with package_ensure '#{package_ensure}'" do
|
||||||
|
let(:params) do
|
||||||
|
{ :package_ensure => package_ensure }
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_package('openstack-glance').with(
|
||||||
|
:ensure => package_ensure,
|
||||||
|
:tag => ['openstack', 'glance-package']
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
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
|
||||||
|
|
||||||
|
it_behaves_like 'glance'
|
||||||
|
if facts[:osfamily] == 'RedHat'
|
||||||
|
it_configures "glance on #{facts[:osfamily]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue