diff --git a/spec/classes/neutron_db_postgresql_spec.rb b/spec/classes/neutron_db_postgresql_spec.rb index 6d2bd56aa..9fecbe06a 100644 --- a/spec/classes/neutron_db_postgresql_spec.rb +++ b/spec/classes/neutron_db_postgresql_spec.rb @@ -2,27 +2,19 @@ require 'spec_helper' describe 'neutron::db::postgresql' do - let :req_params do - { :password => 'pw' } - end + shared_examples_for 'neutron::db::postgresql' do + let :req_params do + { :password => 'pw' } + end - let :pre_condition do - 'include postgresql::server' - end + let :pre_condition do + 'include postgresql::server' + end - let :test_facts do + let :test_facts do { :operatingsystem => '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 context 'with only required parameters' do @@ -38,27 +30,19 @@ describe 'neutron::db::postgresql' do end - context 'on a Debian osfamily' do - let :facts do - @default_facts.merge(test_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('neutron').with( - :user => 'neutron', - :password => 'md5696acd1dd66513a556a18a1beccd03d1' - )} + it_configures 'neutron::db::postgresql' end - end end diff --git a/spec/classes/neutron_db_sync_spec.rb b/spec/classes/neutron_db_sync_spec.rb index 7e796b925..289e5bf63 100644 --- a/spec/classes/neutron_db_sync_spec.rb +++ b/spec/classes/neutron_db_sync_spec.rb @@ -32,29 +32,19 @@ describe 'neutron::db::sync' do end - context 'on a RedHat osfamily' do - let :facts do - { - :osfamily => 'RedHat', - :operatingsystemrelease => '7.0', - :concat_basedir => '/var/lib/puppet/concat' - } + 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_configures 'neutron-dbsync' 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