cache: support etcd3gw backend

This change introduces support to use ectd3gw backend as oslo.cache
backend, and makes the required backend package installed. The same
backend is already supported for coordination and this change leverage
the existing definitions added for coordination.

Change-Id: Id0eec018a68ab4a510307f150aa2a6ee017fa651
This commit is contained in:
Takashi Kajinami 2021-08-29 08:54:57 +09:00
parent 331635c04d
commit 12ed99e29a
2 changed files with 55 additions and 2 deletions

View File

@ -210,6 +210,12 @@ define oslo::cache(
name => $::oslo::params::python_memcache_package_name, name => $::oslo::params::python_memcache_package_name,
tag => ['openstack'], tag => ['openstack'],
}) })
} elsif ($backend =~ /\.etcd3gw/ ) {
ensure_packages('python-etcd3gw', {
name => $::oslo::params::python_etcd3gw_package_name,
ensure => $package_ensure,
tag => 'openstack',
})
} }
} }

View File

@ -165,6 +165,51 @@ describe 'oslo::cache' do
end end
end end
context 'with etcd3gw backend' do
let :params do
{
:backend => 'oslo_cache.etcd3gw',
}
end
it 'configures cache backend' do
is_expected.to contain_keystone_config('cache/backend').with_value('oslo_cache.etcd3gw')
is_expected.to contain_package('python-etcd3gw').with(
:ensure => 'present',
:name => platform_params[:python_etcd3gw_package_name],
:tag => ['openstack'],
)
end
context 'with package_ensure set' do
before do
params.merge!({
:package_ensure => 'latest'
})
end
it 'ensures status of the package' do
is_expected.to contain_package('python-etcd3gw').with(
:ensure => 'latest',
:name => platform_params[:python_etcd3gw_package_name],
:tag => 'openstack',
)
end
end
context 'with backend package management disabled' do
before do
params.merge!({
:manage_backend_package => false,
})
end
it 'does not install backend package' do
is_expected.not_to contain_package('python-etcd3gw')
end
end
end
context 'with string in list parameters' do context 'with string in list parameters' do
let :params do let :params do
{ {
@ -194,10 +239,12 @@ describe 'oslo::cache' do
case facts[:osfamily] case facts[:osfamily]
when 'Debian' when 'Debian'
{ :pylibmc_package_name => 'python3-pylibmc', { :pylibmc_package_name => 'python3-pylibmc',
:python_memcache_package_name => 'python3-memcache' } :python_memcache_package_name => 'python3-memcache',
:python_etcd3gw_package_name => 'python3-etcd3gw' }
when 'RedHat' when 'RedHat'
{ :pylibmc_package_name => 'python3-pylibmc', { :pylibmc_package_name => 'python3-pylibmc',
:python_memcache_package_name => 'python3-memcached' } :python_memcache_package_name => 'python3-memcached',
:python_etcd3gw_package_name => 'python3-etcd3gw' }
end end
end end