From 1e1e25286b64790141c9627f81b50f579b13b719 Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 12 Jul 2016 16:46:28 -0400 Subject: git subrepo clone https://leap.se/git/puppet_rsyslog puppet/modules/rsyslog subrepo: subdir: "puppet/modules/rsyslog" merged: "b8ef11c" upstream: origin: "https://leap.se/git/puppet_rsyslog" branch: "master" commit: "b8ef11c" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "1e79595" Change-Id: Iee06502c6df609f1a261410742360cec8694dab5 --- .../rsyslog/spec/classes/rsyslog_client_spec.rb | 146 +++++++ .../rsyslog/spec/classes/rsyslog_database_spec.rb | 308 ++++++++++++++ .../rsyslog/spec/classes/rsyslog_server_spec.rb | 182 ++++++++ .../modules/rsyslog/spec/classes/rsyslog_spec.rb | 469 +++++++++++++++++++++ 4 files changed, 1105 insertions(+) create mode 100644 puppet/modules/rsyslog/spec/classes/rsyslog_client_spec.rb create mode 100644 puppet/modules/rsyslog/spec/classes/rsyslog_database_spec.rb create mode 100644 puppet/modules/rsyslog/spec/classes/rsyslog_server_spec.rb create mode 100644 puppet/modules/rsyslog/spec/classes/rsyslog_spec.rb (limited to 'puppet/modules/rsyslog/spec/classes') diff --git a/puppet/modules/rsyslog/spec/classes/rsyslog_client_spec.rb b/puppet/modules/rsyslog/spec/classes/rsyslog_client_spec.rb new file mode 100644 index 00000000..82865db9 --- /dev/null +++ b/puppet/modules/rsyslog/spec/classes/rsyslog_client_spec.rb @@ -0,0 +1,146 @@ +require 'spec_helper' + +describe 'rsyslog::client', :type => :class do + + context "Rsyslog version >= 8" do + let(:default_facts) do + { + :rsyslog_version => '8.1.2' + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/client.conf') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/client.conf') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.d/client.conf') + end + end + end + end + + context "Rsyslog version =< 8" do + let(:default_facts) do + { + :rsyslog_version => '7.1.2' + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/client.conf') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/client.conf') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.d/client.conf') + end + end + end + end + + context "Rsyslog version = nil" do + let(:default_facts) do + { + :rsyslog_version => nil + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-client-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/client.conf') + end + end + end + end +end diff --git a/puppet/modules/rsyslog/spec/classes/rsyslog_database_spec.rb b/puppet/modules/rsyslog/spec/classes/rsyslog_database_spec.rb new file mode 100644 index 00000000..0421135a --- /dev/null +++ b/puppet/modules/rsyslog/spec/classes/rsyslog_database_spec.rb @@ -0,0 +1,308 @@ +require 'spec_helper' + +describe 'rsyslog::database', :type => :class do + + context "Rsyslog version >= 8" do + let(:default_facts) do + { + :rsyslog_version => '8.1.2' + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage mysql (osfamily = RedHat)" do + let(:title) { 'rsyslog-database-mysql' } + + let (:params) { + { + 'backend' => 'mysql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-mysql') + should contain_file('/etc/rsyslog.d/mysql.conf') + end + end + + context "default usage pgsql (osfamily = RedHat)" do + let(:title) { 'rsyslog-database-pgsql' } + + let (:params) { + { + 'backend' => 'pgsql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-pgsql') + should contain_file('/etc/rsyslog.d/pgsql.conf') + end + end + end + + + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage mysql (osfamily = Debian)" do + let(:title) { 'rsyslog-database-mysql' } + + let (:params) { + { + 'backend' => 'mysql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-mysql') + should contain_file('/etc/rsyslog.d/mysql.conf') + end + end + + context "default usage pgsql (osfamily = Debian)" do + let(:title) { 'rsyslog-database-pgsql' } + + let (:params) { + { + 'backend' => 'pgsql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-pgsql') + should contain_file('/etc/rsyslog.d/pgsql.conf') + end + end + end + + + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage mysql (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-database-mysql' } + + let (:params) { + { + 'backend' => 'mysql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('sysutils/rsyslog5-mysql') + should contain_file('/etc/syslog.d/mysql.conf') + end + end + + context "default usage pgsql (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-database-pgsql' } + + let (:params) { + { + 'backend' => 'pgsql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('sysutils/rsyslog5-pgsql') + should contain_file('/etc/syslog.d/pgsql.conf') + end + end + end + end + + context "Rsyslog version =< 8" do + let(:default_facts) do + { + :rsyslog_version => '7.1.2' + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage mysql (osfamily = RedHat)" do + let(:title) { 'rsyslog-database-mysql' } + + let (:params) { + { + 'backend' => 'mysql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-mysql') + should contain_file('/etc/rsyslog.d/mysql.conf') + end + end + + context "default usage pgsql (osfamily = RedHat)" do + let(:title) { 'rsyslog-database-pgsql' } + + let (:params) { + { + 'backend' => 'pgsql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-pgsql') + should contain_file('/etc/rsyslog.d/pgsql.conf') + end + end + end + + + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage mysql (osfamily = Debian)" do + let(:title) { 'rsyslog-database-mysql' } + + let (:params) { + { + 'backend' => 'mysql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-mysql') + should contain_file('/etc/rsyslog.d/mysql.conf') + end + end + + context "default usage pgsql (osfamily = Debian)" do + let(:title) { 'rsyslog-database-pgsql' } + + let (:params) { + { + 'backend' => 'pgsql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('rsyslog-pgsql') + should contain_file('/etc/rsyslog.d/pgsql.conf') + end + end + end + + + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage mysql (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-database-mysql' } + + let (:params) { + { + 'backend' => 'mysql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('sysutils/rsyslog5-mysql') + should contain_file('/etc/syslog.d/mysql.conf') + end + end + + context "default usage pgsql (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-database-pgsql' } + + let (:params) { + { + 'backend' => 'pgsql', + 'server' => 'localhost', + 'database' => 'rsyslog', + 'username' => 'us3rname', + 'password' => 'passw0rd', + } + } + + it 'should compile' do + should contain_package('sysutils/rsyslog5-pgsql') + should contain_file('/etc/syslog.d/pgsql.conf') + end + end + end + end +end diff --git a/puppet/modules/rsyslog/spec/classes/rsyslog_server_spec.rb b/puppet/modules/rsyslog/spec/classes/rsyslog_server_spec.rb new file mode 100644 index 00000000..8f57656b --- /dev/null +++ b/puppet/modules/rsyslog/spec/classes/rsyslog_server_spec.rb @@ -0,0 +1,182 @@ +require 'spec_helper' + +describe 'rsyslog::server', :type => :class do + + context "Rsyslog version >= 8" do + let(:default_facts) do + { + :rsyslog_version => '8.1.2' + } + end + + ['RedHat', 'Debian'].each do |osfamily| + context "osfamily = #{osfamily}" do + let :facts do + default_facts.merge!({ + :osfamily => osfamily, + :operatingsystem => osfamily, + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = #{osfamily})" do + let(:title) { 'rsyslog-server-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "enable_onefile (osfamily = #{osfamily})" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'enable_onefile' => 'true'} } + + it 'should compile' do + should_not contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "hostname_template (osfamily = #{osfamily})" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/) + should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) + end + end + + end + end + + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-server-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "enable_onefile (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'enable_onefile' => 'true'} } + + it 'should compile' do + should_not contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "hostname_template (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } + + it 'should compile' do + should contain_file('/etc/syslog.d/server.conf').with_content(/%hostname%\/auth.log/) + should contain_file('/etc/syslog.d/server.conf').with_content(/%hostname%\/messages/) + end + end + + end + end + + context "Rsyslog version =< 8" do + let(:default_facts) do + { + :rsyslog_version => '7.1.2' + } + end + + ['RedHat', 'Debian'].each do |osfamily| + context "osfamily = #{osfamily}" do + let :facts do + default_facts.merge!({ + :osfamily => osfamily, + :operatingsystem => osfamily, + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = #{osfamily})" do + let(:title) { 'rsyslog-server-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "enable_onefile (osfamily = #{osfamily})" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'enable_onefile' => 'true'} } + + it 'should compile' do + should_not contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "hostname_template (osfamily = #{osfamily})" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/) + should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) + end + end + + end + end + + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-server-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "enable_onefile (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'enable_onefile' => 'true'} } + + it 'should compile' do + should_not contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) + should contain_file('/etc/syslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) + end + end + + context "hostname_template (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-server-onefile' } + let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } + + it 'should compile' do + should contain_file('/etc/syslog.d/server.conf').with_content(/%hostname%\/auth.log/) + should contain_file('/etc/syslog.d/server.conf').with_content(/%hostname%\/messages/) + end + end + + end + end +end # describe 'rsyslog::server' diff --git a/puppet/modules/rsyslog/spec/classes/rsyslog_spec.rb b/puppet/modules/rsyslog/spec/classes/rsyslog_spec.rb new file mode 100644 index 00000000..344d7174 --- /dev/null +++ b/puppet/modules/rsyslog/spec/classes/rsyslog_spec.rb @@ -0,0 +1,469 @@ +require 'spec_helper' + +describe 'rsyslog', :type => :class do + + context "Rsyslog version >= 8" do + let(:default_facts) do + { + :rsyslog_version => '8.1.2' + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_class('rsyslog::install') + should contain_class('rsyslog::config') + should contain_class('rsyslog::service') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_class('rsyslog::install') + should contain_class('rsyslog::config') + should contain_class('rsyslog::service') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_class('rsyslog::install') + should contain_class('rsyslog::config') + should contain_class('rsyslog::service') + end + end + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.conf') + should contain_file('/etc/rsyslog.d/') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.conf') + should contain_file('/etc/rsyslog.d/') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.conf') + should contain_file('/etc/syslog.d/') + end + end + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-install-basic' } + + it 'should compile' do + should contain_package('rsyslog') + should contain_package('rsyslog-relp') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-install-basic' } + + it 'should compile' do + should contain_package('rsyslog') + should contain_package('rsyslog-relp') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-install-basic' } + + it 'should compile' do + should contain_package('sysutils/rsyslog5') + should contain_package('sysutils/rsyslog5-relp') + end + end + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-service-basic' } + + it 'should compile' do + should contain_service('rsyslog') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-service-basic' } + + it 'should compile' do + should contain_service('rsyslog') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-service-basic' } + + it 'should compile' do + should contain_service('syslogd') + end + end + end + end + + context "Rsyslog version =< 8" do + let(:default_facts) do + { + :rsyslog_version => '7.1.2' + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_class('rsyslog::install') + should contain_class('rsyslog::config') + should contain_class('rsyslog::service') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_class('rsyslog::install') + should contain_class('rsyslog::config') + should contain_class('rsyslog::service') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = FreeBSD)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_class('rsyslog::install') + should contain_class('rsyslog::config') + should contain_class('rsyslog::service') + end + end + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.conf') + should contain_file('/etc/rsyslog.d/') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.conf') + should contain_file('/etc/rsyslog.d/') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.conf') + should contain_file('/etc/syslog.d/') + end + end + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-install-basic' } + + it 'should compile' do + should contain_package('rsyslog') + should contain_package('rsyslog-relp') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-install-basic' } + + it 'should compile' do + should contain_package('rsyslog') + should contain_package('rsyslog-relp') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-install-basic' } + + it 'should compile' do + should contain_package('sysutils/rsyslog5') + should contain_package('sysutils/rsyslog5-relp') + end + end + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-service-basic' } + + it 'should compile' do + should contain_service('rsyslog') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-service-basic' } + + it 'should compile' do + should contain_service('rsyslog') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-service-basic' } + + it 'should compile' do + should contain_service('syslogd') + end + end + end + end + + context "Rsyslog version >= 8" do + let(:default_facts) do + { + :rsyslog_version => nil + } + end + + context "osfamily = RedHat" do + let :facts do + default_facts.merge!({ + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemmajrelease => 6, + }) + end + + context "default usage (osfamily = RedHat)" do + it 'should compile' do + should contain_file('/etc/rsyslog.conf') + should contain_file('/etc/rsyslog.d/') + end + end + end + end +end -- cgit v1.2.3