
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: I1150ec8cd0a683d855030e1f75893677be1d9652
62 lines
1.5 KiB
Ruby
62 lines
1.5 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'cinder::client' do
|
|
let :params do
|
|
{}
|
|
end
|
|
|
|
let :default_params do
|
|
{
|
|
:package_ensure => 'present'
|
|
}
|
|
end
|
|
|
|
shared_examples 'cinder client' do
|
|
let :p do
|
|
default_params.merge(params)
|
|
end
|
|
|
|
it { is_expected.to contain_class('cinder::deps') }
|
|
it { is_expected.to contain_class('cinder::params') }
|
|
|
|
it 'installs cinder client package' do
|
|
is_expected.to contain_package('python-cinderclient').with(
|
|
:name => platform_params[:client_package_name],
|
|
:ensure => p[:package_ensure],
|
|
:tag => ['openstack', 'cinder-support-package'],
|
|
)
|
|
end
|
|
|
|
it { is_expected.to contain_class('openstacklib::openstackclient') }
|
|
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({:os_workers => 8}))
|
|
end
|
|
|
|
let(:platform_params) do
|
|
case facts[:osfamily]
|
|
when 'Debian'
|
|
{ :client_package_name => 'python3-cinderclient' }
|
|
when 'RedHat'
|
|
if facts[:operatingsystem] == 'Fedora'
|
|
{ :client_package_name => 'python3-cinderclient' }
|
|
else
|
|
if facts[:operatingsystemmajrelease] > '7'
|
|
{ :client_package_name => 'python3-cinderclient' }
|
|
else
|
|
{ :client_package_name => 'python-cinderclient' }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
it_behaves_like 'cinder client'
|
|
end
|
|
end
|
|
end
|