oslo db: check puppet resource instead of actual config in spec
Change-Id: I4bd2980861a301bd3bedb4c0bdee24daac5ba5bd
This commit is contained in:
parent
c2e73fa571
commit
11922ac8be
|
@ -4,14 +4,16 @@ describe 'freezer::db' do
|
|||
|
||||
shared_examples 'freezer::db' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_freezer_config('database/connection').with_value('sqlite:////var/lib/freezer/freezer.sqlite') }
|
||||
it { is_expected.to contain_freezer_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_freezer_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_freezer_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_freezer_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_freezer_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_freezer_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_freezer_config('database/max_overflow').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_oslo__db('freezer_config').with(
|
||||
:db_max_retries => '<SERVICE DEFAULT>',
|
||||
:connection => 'sqlite:////var/lib/freezer/freezer.sqlite',
|
||||
:idle_timeout => '<SERVICE DEFAULT>',
|
||||
:min_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_retries => '<SERVICE DEFAULT>',
|
||||
:retry_interval => '<SERVICE DEFAULT>',
|
||||
:max_overflow => '<SERVICE DEFAULT>',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
|
@ -27,19 +29,21 @@ describe 'freezer::db' do
|
|||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_freezer_config('database/connection').with_value('mysql+pymysql://freezer:freezer@localhost/freezer') }
|
||||
it { is_expected.to contain_freezer_config('database/idle_timeout').with_value('3601') }
|
||||
it { is_expected.to contain_freezer_config('database/min_pool_size').with_value('2') }
|
||||
it { is_expected.to contain_freezer_config('database/db_max_retries').with_value('-1') }
|
||||
it { is_expected.to contain_freezer_config('database/max_retries').with_value('11') }
|
||||
it { is_expected.to contain_freezer_config('database/retry_interval').with_value('11') }
|
||||
it { is_expected.to contain_freezer_config('database/max_pool_size').with_value('11') }
|
||||
it { is_expected.to contain_freezer_config('database/max_overflow').with_value('21') }
|
||||
it { is_expected.to contain_oslo__db('freezer_config').with(
|
||||
:db_max_retries => '-1',
|
||||
:connection => 'mysql+pymysql://freezer:freezer@localhost/freezer',
|
||||
:idle_timeout => '3601',
|
||||
:min_pool_size => '2',
|
||||
:max_pool_size => '11',
|
||||
:max_retries => '11',
|
||||
:retry_interval => '11',
|
||||
:max_overflow => '21',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'with postgresql backend' do
|
||||
let :params do
|
||||
{ :database_connection => 'postgresql://freezer:freezer@localhost/freezer', }
|
||||
{ :database_connection => 'postgresql://freezer:freezer@localhost/freezer', }
|
||||
end
|
||||
|
||||
it 'install the proper backend package' do
|
||||
|
@ -50,7 +54,7 @@ describe 'freezer::db' do
|
|||
|
||||
context 'with MySQL-python library as backend package' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql://freezer:freezer@localhost/freezer', }
|
||||
{ :database_connection => 'mysql://freezer:freezer@localhost/freezer', }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('python-mysqldb').with(:ensure => 'present') }
|
||||
|
@ -58,7 +62,7 @@ describe 'freezer::db' do
|
|||
|
||||
context 'with incorrect database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foodb://freezer:freezer@localhost/freezer', }
|
||||
{ :database_connection => 'foodb://freezer:freezer@localhost/freezer', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
|
@ -66,7 +70,7 @@ describe 'freezer::db' do
|
|||
|
||||
context 'with incorrect pymysql database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foo+pymysql://freezer:freezer@localhost/freezer', }
|
||||
{ :database_connection => 'foo+pymysql://freezer:freezer@localhost/freezer', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
|
@ -77,7 +81,7 @@ describe 'freezer::db' do
|
|||
shared_examples_for 'freezer::db on Debian' do
|
||||
context 'using pymysql driver' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://freezer:freezer@localhost/freezer', }
|
||||
{ :database_connection => 'mysql+pymysql://freezer:freezer@localhost/freezer', }
|
||||
end
|
||||
|
||||
it 'install the proper backend package' do
|
||||
|
|
Loading…
Reference in New Issue