]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/spec_helper_acceptance.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / spec_helper_acceptance.rb
1 require 'beaker-rspec/spec_helper'
2 require 'beaker-rspec/helpers/serverspec'
3
4
5 unless ENV['RS_PROVISION'] == 'no'
6   # This will install the latest available package on el and deb based
7   # systems fail on windows and osx, and install via gem on other *nixes
8   foss_opts = { :default_action => 'gem_install' }
9
10   if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
11
12   hosts.each do |host|
13     if host['platform'] =~ /debian/
14       on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc'
15     end
16
17     on host, "mkdir -p #{host['distmoduledir']}"
18   end
19 end
20
21 UNSUPPORTED_PLATFORMS = ['Suse','windows','AIX','Solaris']
22
23 RSpec.configure do |c|
24   # Project root
25   proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
26
27   # Readable test descriptions
28   c.formatter = :documentation
29
30   # Configure all nodes in nodeset
31   c.before :suite do
32     # Install module and dependencies
33     hosts.each do |host|
34       copy_module_to(host, :source => proj_root, :module_name => 'apache')
35       # Required for mod_passenger tests.
36       if fact('osfamily') == 'RedHat'
37         on host, puppet('module','install','stahnma/epel'), { :acceptable_exit_codes => [0,1] }
38       end
39       # Required for manifest to make mod_pagespeed repository available
40       if fact('osfamily') == 'Debian'
41         on host, puppet('module','install','puppetlabs-apt', '--version 1.8.0', '--force'), { :acceptable_exit_codes => [0,1] }
42       end
43       on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
44       on host, puppet('module','install','puppetlabs-concat', '--version 1.1.1', '--force'), { :acceptable_exit_codes => [0,1] }
45
46       # Make sure selinux is disabled before each test or apache won't work.
47       if ! UNSUPPORTED_PLATFORMS.include?(fact('osfamily'))
48         on host, puppet('apply', '-e',
49                           %{"exec { 'setenforce 0': path   => '/bin:/sbin:/usr/bin:/usr/sbin', onlyif => 'which setenforce && getenforce | grep Enforcing', }"}),
50                           { :acceptable_exit_codes => [0] }
51       end
52     end
53   end
54 end