From 3934ea2d2211582452251e814d5505c66a2304bd Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 13 May 2024 00:01:09 +0900 Subject: [PATCH] Improve unit test coverage Validate a few resources which are not covered, to improve test coverage. Change-Id: Ie165830609ee5b91fcad324a2b030223c566831e --- spec/defines/oslo_db_spec.rb | 11 +++++++---- spec/defines/oslo_privsep_spec.rb | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/spec/defines/oslo_db_spec.rb b/spec/defines/oslo_db_spec.rb index 875eb4d..5fcec50 100644 --- a/spec/defines/oslo_db_spec.rb +++ b/spec/defines/oslo_db_spec.rb @@ -10,8 +10,8 @@ describe 'oslo::db' do it 'configure oslo_db default params' do is_expected.to contain_keystone_config('database/sqlite_synchronous').with_value('') is_expected.to contain_keystone_config('database/backend').with_value('') - is_expected.to contain_keystone_config('database/connection').with_value('') - is_expected.to contain_keystone_config('database/slave_connection').with_value('') + is_expected.to contain_keystone_config('database/connection').with_value('').with_secret(true) + is_expected.to contain_keystone_config('database/slave_connection').with_value('').with_secret(true) is_expected.to contain_keystone_config('database/mysql_sql_mode').with_value('') is_expected.to contain_keystone_config('database/connection_recycle_time').with_value('') is_expected.to contain_keystone_config('database/max_pool_size').with_value('') @@ -35,7 +35,8 @@ describe 'oslo::db' do { :config_group => 'custom_group', :backend => 'sqlalchemy', - :connection => 'mysql+pymysql://db:db@localhost/db', + :connection => 'mysql+pymysql://db:db@master/db', + :slave_connection => 'mysql+pymysql://db:db@slave/db', :mysql_sql_mode => 'TRADITIONAL', :connection_recycle_time => '3601', :max_pool_size => '100', @@ -55,8 +56,10 @@ describe 'oslo::db' do end it 'configures database parameters' do + is_expected.to contain_keystone_config('custom_group/sqlite_synchronous').with_value('') is_expected.to contain_keystone_config('custom_group/backend').with_value('sqlalchemy') - is_expected.to contain_keystone_config('custom_group/connection').with_value('mysql+pymysql://db:db@localhost/db').with_secret(true) + is_expected.to contain_keystone_config('custom_group/connection').with_value('mysql+pymysql://db:db@master/db').with_secret(true) + is_expected.to contain_keystone_config('custom_group/slave_connection').with_value('mysql+pymysql://db:db@slave/db').with_secret(true) is_expected.to contain_keystone_config('custom_group/mysql_sql_mode').with_value('TRADITIONAL') is_expected.to contain_keystone_config('custom_group/connection_recycle_time').with_value('3601') is_expected.to contain_keystone_config('custom_group/max_pool_size').with_value('100') diff --git a/spec/defines/oslo_privsep_spec.rb b/spec/defines/oslo_privsep_spec.rb index bb73718..f8df1ab 100644 --- a/spec/defines/oslo_privsep_spec.rb +++ b/spec/defines/oslo_privsep_spec.rb @@ -54,7 +54,9 @@ describe 'oslo::privsep' do is_expected.to contain_keystone_config('mysection/user').with_value('') is_expected.to contain_keystone_config('mysection/group').with_value('') is_expected.to contain_keystone_config('mysection/capabilities').with_value('') + is_expected.to contain_keystone_config('mysection/thread_pool_size').with_value('') is_expected.to contain_keystone_config('mysection/helper_command').with_value('') + is_expected.to contain_keystone_config('mysection/logger_name').with_value('') end end