From 1f5c12f544e38bc083292ee186c05fc47187807e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Mon, 29 Apr 2013 19:30:43 -0400 Subject: [PATCH] Fix rspec tests to support latest apache module Latest apache module requires new dependencies: concat and firewall. It now requires those facts: * operatingsystemrelease * concat_basedir (required by concat) Change-Id: Ic561ec756c844c3b3cbe0c441a3d9a0d8c1abe9b --- .fixtures.yml | 2 ++ spec/classes/horizon_init_spec.rb | 54 +++++++++++++------------------ 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 6f98c24f..daaf73dd 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,6 +1,8 @@ fixtures: repositories: "apache": "git://github.com/puppetlabs/puppetlabs-apache.git" + "concat": "git://github.com/ripienaar/puppet-concat.git" + "firewall": "git://github.com/puppetlabs/puppetlabs-firewall.git" "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" symlinks: "horizon": "#{source_dir}" diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index ff7ddbb4..16a2c451 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -12,28 +12,32 @@ describe 'horizon' do 'include apache' end - describe 'when running on redhat' do - let :facts do - { - 'osfamily' => 'RedHat' - } - end - - it { - should contain_service('httpd').with_name('httpd') - } + let :facts do + { :concat_basedir => '/var/lib/puppet/concat' } end - describe 'when running on debian' do - let :facts do - { - 'osfamily' => 'Debian' - } + describe 'on RedHat platforms' do + before do + facts.merge!({ + :osfamily => 'RedHat', + :operatingsystemrelease => '6.0' + }) end - it { - should contain_service('httpd').with_name('apache2') - } + it { should contain_service('httpd').with_name('httpd') } + it { should contain_file('/etc/httpd/conf.d/openstack-dashboard.conf') } + end + + describe 'on Debian platforms' do + before do + facts.merge!({ + :osfamily => 'Debian', + :operatingsystemrelease => '6.0' + }) + end + + it { should contain_service('httpd').with_name('apache2') } + it { should_not contain_file('/etc/httpd/conf.d/openstack-dashboard.conf') } describe 'with default parameters' do it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'$/) } @@ -70,18 +74,4 @@ describe 'horizon' do it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^\s*'can_set_mount_point': False$/) } end end - describe 'vhost config' do - describe 'on debian' do - let :facts do - {:osfamily => 'Debian'} - end - it { should_not contain_file('/etc/httpd/conf.d/openstack-dashboard.conf') } - end - describe 'on redhat' do - let :facts do - {:osfamily => 'Redhat'} - end - it { should contain_file('/etc/httpd/conf.d/openstack-dashboard.conf') } - end - end end