This commit is contained in:
Steffen Zieger 2016-08-05 09:18:33 +02:00
Родитель b47499b7b1
Коммит 37748f72fc
7 изменённых файлов: 160 добавлений и 191 удалений

Просмотреть файл

@ -21,7 +21,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf') should contain_file('/etc/rsyslog.d/client.conf')
end end
end end
@ -30,19 +30,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/etc/rsyslog.d/client.conf') should_not contain_file('/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end
@ -51,7 +51,7 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'log_filters_check' } let(:title) { 'log_filters_check' }
let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } } let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log}) should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log})
end end
end end
@ -68,7 +68,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf') should contain_file('/etc/rsyslog.d/client.conf')
end end
end end
@ -77,19 +77,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/etc/rsyslog.d/client.conf') should_not contain_file('/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end
@ -98,7 +98,7 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'log_filters_check' } let(:title) { 'log_filters_check' }
let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } } let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log}) should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log})
end end
end end
@ -109,7 +109,7 @@ describe 'rsyslog::client', :type => :class do
context "without SSL" do context "without SSL" do
let(:params) { { :ssl_auth_mode => 'x509/name' } } let(:params) { { :ssl_auth_mode => 'x509/name' } }
it 'should fail' do it 'fails' do
expect { should contain_class('rsyslog::client') }.to raise_error(Puppet::Error, /You need to enable SSL in order to use ssl_auth_mode./) expect { should contain_class('rsyslog::client') }.to raise_error(Puppet::Error, /You need to enable SSL in order to use ssl_auth_mode./)
end end
end end
@ -124,7 +124,7 @@ describe 'rsyslog::client', :type => :class do
context "with default auth_mode" do context "with default auth_mode" do
let(:params) { ssl_params } let(:params) { ssl_params }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(/\$ActionSendStreamDriverAuthMode anon/).without_content(/\$ActionSendStreamDriverPermittedPeer/) should contain_file('/etc/rsyslog.d/client.conf').with_content(/\$ActionSendStreamDriverAuthMode anon/).without_content(/\$ActionSendStreamDriverPermittedPeer/)
end end
end end
@ -136,7 +136,7 @@ describe 'rsyslog::client', :type => :class do
}) })
end end
it 'should contain ActionSendStreamDriverAuthMode' do it 'contains ActionSendStreamDriverAuthMode' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(/\$ActionSendStreamDriverAuthMode x509\/name/).without_content(/\$ActionSendStreamDriverPermittedPeer/) should contain_file('/etc/rsyslog.d/client.conf').with_content(/\$ActionSendStreamDriverAuthMode x509\/name/).without_content(/\$ActionSendStreamDriverPermittedPeer/)
end end
end end
@ -148,7 +148,7 @@ describe 'rsyslog::client', :type => :class do
}) })
end end
it 'should fail' do it 'fails' do
expect { should contain_class('rsyslog::client') }.to raise_error(Puppet::Error, /You need to set auth_mode to 'x509\/name' in order to use ssl_permitted_peer./) expect { should contain_class('rsyslog::client') }.to raise_error(Puppet::Error, /You need to set auth_mode to 'x509\/name' in order to use ssl_permitted_peer./)
end end
end end
@ -161,7 +161,7 @@ describe 'rsyslog::client', :type => :class do
}) })
end end
it 'should contain ActionSendStreamDriverPermittedPeer' do it 'contains ActionSendStreamDriverPermittedPeer' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(/\$ActionSendStreamDriverAuthMode x509\/name/).with_content(/\$ActionSendStreamDriverPermittedPeer logs.example.com/) should contain_file('/etc/rsyslog.d/client.conf').with_content(/\$ActionSendStreamDriverAuthMode x509\/name/).with_content(/\$ActionSendStreamDriverPermittedPeer logs.example.com/)
end end
end end
@ -180,7 +180,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/client.conf') should contain_file('/usr/local/etc/rsyslog.d/client.conf')
end end
end end
@ -189,19 +189,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/usr/local/etc/rsyslog.d/client.conf') should_not contain_file('/usr/local/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/usr/local/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/usr/local/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/usr/local/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/usr/local/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/usr/local/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/usr/local/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end
@ -227,7 +227,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf') should contain_file('/etc/rsyslog.d/client.conf')
end end
end end
@ -236,19 +236,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/etc/rsyslog.d/client.conf') should_not contain_file('/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end
@ -257,7 +257,7 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'log_filters_check' } let(:title) { 'log_filters_check' }
let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } } let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log}) should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log})
end end
end end
@ -274,7 +274,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf') should contain_file('/etc/rsyslog.d/client.conf')
end end
end end
@ -283,19 +283,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/etc/rsyslog.d/client.conf') should_not contain_file('/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end
@ -304,7 +304,7 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'log_filters_check' } let(:title) { 'log_filters_check' }
let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } } let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log}) should contain_file('/etc/rsyslog.d/client.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log})
end end
end end
@ -321,7 +321,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/client.conf') should contain_file('/usr/local/etc/rsyslog.d/client.conf')
end end
end end
@ -330,19 +330,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/usr/local/etc/rsyslog.d/client.conf') should_not contain_file('/usr/local/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/usr/local/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/usr/local/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/usr/local/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/usr/local/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/usr/local/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/usr/local/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end
@ -368,7 +368,7 @@ describe 'rsyslog::client', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/client.conf') should contain_file('/etc/rsyslog.d/client.conf')
end end
end end
@ -377,19 +377,19 @@ describe 'rsyslog::client', :type => :class do
let(:title) { 'rsyslog-client-basic' } let(:title) { 'rsyslog-client-basic' }
let(:params) {{ :split_config => true }} let(:params) {{ :split_config => true }}
it 'should not manage client.conf' do it 'does not manage client.conf' do
should_not contain_file('/etc/rsyslog.d/client.conf') should_not contain_file('/etc/rsyslog.d/client.conf')
end end
it 'should configure client' do it 'configures client' do
should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/00_client_config.conf').with_ensure('present')
end end
it 'should configure client remote logging' do it 'configures client remote logging' do
should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present') should contain_file('/etc/rsyslog.d/50_client_remote.conf').with_ensure('present')
end end
it 'should remove client local logging' do it 'removes client local logging' do
should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent') should contain_file('/etc/rsyslog.d/99_client_local.conf').with_ensure('absent')
end end
end end

Просмотреть файл

@ -31,7 +31,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-mysql') should contain_package('rsyslog-mysql')
should contain_file('/etc/rsyslog.d/mysql.conf') should contain_file('/etc/rsyslog.d/mysql.conf')
end end
@ -50,7 +50,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-pgsql') should contain_package('rsyslog-pgsql')
should contain_file('/etc/rsyslog.d/pgsql.conf') should contain_file('/etc/rsyslog.d/pgsql.conf')
end end
@ -80,7 +80,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-mysql') should contain_package('rsyslog-mysql')
should contain_file('/etc/rsyslog.d/mysql.conf') should contain_file('/etc/rsyslog.d/mysql.conf')
end end
@ -99,7 +99,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-pgsql') should contain_package('rsyslog-pgsql')
should contain_file('/etc/rsyslog.d/pgsql.conf') should contain_file('/etc/rsyslog.d/pgsql.conf')
end end
@ -136,7 +136,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-mysql') should contain_package('rsyslog-mysql')
should contain_file('/etc/rsyslog.d/mysql.conf') should contain_file('/etc/rsyslog.d/mysql.conf')
end end
@ -155,7 +155,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-pgsql') should contain_package('rsyslog-pgsql')
should contain_file('/etc/rsyslog.d/pgsql.conf') should contain_file('/etc/rsyslog.d/pgsql.conf')
end end
@ -185,7 +185,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-mysql') should contain_package('rsyslog-mysql')
should contain_file('/etc/rsyslog.d/mysql.conf') should contain_file('/etc/rsyslog.d/mysql.conf')
end end
@ -204,7 +204,7 @@ describe 'rsyslog::database', :type => :class do
} }
} }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog-pgsql') should contain_package('rsyslog-pgsql')
should contain_file('/etc/rsyslog.d/pgsql.conf') should contain_file('/etc/rsyslog.d/pgsql.conf')
end end

Просмотреть файл

@ -22,7 +22,7 @@ describe 'rsyslog::server', :type => :class do
context "default usage (osfamily = #{osfamily})" do context "default usage (osfamily = #{osfamily})" do
let(:title) { 'rsyslog-server-basic' } let(:title) { 'rsyslog-server-basic' }
it 'should compile' do it 'compiles' 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%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -32,7 +32,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} } let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do it 'compiles' do
should_not contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) 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/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -42,7 +42,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do it 'compiles' 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%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end end
@ -52,7 +52,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'log_filters_check' } let(:title) { 'log_filters_check' }
let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } } let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/server.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log}) should contain_file('/etc/rsyslog.d/server.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log})
end end
end end
@ -71,7 +71,7 @@ describe 'rsyslog::server', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-server-basic' } let(:title) { 'rsyslog-server-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -81,7 +81,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} } let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do it 'compiles' do
should_not contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) should_not contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -91,7 +91,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end end
@ -120,7 +120,7 @@ describe 'rsyslog::server', :type => :class do
context "default usage (osfamily = #{osfamily})" do context "default usage (osfamily = #{osfamily})" do
let(:title) { 'rsyslog-server-basic' } let(:title) { 'rsyslog-server-basic' }
it 'should compile' do it 'compiles' 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%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -130,7 +130,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} } let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do it 'compiles' do
should_not contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) 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/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -140,7 +140,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do it 'compiles' 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%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end end
@ -150,7 +150,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'log_filters_check' } let(:title) { 'log_filters_check' }
let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } } let(:params) { {'log_filters' => [{'expression' => '$msg contains \'error0\'', 'action' => '/var/log/err.log'}] } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/server.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log}) should contain_file('/etc/rsyslog.d/server.conf').with_content(%r{if \$msg contains 'error0' then /var/log/err.log})
end end
end end
@ -169,7 +169,7 @@ describe 'rsyslog::server', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-server-basic' } let(:title) { 'rsyslog-server-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -179,7 +179,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} } let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do it 'compiles' do
should_not contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) should_not contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -189,7 +189,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end end
@ -218,7 +218,7 @@ describe 'rsyslog::server', :type => :class do
context "default usage (osfamily = #{osfamily})" do context "default usage (osfamily = #{osfamily})" do
let(:title) { 'rsyslog-server-basic' } let(:title) { 'rsyslog-server-basic' }
it 'should compile' do it 'compiles' 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%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -228,7 +228,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} } let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do it 'compiles' do
should_not contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) 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/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -238,7 +238,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do it 'compiles' 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%\/auth.log/)
should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) should contain_file('/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end end
@ -259,7 +259,7 @@ describe 'rsyslog::server', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-server-basic' } let(:title) { 'rsyslog-server-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -269,7 +269,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'enable_onefile' => 'true'} } let(:params) { {'enable_onefile' => 'true'} }
it 'should compile' do it 'compiles' do
should_not contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/) should_not contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/\(\[A-Za-z-\]\*\)--end%\/messages/)
end end
@ -279,7 +279,7 @@ describe 'rsyslog::server', :type => :class do
let(:title) { 'rsyslog-server-onefile' } let(:title) { 'rsyslog-server-onefile' }
let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} } let(:params) { {'custom_config' => 'rsyslog/server-hostname.conf.erb'} }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/auth.log/)
should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/) should contain_file('/usr/local/etc/rsyslog.d/server.conf').with_content(/%hostname%\/messages/)
end end

Просмотреть файл

@ -21,7 +21,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_class('rsyslog::install') should contain_class('rsyslog::install')
should contain_class('rsyslog::config') should contain_class('rsyslog::config')
should contain_class('rsyslog::service') should contain_class('rsyslog::service')
@ -40,7 +40,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_class('rsyslog::install') should contain_class('rsyslog::install')
should contain_class('rsyslog::config') should contain_class('rsyslog::config')
should contain_class('rsyslog::service') should contain_class('rsyslog::service')
@ -59,7 +59,7 @@ describe 'rsyslog', :type => :class do
context "when set" do context "when set" do
let(:params) { { :local_host_name => 'example.dev' } } let(:params) { { :local_host_name => 'example.dev' } }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.conf').with_content(/\$LocalHostName example.dev/) should contain_file('/etc/rsyslog.conf').with_content(/\$LocalHostName example.dev/)
end end
end end
@ -77,7 +77,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_class('rsyslog::install') should contain_class('rsyslog::install')
should contain_class('rsyslog::config') should contain_class('rsyslog::config')
should contain_class('rsyslog::service') should contain_class('rsyslog::service')
@ -97,7 +97,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.conf') should contain_file('/etc/rsyslog.conf')
should contain_file('/etc/rsyslog.d/') should contain_file('/etc/rsyslog.d/')
end end
@ -115,7 +115,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.conf') should contain_file('/etc/rsyslog.conf')
should contain_file('/etc/rsyslog.d/') should contain_file('/etc/rsyslog.d/')
end end
@ -133,7 +133,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.conf') should contain_file('/usr/local/etc/rsyslog.conf')
should contain_file('/usr/local/etc/rsyslog.d/') should contain_file('/usr/local/etc/rsyslog.d/')
end end
@ -152,7 +152,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-install-basic' } let(:title) { 'rsyslog-install-basic' }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog') should contain_package('rsyslog')
should contain_package('rsyslog-relp') should contain_package('rsyslog-relp')
end end
@ -170,7 +170,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-install-basic' } let(:title) { 'rsyslog-install-basic' }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog') should contain_package('rsyslog')
should contain_package('rsyslog-relp') should contain_package('rsyslog-relp')
end end
@ -188,7 +188,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-install-basic' } let(:title) { 'rsyslog-install-basic' }
it 'should compile' do it 'compiles' do
should contain_package('sysutils/rsyslog8') should contain_package('sysutils/rsyslog8')
end end
end end
@ -206,7 +206,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-service-basic' } let(:title) { 'rsyslog-service-basic' }
it 'should compile' do it 'compiles' do
should contain_service('rsyslog') should contain_service('rsyslog')
end end
end end
@ -223,7 +223,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-service-basic' } let(:title) { 'rsyslog-service-basic' }
it 'should compile' do it 'compiles' do
should contain_service('rsyslog') should contain_service('rsyslog')
end end
end end
@ -240,7 +240,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-service-basic' } let(:title) { 'rsyslog-service-basic' }
it 'should compile' do it 'compiles' do
should contain_service('rsyslogd') should contain_service('rsyslogd')
end end
end end
@ -266,7 +266,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_class('rsyslog::install') should contain_class('rsyslog::install')
should contain_class('rsyslog::config') should contain_class('rsyslog::config')
should contain_class('rsyslog::service') should contain_class('rsyslog::service')
@ -285,7 +285,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_class('rsyslog::install') should contain_class('rsyslog::install')
should contain_class('rsyslog::config') should contain_class('rsyslog::config')
should contain_class('rsyslog::service') should contain_class('rsyslog::service')
@ -304,7 +304,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_class('rsyslog::install') should contain_class('rsyslog::install')
should contain_class('rsyslog::config') should contain_class('rsyslog::config')
should contain_class('rsyslog::service') should contain_class('rsyslog::service')
@ -324,7 +324,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.conf') should contain_file('/etc/rsyslog.conf')
should contain_file('/etc/rsyslog.d/') should contain_file('/etc/rsyslog.d/')
end end
@ -342,7 +342,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.conf') should contain_file('/etc/rsyslog.conf')
should contain_file('/etc/rsyslog.d/') should contain_file('/etc/rsyslog.d/')
end end
@ -360,7 +360,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-basic' } let(:title) { 'rsyslog-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.conf') should contain_file('/usr/local/etc/rsyslog.conf')
should contain_file('/usr/local/etc/rsyslog.d/') should contain_file('/usr/local/etc/rsyslog.d/')
end end
@ -379,7 +379,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-install-basic' } let(:title) { 'rsyslog-install-basic' }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog') should contain_package('rsyslog')
should contain_package('rsyslog-relp') should contain_package('rsyslog-relp')
end end
@ -397,7 +397,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-install-basic' } let(:title) { 'rsyslog-install-basic' }
it 'should compile' do it 'compiles' do
should contain_package('rsyslog') should contain_package('rsyslog')
should contain_package('rsyslog-relp') should contain_package('rsyslog-relp')
end end
@ -415,7 +415,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-install-basic' } let(:title) { 'rsyslog-install-basic' }
it 'should compile' do it 'compiles' do
should contain_package('sysutils/rsyslog8') should contain_package('sysutils/rsyslog8')
end end
end end
@ -433,7 +433,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-service-basic' } let(:title) { 'rsyslog-service-basic' }
it 'should compile' do it 'compiles' do
should contain_service('rsyslog') should contain_service('rsyslog')
end end
end end
@ -450,7 +450,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-service-basic' } let(:title) { 'rsyslog-service-basic' }
it 'should compile' do it 'compiles' do
should contain_service('rsyslog') should contain_service('rsyslog')
end end
end end
@ -467,7 +467,7 @@ describe 'rsyslog', :type => :class do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-service-basic' } let(:title) { 'rsyslog-service-basic' }
it 'should compile' do it 'compiles' do
should contain_service('rsyslogd') should contain_service('rsyslogd')
end end
end end
@ -491,7 +491,7 @@ describe 'rsyslog', :type => :class do
end end
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.conf') should contain_file('/etc/rsyslog.conf')
should contain_file('/etc/rsyslog.d/') should contain_file('/etc/rsyslog.d/')
end end

Просмотреть файл

@ -29,7 +29,7 @@ describe 'rsyslog::imfile', :type => :define do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-imfile-basic' } let(:title) { 'rsyslog-imfile-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf')
end end
end end
@ -54,7 +54,7 @@ describe 'rsyslog::imfile', :type => :define do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-imfile-basic' } let(:title) { 'rsyslog-imfile-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf')
end end
end end
@ -79,7 +79,7 @@ describe 'rsyslog::imfile', :type => :define do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-imfile-basic' } let(:title) { 'rsyslog-imfile-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/rsyslog-imfile-basic.conf') should contain_file('/usr/local/etc/rsyslog.d/rsyslog-imfile-basic.conf')
end end
end end
@ -113,7 +113,7 @@ describe 'rsyslog::imfile', :type => :define do
context "default usage (osfamily = RedHat)" do context "default usage (osfamily = RedHat)" do
let(:title) { 'rsyslog-imfile-basic' } let(:title) { 'rsyslog-imfile-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf')
end end
end end
@ -138,7 +138,7 @@ describe 'rsyslog::imfile', :type => :define do
context "default usage (osfamily = Debian)" do context "default usage (osfamily = Debian)" do
let(:title) { 'rsyslog-imfile-basic' } let(:title) { 'rsyslog-imfile-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf') should contain_file('/etc/rsyslog.d/rsyslog-imfile-basic.conf')
end end
end end
@ -163,7 +163,7 @@ describe 'rsyslog::imfile', :type => :define do
context "default usage (osfamily = FreeBSD)" do context "default usage (osfamily = FreeBSD)" do
let(:title) { 'rsyslog-imfile-basic' } let(:title) { 'rsyslog-imfile-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/rsyslog-imfile-basic.conf') should contain_file('/usr/local/etc/rsyslog.d/rsyslog-imfile-basic.conf')
end end
end end

Просмотреть файл

@ -1,166 +1,137 @@
require 'spec_helper' require 'spec_helper'
describe 'rsyslog::snippet', :type => :define do describe 'rsyslog::snippet', type: :define do
context 'Rsyslog version >= 8' do
context "Rsyslog version >= 8" do
let(:default_facts) do let(:default_facts) do
{ {
:rsyslog_version => '8.1.2' rsyslog_version: '8.1.2'
} }
end end
context "osfamily = RedHat" do context 'osfamily = RedHat' do
let :facts do let :facts do
default_facts.merge!({ default_facts.merge!(
:osfamily => 'RedHat', osfamily: 'RedHat',
:operatingsystem => 'Redhat', operatingsystem: 'Redhat',
:operatingsystemmajrelease => '6', operatingsystemmajrelease: '6'
}) )
end end
let (:params) { let(:params) { { 'content' => 'Random Content' } }
{
'content' => 'Random Content',
}
}
context "default usage (osfamily = RedHat)" do context 'default usage (osfamily = RedHat)' do
let(:title) { 'rsyslog-snippet-basic' } let(:title) { 'rsyslog-snippet-basic' }
it 'should compile' do it 'compiles' 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") 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
let(:title) { 'rsyslog/snippet/basic' } let(:title) { 'rsyslog/snippet/basic' }
it 'should compile' do it 'compiles' 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") 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 end
end end
context "osfamily = Debian" do context 'osfamily = Debian' do
let :facts do let :facts do
default_facts.merge!({ default_facts.merge!(
:osfamily => 'Debian', osfamily: 'Debian',
:operatingsystem => 'Debian', operatingsystem: 'Debian'
}) )
end end
let (:params) { let(:params) { { 'content' => 'Random Content' } }
{
'content' => 'Random Content',
}
}
context "default usage (osfamily = Debian)" do context 'default usage (osfamily = Debian)' do
let(:title) { 'rsyslog-snippet-basic' } let(:title) { 'rsyslog-snippet-basic' }
it 'should compile' do it 'compiles' 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") 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 end
end end
context "osfamily = FreeBSD" do context 'osfamily = FreeBSD' do
let :facts do let :facts do
default_facts.merge!({ default_facts.merge!(
:osfamily => 'FreeBSD', osfamily: 'FreeBSD',
:operatingsystem => 'FreeBSD', operatingsystem: 'FreeBSD'
}) )
end end
let (:params) { let(:params) { { 'content' => 'Random Content' } }
{
'content' => 'Random Content',
}
}
context "default usage (osfamily = FreeBSD)" do context 'default usage (osfamily = FreeBSD)' do
let(:title) { 'rsyslog-snippet-basic' } let(:title) { 'rsyslog-snippet-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n") should contain_file('/usr/local/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 end
end end
end end
context "Rsyslog version =< 8" do context 'Rsyslog version =< 8' do
let(:default_facts) do let(:default_facts) do
{ {
:rsyslog_version => '7.1.2' rsyslog_version: '7.1.2'
} }
end end
context "osfamily = RedHat" do context 'osfamily = RedHat' do
let :facts do let :facts do
default_facts.merge!({ default_facts.merge!(
:osfamily => 'RedHat', osfamily: 'RedHat',
:operatingsystem => 'Redhat', operatingsystem: 'Redhat',
:operatingsystemmajrelease => '6', operatingsystemmajrelease: '6'
}) )
end end
let (:params) { let(:params) { { 'content' => 'Random Content' } }
{
'content' => 'Random Content',
}
}
context "default usage (osfamily = RedHat)" do context 'default usage (osfamily = RedHat)' do
let(:title) { 'rsyslog-snippet-basic' } let(:title) { 'rsyslog-snippet-basic' }
it 'should compile' do it 'compiles' 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") 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 end
end end
context "osfamily = Debian" do context 'osfamily = Debian' do
let :facts do let :facts do
default_facts.merge!({ default_facts.merge!(
:osfamily => 'Debian', osfamily: 'Debian',
:operatingsystem => 'Debian', operatingsystem: 'Debian'
}) )
end end
let (:params) { let(:params) { { 'content' => 'Random Content' } }
{
'content' => 'Random Content',
}
}
context "default usage (osfamily = Debian)" do context 'default usage (osfamily = Debian)' do
let(:title) { 'rsyslog-snippet-basic' } let(:title) { 'rsyslog-snippet-basic' }
it 'should compile' do it 'compiles' 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") 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 end
end end
context "osfamily = FreeBSD" do context 'osfamily = FreeBSD' do
let :facts do let :facts do
default_facts.merge!({ default_facts.merge!(osfamily: 'FreeBSD', operatingsystem: 'FreeBSD')
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
})
end end
let (:params) { let(:params) { { 'content' => 'Random Content' } }
{
'content' => 'Random Content',
}
}
context "default usage (osfamily = FreeBSD)" do context 'default usage (osfamily = FreeBSD)' do
let(:title) { 'rsyslog-snippet-basic' } let(:title) { 'rsyslog-snippet-basic' }
it 'should compile' do it 'compiles' do
should contain_file('/usr/local/etc/rsyslog.d/rsyslog-snippet-basic.conf').with_content("# This file is managed by Puppet, changes may be overwritten\nRandom Content\n") should contain_file('/usr/local/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 end
end end
end end
end end

Просмотреть файл

@ -6,9 +6,7 @@ RSpec.configure do |c|
end end
c.include PuppetlabsSpec::Files c.include PuppetlabsSpec::Files
if ENV['PARSER'] == 'future' c.parser = 'future' if ENV['PARSER'] == 'future'
c.parser = 'future'
end
c.before :each do c.before :each do
# Ensure that we don't accidentally cache facts and environment # Ensure that we don't accidentally cache facts and environment
@ -19,10 +17,10 @@ RSpec.configure do |c|
# Store any environment variables away to be restored later # Store any environment variables away to be restored later
@old_env = {} @old_env = {}
ENV.each_key {|k| @old_env[k] = ENV[k]} ENV.each_key { |k| @old_env[k] = ENV[k] }
if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5') if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5')
Puppet.settings[:strict_variables]=true Puppet.settings[:strict_variables] = true
end end
end end