Test multiple operating systems for db

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

Change-Id: Ifcde1fc25f8111655a1f50ac1e30b1d52bb3b1ce
This commit is contained in:
ZhongShengping 2016-04-30 11:45:04 +08:00
parent a0f957f2e8
commit 56d2a46738
2 changed files with 30 additions and 56 deletions

View File

@ -2,27 +2,19 @@ require 'spec_helper'
describe 'neutron::db::postgresql' do describe 'neutron::db::postgresql' do
let :req_params do shared_examples_for 'neutron::db::postgresql' do
{ :password => 'pw' } let :req_params do
end { :password => 'pw' }
end
let :pre_condition do let :pre_condition do
'include postgresql::server' 'include postgresql::server'
end end
let :test_facts do let :test_facts do
{ :operatingsystem => 'default', { :operatingsystem => 'default',
:operatingsystemrelease => 'default' :operatingsystemrelease => 'default'
} }
end
context 'on a RedHat osfamily' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
}))
end end
context 'with only required parameters' do context 'with only required parameters' do
@ -38,27 +30,19 @@ describe 'neutron::db::postgresql' do
end end
context 'on a Debian osfamily' do on_supported_os({
let :facts do :supported_os => OSDefaults.get_supported_os
@default_facts.merge(test_facts.merge({ }).each do |os,facts|
:operatingsystemrelease => '7.8', context "on #{os}" do
:operatingsystem => 'Debian', let (:facts) do
:osfamily => 'Debian', facts.merge(OSDefaults.get_facts({
:concat_basedir => '/var/lib/puppet/concat' :processorcount => 8,
})) :concat_basedir => '/var/lib/puppet/concat'
end }))
context 'with only required parameters' do
let :params do
req_params
end end
it { is_expected.to contain_postgresql__server__db('neutron').with( it_configures 'neutron::db::postgresql'
:user => 'neutron',
:password => 'md5696acd1dd66513a556a18a1beccd03d1'
)}
end end
end end
end end

View File

@ -32,29 +32,19 @@ describe 'neutron::db::sync' do
end end
context 'on a RedHat osfamily' do on_supported_os({
let :facts do :supported_os => OSDefaults.get_supported_os
{ }).each do |os,facts|
:osfamily => 'RedHat', context "on #{os}" do
:operatingsystemrelease => '7.0', let (:facts) do
:concat_basedir => '/var/lib/puppet/concat' facts.merge(OSDefaults.get_facts({
} :processorcount => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
end
it_configures 'neutron-dbsync'
end end
it_configures 'neutron-dbsync'
end
context 'on a Debian osfamily' do
let :facts do
{
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
}
end
it_configures 'neutron-dbsync'
end end
end end