Files
puppet-gnocchi/spec/classes/gnocchi_storage_spec.rb
Tobias Urdin 56794f300a Move gnocchi api in wsgi back to python2
Canonical are packaging gnocchi-api package with apache
and python3 by default. We cannot test it in CI since
we cannot run py2 and py3 on the same node with apache wsgi.

Canonical helped us by packaging python2 support back into
python-gnocchi package so we change our wsgi usage to use
this package and set the new wsgi script path.

We still want users to be able to install only gnocchi-api
since they might not run apache wsgi even though its installed by
default.

Adds installation of rados and redis packages for python3
when needed, this is because all gnocchi components will
still be running in py3, also CLI such as gnocchi-upgrade
but the gnocchi-api is in wsgi using py2. Because of that
we still need to install the py2 packages.

Enables acceptance testing for Debian based operating systems.

Change-Id: I070f88dd40ca4129cbd3abf5b4f5ecb511b2895e
2018-03-06 22:34:21 +01:00

80 lines
2.0 KiB
Ruby

require 'spec_helper'
describe 'gnocchi::storage' do
let :params do
{ :package_ensure => 'latest' }
end
shared_examples_for 'gnocchi-storage' do
it { is_expected.to contain_class('gnocchi::deps') }
it { is_expected.to contain_class('gnocchi::params') }
context 'with coordination' do
before do
params.merge!({
:coordination_url => 'redis://localhost:6379',
:metric_processing_delay => 30,
})
end
it 'configures backend_url' do
is_expected.to contain_gnocchi_config('storage/coordination_url').with_value('redis://localhost:6379')
is_expected.to contain_gnocchi_config('storage/metric_processing_delay').with_value(30)
end
it 'installs python-redis package' do
is_expected.to contain_package(platform_params[:redis_package_name]).with(
:name => platform_params[:redis_package_name],
:tag => 'openstack'
)
end
end
end
shared_examples_for 'gnocchi-storage ubuntu' do
context 'with coordination set on ubuntu' do
before do
params.merge!({
:coordination_url => 'redis://localhost:6379',
:metric_processing_delay => 30,
})
end
it 'installs python3-redis package' do
is_expected.to contain_package('python3-redis').with(
:name => 'python3-redis',
:tag => 'openstack'
)
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
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :redis_package_name => 'python-redis' }
when 'RedHat'
{ :redis_package_name => 'python-redis' }
end
end
if facts[:operatingsystem] == 'Ubuntu' then
it_behaves_like 'gnocchi-storage ubuntu'
end
it_behaves_like 'gnocchi-storage'
end
end
end