From d57948dcfed13fc04db740d80760d6ea42324f3d Mon Sep 17 00:00:00 2001 From: Mykyta Karpin Date: Wed, 18 Nov 2015 13:57:58 +0200 Subject: [PATCH] Add os_service_default support to heat tests Heat classes tests are modified to support os_service_default facts. Change-Id: Ie8201de4158f1442eade93fee042453f4effb34c --- spec/classes/heat_api_cfn_spec.rb | 8 ++++++-- spec/classes/heat_api_cloudwatch_spec.rb | 8 ++++++-- spec/classes/heat_api_spec.rb | 8 ++++++-- spec/classes/heat_client_spec.rb | 8 ++++++-- spec/classes/heat_db_mysql_spec.rb | 8 +++++--- spec/classes/heat_db_postgresql_spec.rb | 4 ++-- spec/classes/heat_db_spec.rb | 10 ++++++---- spec/classes/heat_db_sync_spec.rb | 8 ++++---- spec/classes/heat_engine_spec.rb | 8 ++++++-- spec/classes/heat_init_spec.rb | 8 ++++++-- spec/classes/heat_keystone_auth_cfn_spec.rb | 8 ++++++-- spec/classes/heat_keystone_auth_spec.rb | 8 ++++++-- spec/classes/heat_keystone_domain_spec.rb | 8 ++++++-- spec/classes/heat_logging_spec.rb | 8 ++++++-- spec/classes/heat_policy_spec.rb | 8 ++++++-- spec/spec_helper.rb | 3 +++ 16 files changed, 86 insertions(+), 35 deletions(-) diff --git a/spec/classes/heat_api_cfn_spec.rb b/spec/classes/heat_api_cfn_spec.rb index fcc65d67..52d74bb0 100644 --- a/spec/classes/heat_api_cfn_spec.rb +++ b/spec/classes/heat_api_cfn_spec.rb @@ -118,7 +118,9 @@ describe 'heat::api_cfn' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end let :platform_params do @@ -130,7 +132,9 @@ describe 'heat::api_cfn' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end let :platform_params do diff --git a/spec/classes/heat_api_cloudwatch_spec.rb b/spec/classes/heat_api_cloudwatch_spec.rb index 13a7a6f7..13add0e2 100644 --- a/spec/classes/heat_api_cloudwatch_spec.rb +++ b/spec/classes/heat_api_cloudwatch_spec.rb @@ -117,7 +117,9 @@ describe 'heat::api_cloudwatch' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end let :platform_params do @@ -129,7 +131,9 @@ describe 'heat::api_cloudwatch' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end let :platform_params do diff --git a/spec/classes/heat_api_spec.rb b/spec/classes/heat_api_spec.rb index 362d0300..964ded6d 100644 --- a/spec/classes/heat_api_spec.rb +++ b/spec/classes/heat_api_spec.rb @@ -117,7 +117,9 @@ describe 'heat::api' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end let :platform_params do @@ -129,7 +131,9 @@ describe 'heat::api' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end let :platform_params do diff --git a/spec/classes/heat_client_spec.rb b/spec/classes/heat_client_spec.rb index c436131f..4c540d5a 100644 --- a/spec/classes/heat_client_spec.rb +++ b/spec/classes/heat_client_spec.rb @@ -29,7 +29,9 @@ describe 'heat::client' do context 'on Debian platform' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end it_configures 'heat client' @@ -37,7 +39,9 @@ describe 'heat::client' do context 'on RedHat platform' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end it_configures 'heat client' diff --git a/spec/classes/heat_db_mysql_spec.rb b/spec/classes/heat_db_mysql_spec.rb index fda0b86d..e0bca3df 100644 --- a/spec/classes/heat_db_mysql_spec.rb +++ b/spec/classes/heat_db_mysql_spec.rb @@ -1,9 +1,11 @@ require 'spec_helper' describe 'heat::db::mysql' do - let :facts do - { :osfamily => 'RedHat' } - end + let :facts do + @default_facts.merge({ + :osfamily => 'RedHat', + }) + end let :params do { :password => 's3cr3t', diff --git a/spec/classes/heat_db_postgresql_spec.rb b/spec/classes/heat_db_postgresql_spec.rb index 26a752a1..6767d01f 100644 --- a/spec/classes/heat_db_postgresql_spec.rb +++ b/spec/classes/heat_db_postgresql_spec.rb @@ -36,12 +36,12 @@ describe 'heat::db::postgresql' do context 'on a Debian osfamily' do let :facts do - { + @default_facts.merge({ :operatingsystemrelease => '7.8', :operatingsystem => 'Debian', :osfamily => 'Debian', :concat_basedir => '/var/lib/puppet/concat' - } + }) end context 'with only required parameters' do diff --git a/spec/classes/heat_db_spec.rb b/spec/classes/heat_db_spec.rb index 512fd0ce..a138827a 100644 --- a/spec/classes/heat_db_spec.rb +++ b/spec/classes/heat_db_spec.rb @@ -57,10 +57,11 @@ describe 'heat::db' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian', + @default_facts.merge({ + :osfamily => 'Debian', :operatingsystem => 'Debian', :operatingsystemrelease => 'jessie', - } + }) end it_configures 'heat::db' @@ -68,9 +69,10 @@ describe 'heat::db' do context 'on Redhat platforms' do let :facts do - { :osfamily => 'RedHat', + @default_facts.merge({ + :osfamily => 'RedHat', :operatingsystemrelease => '7.1', - } + }) end it_configures 'heat::db' diff --git a/spec/classes/heat_db_sync_spec.rb b/spec/classes/heat_db_sync_spec.rb index e88da806..9af86584 100644 --- a/spec/classes/heat_db_sync_spec.rb +++ b/spec/classes/heat_db_sync_spec.rb @@ -18,11 +18,11 @@ describe 'heat::db::sync' do context 'on a RedHat osfamily' do let :facts do - { + @default_facts.merge({ :osfamily => 'RedHat', :operatingsystemrelease => '7.0', :concat_basedir => '/var/lib/puppet/concat' - } + }) end it_configures 'heat-dbsync' @@ -30,12 +30,12 @@ describe 'heat::db::sync' do context 'on a Debian osfamily' do let :facts do - { + @default_facts.merge({ :operatingsystemrelease => '7.8', :operatingsystem => 'Debian', :osfamily => 'Debian', :concat_basedir => '/var/lib/puppet/concat' - } + }) end it_configures 'heat-dbsync' diff --git a/spec/classes/heat_engine_spec.rb b/spec/classes/heat_engine_spec.rb index 0db8eb20..2a9782b9 100644 --- a/spec/classes/heat_engine_spec.rb +++ b/spec/classes/heat_engine_spec.rb @@ -98,7 +98,9 @@ describe 'heat::engine' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end let :os_params do @@ -112,7 +114,9 @@ describe 'heat::engine' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end let :os_params do diff --git a/spec/classes/heat_init_spec.rb b/spec/classes/heat_init_spec.rb index b33e8e7b..24fd9fce 100644 --- a/spec/classes/heat_init_spec.rb +++ b/spec/classes/heat_init_spec.rb @@ -443,7 +443,9 @@ describe 'heat' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end let :platform_params do @@ -455,7 +457,9 @@ describe 'heat' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end let :platform_params do diff --git a/spec/classes/heat_keystone_auth_cfn_spec.rb b/spec/classes/heat_keystone_auth_cfn_spec.rb index e10993db..0f9bba32 100644 --- a/spec/classes/heat_keystone_auth_cfn_spec.rb +++ b/spec/classes/heat_keystone_auth_cfn_spec.rb @@ -149,7 +149,9 @@ describe 'heat::keystone::auth_cfn' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end it_configures 'heat keystone auth' @@ -157,7 +159,9 @@ describe 'heat::keystone::auth_cfn' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end it_configures 'heat keystone auth' diff --git a/spec/classes/heat_keystone_auth_spec.rb b/spec/classes/heat_keystone_auth_spec.rb index 4dbf2adb..a0294bbc 100644 --- a/spec/classes/heat_keystone_auth_spec.rb +++ b/spec/classes/heat_keystone_auth_spec.rb @@ -182,7 +182,9 @@ describe 'heat::keystone::auth' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end it_configures 'heat keystone auth' @@ -190,7 +192,9 @@ describe 'heat::keystone::auth' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end it_configures 'heat keystone auth' diff --git a/spec/classes/heat_keystone_domain_spec.rb b/spec/classes/heat_keystone_domain_spec.rb index c87abb5b..f68c8e0f 100644 --- a/spec/classes/heat_keystone_domain_spec.rb +++ b/spec/classes/heat_keystone_domain_spec.rb @@ -52,7 +52,9 @@ describe 'heat::keystone::domain' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end it_configures 'heat keystone domain' @@ -60,7 +62,9 @@ describe 'heat::keystone::domain' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end it_configures 'heat keystone domain' diff --git a/spec/classes/heat_logging_spec.rb b/spec/classes/heat_logging_spec.rb index 52090f59..7dae3754 100644 --- a/spec/classes/heat_logging_spec.rb +++ b/spec/classes/heat_logging_spec.rb @@ -126,7 +126,9 @@ describe 'heat::logging' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end it_configures 'heat-logging' @@ -134,7 +136,9 @@ describe 'heat::logging' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end it_configures 'heat-logging' diff --git a/spec/classes/heat_policy_spec.rb b/spec/classes/heat_policy_spec.rb index 6c1fb7c7..65cc321d 100644 --- a/spec/classes/heat_policy_spec.rb +++ b/spec/classes/heat_policy_spec.rb @@ -25,7 +25,9 @@ describe 'heat::policy' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ + :osfamily => 'Debian', + }) end it_configures 'heat policies' @@ -33,7 +35,9 @@ describe 'heat::policy' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ + :osfamily => 'RedHat', + }) end it_configures 'heat policies' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3df4cede..9bc7bcf9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,9 @@ require 'webmock/rspec' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' + c.before :each do + @default_facts = { :os_service_default => '' } + end end at_exit { RSpec::Puppet::Coverage.report! }