diff --git a/spec/classes/heat_db_spec.rb b/spec/classes/heat_db_spec.rb index 13e12d8d..e8328d89 100644 --- a/spec/classes/heat_db_spec.rb +++ b/spec/classes/heat_db_spec.rb @@ -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('') } - it { is_expected.to contain_heat_config('database/min_pool_size').with_value('') } - it { is_expected.to contain_heat_config('database/max_pool_size').with_value('') } - it { is_expected.to contain_heat_config('database/max_retries').with_value('') } - it { is_expected.to contain_heat_config('database/retry_interval').with_value('') } - it { is_expected.to contain_heat_config('database/db_max_retries').with_value('') } + it { is_expected.to contain_oslo__db('heat_config').with( + :db_max_retries => '', + :connection => 'sqlite:////var/lib/heat/heat.sqlite', + :idle_timeout => '', + :min_pool_size => '', + :max_pool_size => '', + :max_retries => '', + :retry_interval => '', + )} 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]