1 require 'spec_helper_acceptance'
5 mod_dir = '/etc/httpd/conf.d'
8 mod_dir = '/etc/apache2/mods-available'
9 servicename = 'apache2'
11 mod_dir = '/usr/local/etc/apache24/Modules'
12 servicename = 'apache24'
14 mod_dir = '/etc/apache2/modules.d'
15 servicename = 'apache2'
18 describe 'apache::default_mods class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
19 describe 'no default mods' do
20 # Using puppet_apply as a helper
21 it 'should apply with no errors' do
24 default_mods => false,
28 # Run it twice and test for idempotency
29 apply_manifest(pp, :catch_failures => true)
30 expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
33 describe service(servicename) do
34 it { is_expected.to be_running }
38 describe 'no default mods and failing' do
39 # Using puppet_apply as a helper
40 it 'should apply with errors' do
43 default_mods => false,
45 apache::vhost { 'defaults.example.com':
46 docroot => '/var/www/defaults',
49 path => '/var/www/css',
51 setenv => 'TEST1 one',
55 apply_manifest(pp, { :expect_failures => true })
59 describe service(servicename) do
60 it { is_expected.not_to be_running }
62 describe "service #{servicename}" do
63 it 'should not be running' do
64 shell("pidof #{servicename}", {:acceptable_exit_codes => 1})
69 describe 'alternative default mods' do
70 # Using puppet_apply as a helper
71 it 'should apply with no errors' do
82 apache::vhost { 'defaults.example.com':
83 docroot => '/var/www/defaults',
86 path => '/var/www/css',
88 setenv => 'TEST1 one',
92 apply_manifest(pp, :catch_failures => true)
94 expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
97 describe service(servicename) do
98 it { is_expected.to be_running }
102 describe 'change loadfile name' do
103 it 'should apply with no errors' do
105 class { 'apache': default_mods => false }
106 ::apache::mod { 'auth_basic':
107 loadfile_name => 'zz_auth_basic.load',
110 # Run it twice and test for idempotency
111 apply_manifest(pp, :catch_failures => true)
112 expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
115 describe service(servicename) do
116 it { is_expected.to be_running }
119 describe file("#{mod_dir}/zz_auth_basic.load") do
120 it { is_expected.to be_file }