oslo db: check puppet resource instead of actual config in spec
Change-Id: I155cf78ab78f3732a28936fb25bb94797b72c6a9
This commit is contained in:
parent
10a199c519
commit
9cdeadec8c
@ -7,13 +7,15 @@ describe 'heat::db' do
|
||||
context 'with default parameters' do
|
||||
|
||||
it { is_expected.to contain_class('heat::db::sync') }
|
||||
it { is_expected.to contain_heat_config('database/connection').with_value('sqlite:////var/lib/heat/heat.sqlite').with_secret(true) }
|
||||
it { is_expected.to contain_heat_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_heat_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo__db('heat_config').with(
|
||||
:db_max_retries => '<SERVICE DEFAULT>',
|
||||
:connection => 'sqlite:////var/lib/heat/heat.sqlite',
|
||||
:idle_timeout => '<SERVICE DEFAULT>',
|
||||
:min_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_retries => '<SERVICE DEFAULT>',
|
||||
:retry_interval => '<SERVICE DEFAULT>',
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
@ -30,13 +32,15 @@ describe 'heat::db' do
|
||||
end
|
||||
|
||||
it { is_expected.not_to contain_class('heat::db::sync') }
|
||||
it { is_expected.to contain_heat_config('database/connection').with_value('mysql+pymysql://heat:heat@localhost/heat').with_secret(true) }
|
||||
it { is_expected.to contain_heat_config('database/idle_timeout').with_value('3601') }
|
||||
it { is_expected.to contain_heat_config('database/min_pool_size').with_value('2') }
|
||||
it { is_expected.to contain_heat_config('database/max_pool_size').with_value('12') }
|
||||
it { is_expected.to contain_heat_config('database/max_retries').with_value('11') }
|
||||
it { is_expected.to contain_heat_config('database/retry_interval').with_value('11') }
|
||||
it { is_expected.to contain_heat_config('database/db_max_retries').with_value('-1') }
|
||||
it { is_expected.to contain_oslo__db('heat_config').with(
|
||||
:db_max_retries => '-1',
|
||||
:connection => 'mysql+pymysql://heat:heat@localhost/heat',
|
||||
:idle_timeout => '3601',
|
||||
:min_pool_size => '2',
|
||||
:max_pool_size => '12',
|
||||
:max_retries => '11',
|
||||
:retry_interval => '11',
|
||||
)}
|
||||
|
||||
end
|
||||
|
||||
@ -45,12 +49,14 @@ describe 'heat::db' do
|
||||
{ :database_connection => 'mysql://heat:heat@localhost/heat' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_heat_config('database/connection').with_value('mysql://heat:heat@localhost/heat').with_secret(true) }
|
||||
it { is_expected.to contain_oslo__db('heat_config').with(
|
||||
:connection => 'mysql://heat:heat@localhost/heat',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'with postgresql backend' do
|
||||
let :params do
|
||||
{ :database_connection => 'postgresql://heat:heat@localhost/heat', }
|
||||
{ :database_connection => 'postgresql://heat:heat@localhost/heat', }
|
||||
end
|
||||
|
||||
it 'install the proper backend package' do
|
||||
@ -61,7 +67,7 @@ describe 'heat::db' do
|
||||
|
||||
context 'with incorrect database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'redis://heat:heat@localhost/heat', }
|
||||
{ :database_connection => 'redis://heat:heat@localhost/heat', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
@ -69,7 +75,7 @@ describe 'heat::db' do
|
||||
|
||||
context 'with incorrect database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foo+pymysql://heat:heat@localhost/heat', }
|
||||
{ :database_connection => 'foo+pymysql://heat:heat@localhost/heat', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
@ -89,7 +95,7 @@ describe 'heat::db' do
|
||||
|
||||
context 'using pymysql driver' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://heat:heat@localhost/heat' }
|
||||
{ :database_connection => 'mysql+pymysql://heat:heat@localhost/heat' }
|
||||
end
|
||||
|
||||
case facts[:osfamily]
|
||||
|
Loading…
Reference in New Issue
Block a user