puppet-keystone/spec/classes/keystone_client_spec.rb
Takashi Kajinami 8221556892 Expect python3 client package in CentOS8
In CentOS, we expect to have python3 client package in 8.x while we
expect to have python2 in 7.x .
Fix unit tests to expect the correct version according to os major
version.

Change-Id: Ia764aeca5484f0a0e4e9367bb9796f8e0386738d
2020-03-31 16:43:47 +09:00

65 lines
1.7 KiB
Ruby

require 'spec_helper'
describe 'keystone::client' do
shared_examples 'keystone::client' do
it { is_expected.to contain_class('keystone::deps') }
context 'with default parameters' do
it { should contain_package('python-keystoneclient').with(
:ensure => 'present',
:name => platform_params[:client_package_name],
:tag => 'openstack',
)}
it { should contain_class('openstacklib::openstackclient') }
end
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'
if facts[:operatingsystem] == 'Fedora'
{ :client_package_name => 'python3-keystoneclient' }
else
if facts[:operatingsystemmajrelease] > '7'
{ :client_package_name => 'python3-keystoneclient' }
else
{ :client_package_name => 'python-keystoneclient' }
end
end
end
end
it_behaves_like 'keystone::client'
end
end
end