Fix keystone::client testing
Fixes the failing testing since the package resource in the openstacklib::openstackclient class was changed [1]. Modules testing should *never* check names of other resources but only the actual resources it's using, which in this case is the openstacklib::openstackclient class and not the package. Also takes the oppertunity to convert the testing to using rspec-puppet-facts, the keystone modules is the only module that is left until all modules are using rspec-puppet-facts. [1] http://logs.openstack.org/59/632459/9/check/puppet-openstack-unit-4.8-centos-7/0886361/job-output.txt.gz#_2019-01-28_13_16_02_682694 Change-Id: I4c86797fba211387a53036ce933e430daefb8f0e
This commit is contained in:
parent
5cf19ad921
commit
cda95ac386
|
@ -1,33 +1,53 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'keystone::client' do
|
||||
shared_examples 'keystone::client' do
|
||||
context 'with default parameters' do
|
||||
it { should contain_package('python-keystoneclient').with(
|
||||
:ensure => 'present',
|
||||
:name => platform_params[:client_package_name],
|
||||
:tag => 'openstack',
|
||||
)}
|
||||
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
|
||||
})
|
||||
end
|
||||
|
||||
describe "with default parameters" do
|
||||
it { is_expected.to contain_package('python-keystoneclient').with(
|
||||
'ensure' => 'present',
|
||||
'tag' => 'openstack'
|
||||
) }
|
||||
it { is_expected.to contain_package('python-openstackclient').with(
|
||||
'ensure' => 'present',
|
||||
'tag' => 'openstack',
|
||||
) }
|
||||
end
|
||||
|
||||
describe "with specified version" do
|
||||
let :params do
|
||||
{:ensure => '2013.1'}
|
||||
it { should contain_class('openstacklib::openstackclient') }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('python-keystoneclient').with(
|
||||
'ensure' => '2013.1',
|
||||
'tag' => 'openstack'
|
||||
) }
|
||||
context 'with specified parameters' do
|
||||
let :params do
|
||||
{
|
||||
:client_package_name => 'package_name',
|
||||
:ensure => '1.2.3',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_package('python-keystoneclient').with(
|
||||
:ensure => '1.2.3',
|
||||
:name => 'package_name',
|
||||
:tag => 'openstack',
|
||||
)}
|
||||
|
||||
it { should contain_class('openstacklib::openstackclient') }
|
||||
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'
|
||||
{ :client_package_name => 'python3-keystoneclient' }
|
||||
when 'RedHat'
|
||||
{ :client_package_name => 'python-keystoneclient' }
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'keystone::client'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue