3 describe 'apache::mod::remoteip', :type => :class do
9 context "on a Debian OS" do
12 :osfamily => 'Debian',
13 :operatingsystemrelease => '8',
14 :concat_basedir => '/dne',
15 :lsbdistcodename => 'jessie',
16 :operatingsystem => 'Debian',
19 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
23 { :apache_version => '2.4' }
25 it { is_expected.to contain_class("apache::params") }
26 it { is_expected.to contain_apache__mod('remoteip') }
27 it { is_expected.to contain_file('remoteip.conf').with({
28 'path' => '/etc/apache2/mods-available/remoteip.conf',
31 describe "with header X-Forwarded-For" do
33 { :header => 'X-Forwarded-For' }
35 it { is_expected.to contain_file('remoteip.conf').with_content(/^RemoteIPHeader X-Forwarded-For$/) }
37 describe "with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]" do
39 { :proxy_ips => [ '10.42.17.8', '10.42.18.99' ] }
41 it { is_expected.to contain_file('remoteip.conf').with_content(/^RemoteIPInternalProxy 10.42.17.8$/) }
42 it { is_expected.to contain_file('remoteip.conf').with_content(/^RemoteIPInternalProxy 10.42.18.99$/) }
44 describe "with Apache version < 2.4" do
46 { :apache_version => '2.2' }
49 expect { catalogue }.to raise_error(Puppet::Error, /mod_remoteip is only available in Apache 2.4/)