2013-06-05 18:35:34 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'nginx' do
|
2013-11-22 04:10:53 +01:00
|
|
|
let :params do
|
|
|
|
{
|
2014-08-20 14:55:41 +02:00
|
|
|
:nginx_upstreams => { 'upstream1' => { 'members' => ['localhost:3000']} },
|
|
|
|
:nginx_vhosts => { 'test2.local' => { 'www_root' => '/' } },
|
|
|
|
:nginx_vhosts_defaults => { 'listen_options' => 'default_server' },
|
|
|
|
:nginx_locations => { 'test2.local' => { 'vhost' => 'test2.local', 'www_root' => '/'} },
|
|
|
|
:nginx_mailhosts => { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587} }
|
2013-11-22 04:10:53 +01:00
|
|
|
}
|
2013-06-05 18:35:34 +02:00
|
|
|
end
|
|
|
|
|
2013-12-07 21:36:40 +01:00
|
|
|
shared_examples "a Linux OS" do
|
2014-07-18 04:28:38 +02:00
|
|
|
it { is_expected.to compile.with_all_deps }
|
|
|
|
it { is_expected.to contain_class('nginx') }
|
|
|
|
it { is_expected.to contain_anchor('nginx::begin') }
|
|
|
|
it { is_expected.to contain_nginx__package.that_requires('Anchor[nginx::begin]') }
|
|
|
|
it { is_expected.to contain_nginx__config.that_requires('Class[nginx::package]') }
|
|
|
|
it { is_expected.to contain_nginx__service.that_subscribes_to('Anchor[nginx::begin]') }
|
|
|
|
it { is_expected.to contain_nginx__service.that_subscribes_to('Class[nginx::package]') }
|
|
|
|
it { is_expected.to contain_nginx__service.that_subscribes_to('Class[nginx::config]') }
|
|
|
|
it { is_expected.to contain_anchor('nginx::end').that_requires('Class[nginx::service]') }
|
|
|
|
it { is_expected.to contain_nginx__resource__upstream("upstream1") }
|
|
|
|
it { is_expected.to contain_nginx__resource__vhost("test2.local") }
|
2014-08-20 14:55:41 +02:00
|
|
|
it { is_expected.to contain_nginx__resource__vhost("test2.local").with_listen_options('default_server') }
|
2014-07-18 04:28:38 +02:00
|
|
|
it { is_expected.to contain_nginx__resource__location("test2.local") }
|
|
|
|
it { is_expected.to contain_nginx__resource__mailhost("smtp.test2.local") }
|
2013-06-05 18:35:34 +02:00
|
|
|
end
|
|
|
|
|
2013-12-07 21:36:40 +01:00
|
|
|
context "Debian OS" do
|
|
|
|
it_behaves_like "a Linux OS" do
|
|
|
|
let :facts do
|
|
|
|
{
|
|
|
|
:operatingsystem => 'Debian',
|
|
|
|
:osfamily => 'Debian',
|
|
|
|
:lsbdistcodename => 'precise',
|
2014-07-17 03:59:36 +02:00
|
|
|
:lsbdistid => 'Debian',
|
2013-12-07 21:36:40 +01:00
|
|
|
}
|
|
|
|
end
|
2013-11-22 04:10:53 +01:00
|
|
|
end
|
|
|
|
end
|
2013-09-04 19:29:30 +02:00
|
|
|
|
2013-12-07 21:36:40 +01:00
|
|
|
context "RedHat OS" do
|
|
|
|
it_behaves_like "a Linux OS" do
|
|
|
|
let :facts do
|
|
|
|
{
|
|
|
|
:operatingsystem => 'RedHat',
|
|
|
|
:osfamily => 'RedHat',
|
|
|
|
}
|
|
|
|
end
|
2013-09-04 19:29:30 +02:00
|
|
|
end
|
2013-12-07 21:36:40 +01:00
|
|
|
end
|
2013-09-04 19:29:30 +02:00
|
|
|
|
2013-12-07 21:36:40 +01:00
|
|
|
context "Suse OS" do
|
|
|
|
it_behaves_like "a Linux OS" do
|
|
|
|
let :facts do
|
|
|
|
{
|
|
|
|
:operatingsystem => 'SuSE',
|
|
|
|
:osfamily => 'Suse',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2013-11-22 04:10:53 +01:00
|
|
|
end
|
2013-06-05 18:35:34 +02:00
|
|
|
end
|