From b787d7fecdce40e6c4eda18426b284a40d3d2bb0 Mon Sep 17 00:00:00 2001 From: Nate Potter Date: Thu, 12 Nov 2015 16:14:14 +0000 Subject: [PATCH] Add test coverage for cinder::db::mysql Currently most of the tests in cinder_db_mysql_spec.rb aren't checking anything, they're just setting up the params framework. This patch will add test coverage for mysql. Change-Id: If10a466821f03ae96e7885840829acd79fc3dcce --- spec/classes/cinder_db_mysql_spec.rb | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/classes/cinder_db_mysql_spec.rb b/spec/classes/cinder_db_mysql_spec.rb index 0090f10e..b3421626 100644 --- a/spec/classes/cinder_db_mysql_spec.rb +++ b/spec/classes/cinder_db_mysql_spec.rb @@ -27,6 +27,7 @@ describe 'cinder::db::mysql' do :collate => 'utf8_general_ci', ) } end + describe "overriding allowed_hosts param to array" do let :params do { @@ -35,7 +36,17 @@ describe 'cinder::db::mysql' do } end + it { is_expected.to contain_openstacklib__db__mysql('cinder').with( + :user => 'cinder', + :password_hash => '*1C8A189441ED992638DD234B6711CD5064DA8C6E', + :host => '127.0.0.1', + :charset => 'utf8', + :collate => 'utf8_general_ci', + :allowed_hosts => ['127.0.0.1', '%'] + ) } + end + describe "overriding allowed_hosts param to string" do let :params do { @@ -44,6 +55,15 @@ describe 'cinder::db::mysql' do } end + it { is_expected.to contain_openstacklib__db__mysql('cinder').with( + :user => 'cinder', + :password_hash => '*0E9E710049E74D36D29D615DFC55F3FFD45413BC', + :host => '127.0.0.1', + :charset => 'utf8', + :collate => 'utf8_general_ci', + :allowed_hosts => '192.168.1.1', + ) } + end describe "overriding allowed_hosts param equals to host param " do @@ -54,5 +74,15 @@ describe 'cinder::db::mysql' do } end + it { is_expected.to contain_openstacklib__db__mysql('cinder').with( + :user => 'cinder', + :password_hash => '*0E9E710049E74D36D29D615DFC55F3FFD45413BC', + :host => '127.0.0.1', + :charset => 'utf8', + :collate => 'utf8_general_ci', + :allowed_hosts => '127.0.0.1', + ) } + end + end