view modules/apache/spec/defines/vhost_custom_spec.rb @ 257:675c1cc61eaf

Update Apache module to get CentOS 8 support Unfortunately it only fixes some bits. mod_wsgi still needs other approaches This also overrides the vhost modification to make them come last in the import order (after module loading)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Dec 2019 14:43:29 -0500
parents
children d9352a684e62
line wrap: on
line source

require 'spec_helper'

describe 'apache::vhost::custom', :type => :define do
  let :title do
    'rspec.example.com'
  end
  let :default_params do
    {
      :content => 'foobar'
    }
  end
  describe 'os-dependent items' do
    context "on RedHat based systems" do
      let :default_facts do
        {
          :osfamily               => 'RedHat',
          :operatingsystemrelease => '6',
          :operatingsystem        => 'RedHat',
          :concat_basedir         => '/dne',
          :id                     => 'root',
          :kernel                 => 'Linux',
          :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
          :is_pe                  => false,
        }
      end
      let :params do default_params end
      let :facts do default_facts end
    end
    context "on Debian based systems" do
      let :default_facts do
        {
          :osfamily               => 'Debian',
          :operatingsystemrelease => '6',
          :lsbdistcodename        => 'squeeze',
          :operatingsystem        => 'Debian',
          :concat_basedir         => '/dne',
          :id                     => 'root',
          :kernel                 => 'Linux',
          :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
          :is_pe                  => false,
        }
      end
      let :params do default_params end
      let :facts do default_facts end
      it { is_expected.to contain_file("apache_rspec.example.com").with(
        :ensure  => 'present',
        :content => 'foobar',
        :path    => '/etc/apache2/sites-available/25-rspec.example.com.conf',
      ) }
      it { is_expected.to contain_file("25-rspec.example.com.conf symlink").with(
        :ensure => 'link',
        :path   => '/etc/apache2/sites-enabled/25-rspec.example.com.conf',
        :target => '/etc/apache2/sites-available/25-rspec.example.com.conf'
      ) }
    end
    context "on FreeBSD systems" do
      let :default_facts do
        {
          :osfamily               => 'FreeBSD',
          :operatingsystemrelease => '9',
          :operatingsystem        => 'FreeBSD',
          :concat_basedir         => '/dne',
          :id                     => 'root',
          :kernel                 => 'FreeBSD',
          :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
          :is_pe                  => false,
        }
      end
      let :params do default_params end
      let :facts do default_facts end
      it { is_expected.to contain_file("apache_rspec.example.com").with(
        :ensure  => 'present',
        :content => 'foobar',
        :path    => '/usr/local/etc/apache24/Vhosts/25-rspec.example.com.conf',
      ) }
    end
    context "on Gentoo systems" do
      let :default_facts do
        {
          :osfamily               => 'Gentoo',
          :operatingsystem        => 'Gentoo',
          :operatingsystemrelease => '3.16.1-gentoo',
          :concat_basedir         => '/dne',
          :id                     => 'root',
          :kernel                 => 'Linux',
          :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
          :is_pe                  => false,
        }
      end
      let :params do default_params end
      let :facts do default_facts end
      it { is_expected.to contain_file("apache_rspec.example.com").with(
        :ensure  => 'present',
        :content => 'foobar',
        :path    => '/etc/apache2/vhosts.d/25-rspec.example.com.conf',
      ) }
    end
  end
end