puppet-gnocchi/spec/classes/gnocchi_db_spec.rb
Takashi Kajinami de085305c4 Refactor db class using oslo::db
This replaces the existing logic in the gnocchi::db class by the common
logic in oslo::db, to use the single logic to manage backend packages.

Depends-on: https://review.opendev.org/889374
Change-Id: Icd916df0b3463128df5b2ed3b49c2cdbee871504
2023-07-25 13:49:17 +00:00

50 lines
1.3 KiB
Ruby

require 'spec_helper'
describe 'gnocchi::db' do
shared_examples 'gnocchi::db' do
context 'with default parameters' do
it { should contain_class('gnocchi::deps') }
it { should contain_oslo__db('gnocchi_config').with(
:connection => 'sqlite:////var/lib/gnocchi/gnocchi.sqlite',
:manage_config => false,
)}
it { should contain_gnocchi_config('indexer/url').with(
:value => 'sqlite:////var/lib/gnocchi/gnocchi.sqlite',
:secret => true,
)}
end
context 'with specific parameters' do
let :params do
{
:database_connection => 'mysql+pymysql://gnocchi:gnocchi@localhost/gnocchi'
}
end
it { should contain_class('gnocchi::deps') }
it { should contain_oslo__db('gnocchi_config').with(
:connection => 'mysql+pymysql://gnocchi:gnocchi@localhost/gnocchi',
:manage_config => false,
)}
it { should contain_gnocchi_config('indexer/url').with(
:value => 'mysql+pymysql://gnocchi:gnocchi@localhost/gnocchi',
:secret => true,
)}
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
it_behaves_like 'gnocchi::db'
end
end
end