diff options
author | Micah <micah@leap.se> | 2016-07-12 16:46:28 -0400 |
---|---|---|
committer | Micah <micah@leap.se> | 2016-07-12 16:46:28 -0400 |
commit | 1e1e25286b64790141c9627f81b50f579b13b719 (patch) | |
tree | 0bddd4510b108b4f2e8a5abc0332972efeedd1da /puppet/modules/rsyslog/spec/defines | |
parent | 850a14b59444737f703686d0d1996bf09ab08e2b (diff) |
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
Diffstat (limited to 'puppet/modules/rsyslog/spec/defines')
-rw-r--r-- | puppet/modules/rsyslog/spec/defines/rsyslog_imfile_spec.rb | 169 | ||||
-rw-r--r-- | puppet/modules/rsyslog/spec/defines/rsyslog_snippet_spec.rb | 157 |
2 files changed, 326 insertions, 0 deletions
diff --git a/puppet/modules/rsyslog/spec/defines/rsyslog_imfile_spec.rb b/puppet/modules/rsyslog/spec/defines/rsyslog_imfile_spec.rb new file mode 100644 index 00000000..1c505eb7 --- /dev/null +++ b/puppet/modules/rsyslog/spec/defines/rsyslog_imfile_spec.rb @@ -0,0 +1,169 @@ +require 'spec_helper' + +describe 'rsyslog::imfile', :type => :define 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 + + let (:params) { + { + 'file_name' => 'mylogfile', + 'file_tag' => 'mytag', + 'file_facility' => 'myfacility', + } + } + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-imfile-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + let (:params) { + { + 'file_name' => 'mylogfile', + 'file_tag' => 'mytag', + 'file_facility' => 'myfacility', + } + } + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-imfile-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + let (:params) { + { + 'file_name' => 'mylogfile', + 'file_tag' => 'mytag', + 'file_facility' => 'myfacility', + } + } + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-imfile-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.d/rsyslog-imfile-basic.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 + + let (:params) { + { + 'file_name' => 'mylogfile', + 'file_tag' => 'mytag', + 'file_facility' => 'myfacility', + } + } + + context "default usage (osfamily = RedHat)" do + let(:title) { 'rsyslog-imfile-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') + end + end + end + + context "osfamily = Debian" do + let :facts do + default_facts.merge!({ + :osfamily => 'Debian', + }) + end + + let (:params) { + { + 'file_name' => 'mylogfile', + 'file_tag' => 'mytag', + 'file_facility' => 'myfacility', + } + } + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-imfile-basic' } + + it 'should compile' do + should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') + end + end + end + + context "osfamily = FreeBSD" do + let :facts do + default_facts.merge!({ + :osfamily => 'freebsd', + }) + end + + let (:params) { + { + 'file_name' => 'mylogfile', + 'file_tag' => 'mytag', + 'file_facility' => 'myfacility', + } + } + + context "default usage (osfamily = Debian)" do + let(:title) { 'rsyslog-imfile-basic' } + + it 'should compile' do + should contain_file('/etc/syslog.d/rsyslog-imfile-basic.conf') + end + end + end + end + +end diff --git a/puppet/modules/rsyslog/spec/defines/rsyslog_snippet_spec.rb b/puppet/modules/rsyslog/spec/defines/rsyslog_snippet_spec.rb new file mode 100644 index 00000000..6cc68839 --- /dev/null +++ b/puppet/modules/rsyslog/spec/defines/rsyslog_snippet_spec.rb @@ -0,0 +1,157 @@ +require 'spec_helper'
+
+describe 'rsyslog::snippet', :type => :define 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
+
+ let (:params) {
+ {
+ 'content' => 'Random Content',
+ }
+ }
+
+ context "default usage (osfamily = RedHat)" do
+ let(:title) { 'rsyslog-snippet-basic' }
+
+ it 'should compile' do
+ should contain_file('/etc/rsyslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n")
+ end
+ end
+ end
+
+ context "osfamily = Debian" do
+ let :facts do
+ default_facts.merge!({
+ :osfamily => 'Debian',
+ })
+ end
+
+ let (:params) {
+ {
+ 'content' => 'Random Content',
+ }
+ }
+
+ context "default usage (osfamily = Debian)" do
+ let(:title) { 'rsyslog-snippet-basic' }
+
+ it 'should compile' do
+ should contain_file('/etc/rsyslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n")
+ end
+ end
+ end
+
+ context "osfamily = FreeBSD" do
+ let :facts do
+ default_facts.merge!({
+ :osfamily => 'freebsd',
+ })
+ end
+
+ let (:params) {
+ {
+ 'content' => 'Random Content',
+ }
+ }
+
+ context "default usage (osfamily = Debian)" do
+ let(:title) { 'rsyslog-snippet-basic' }
+
+ it 'should compile' do
+ should contain_file('/etc/syslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n")
+ 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
+
+ let (:params) {
+ {
+ 'content' => 'Random Content',
+ }
+ }
+
+ context "default usage (osfamily = RedHat)" do
+ let(:title) { 'rsyslog-snippet-basic' }
+
+ it 'should compile' do
+ should contain_file('/etc/rsyslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n")
+ end
+ end
+ end
+
+ context "osfamily = Debian" do
+ let :facts do
+ default_facts.merge!({
+ :osfamily => 'Debian',
+ })
+ end
+
+ let (:params) {
+ {
+ 'content' => 'Random Content',
+ }
+ }
+
+ context "default usage (osfamily = Debian)" do
+ let(:title) { 'rsyslog-snippet-basic' }
+
+ it 'should compile' do
+ should contain_file('/etc/rsyslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n")
+ end
+ end
+ end
+
+ context "osfamily = FreeBSD" do
+ let :facts do
+ default_facts.merge!({
+ :osfamily => 'freebsd',
+ })
+ end
+
+ let (:params) {
+ {
+ 'content' => 'Random Content',
+ }
+ }
+
+ context "default usage (osfamily = Debian)" do
+ let(:title) { 'rsyslog-snippet-basic' }
+
+ it 'should compile' do
+ should contain_file('/etc/syslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n")
+ end
+ end
+ end
+ end
+
+end
|