puppet-nova/spec/classes/nova_db_postgresql_spec.rb
Takashi Kajinami befcc23b1d Revert "CentOS 9: Disable unit tests dependent on puppet-postgresql"
This reverts commit 20fec0749121b93189fd8a4195e21914982a3d30.

Reason for revert:
puppet-postgresql 8.1.0 was released and now the module supports RHEL 9
(and CentOS 9 effectively).

Note:
This change adds the service_provider fact in test fact data because
it is required by puppet-postgresql.

Depends-on: https://review.opendev.org/850705
Change-Id: I912189bb54c0116b0c3df9f68cb96b1b9659de53
2022-07-24 00:52:02 +09:00

64 lines
1.5 KiB
Ruby

require 'spec_helper'
describe 'nova::db::postgresql' do
shared_examples 'nova::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
let :pre_condition do
'include postgresql::server'
end
context 'with only required parameters' do
let :params do
req_params
end
it { is_expected.to contain_class('nova::deps') }
it { should contain_openstacklib__db__postgresql('nova').with(
:password => 'pw',
:dbname => 'nova',
:user => 'nova',
:encoding => nil,
:privileges => 'ALL',
)}
it { should contain_openstacklib__db__postgresql('nova_cell0').with(
:password => 'pw',
:dbname => 'nova_cell0',
:user => 'nova',
:encoding => nil,
:privileges => 'ALL',
)}
end
context 'when disabling cell0 setup' do
let :params do
{ :setup_cell0 => false}.merge(req_params)
end
it { is_expected.to_not contain_openstacklib__db__postgresql('nova_cell0') }
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({
# puppet-postgresql requires the service_provider fact provided by
# puppetlabs-postgresql.
:service_provider => 'systemd'
}))
end
it_configures 'nova::db::postgresql'
end
end
end