Test multiple operating systems for db

This change updates the tests for heat::db::postgresql and
heat::db::sync to test multiple operating systems.

Change-Id: I5518570eb4eb794a1ab4e839777aaa6f3c566302
This commit is contained in:
ZhongShengping 2016-04-30 10:22:30 +08:00
parent 0d02d971cc
commit 099774011c
2 changed files with 29 additions and 56 deletions

View File

@ -2,23 +2,15 @@ require 'spec_helper'
describe 'heat::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
shared_examples_for 'heat::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
let :pre_condition do
'include ::postgresql::server
include ::heat
'
end
context 'on a RedHat osfamily' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
})
let :pre_condition do
'include ::postgresql::server
include ::heat
'
end
context 'with only required parameters' do
@ -34,27 +26,19 @@ describe 'heat::db::postgresql' do
end
context 'on a Debian osfamily' do
let :facts do
@default_facts.merge({
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
})
end
context 'with only required parameters' do
let :params do
req_params
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({
:processorcount => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
it { is_expected.to contain_postgresql__server__db('heat').with(
:user => 'heat',
:password => 'md5fd5c4fca491370aab732f903e2fb7c99'
)}
it_configures 'heat::db::postgresql'
end
end
end

View File

@ -34,30 +34,19 @@ describe 'heat::db::sync' do
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({
:processorcount => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
context 'on a RedHat osfamily' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
})
it_configures 'heat-dbsync'
end
it_configures 'heat-dbsync'
end
context 'on a Debian osfamily' do
let :facts do
@default_facts.merge({
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
})
end
it_configures 'heat-dbsync'
end
end