1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-11-10 04:50:34 +00:00

added context to class spec tests to be able to test osfamily RedHat

This commit is contained in:
Max Wilhelm 2016-01-27 12:45:27 +01:00
parent be1a555591
commit ae7256a8c2
6 changed files with 141 additions and 58 deletions

View File

@ -1,16 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::config', :type => :class do describe 'fluentd::config', :type => :class do
let(:facts) { shared_examples 'when called with no parameters' do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
describe 'when called with no parameters on Ubuntu' do
it { it {
should contain_file('/etc/td-agent/td-agent.conf').with({ should contain_file('/etc/td-agent/td-agent.conf').with({
'ensure' => 'file', 'ensure' => 'file',
@ -28,4 +19,27 @@ describe 'fluentd::config', :type => :class do
}) })
} }
end end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end end

View File

@ -1,16 +1,8 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::install', :type => :class do describe 'fluentd::install', :type => :class do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
describe 'when called with no parameters on Ubuntu' do shared_examples 'when called with no parameters' do
it { it {
should contain_package('fluentd').with({ should contain_package('fluentd').with({
'ensure' => 'installed', 'ensure' => 'installed',
@ -19,4 +11,27 @@ describe 'fluentd::install', :type => :class do
}) })
} }
end end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end end

View File

@ -1,18 +1,29 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::repo', :type => :class do describe 'fluentd::repo', :type => :class do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
describe 'when called with no parameters on Ubuntu' do context 'when called with no parameters on osfamily Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
it { it {
should contain_class('fluentd::repo::apt') should contain_class('fluentd::repo::apt')
} }
end end
context 'when called with no parameters on osfamily RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
it {
should contain_class('fluentd::repo::yum')
}
end
end end

View File

@ -1,16 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::config', :type => :class do describe 'fluentd::config', :type => :class do
let(:facts) { shared_examples 'when called with no parameters' do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
describe 'when called with no parameters on Ubuntu' do
it { it {
should contain_service('fluentd').with({ should contain_service('fluentd').with({
'name' => 'td-agent', 'name' => 'td-agent',
@ -21,4 +12,27 @@ describe 'fluentd::config', :type => :class do
}) })
} }
end end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end end

View File

@ -1,16 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd', :type => :class do describe 'fluentd', :type => :class do
let(:facts) { shared_examples 'when called with no parameters' do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
describe 'when called with no parameters on Ubuntu' do
it { it {
should contain_class('fluentd::repo') should contain_class('fluentd::repo')
should contain_class('fluentd::install') should contain_class('fluentd::install')
@ -18,4 +9,28 @@ describe 'fluentd', :type => :class do
should contain_class('fluentd::service') should contain_class('fluentd::service')
} }
end end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end end

View File

@ -1,16 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::user', :type => :class do describe 'fluentd::user', :type => :class do
let(:facts) { shared_examples 'when called with no parameters' do
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
describe 'when called with no parameters on Ubuntu' do
it { it {
should contain_user('fluentd').with({ should contain_user('fluentd').with({
'name' => 'td-agent', 'name' => 'td-agent',
@ -19,4 +10,27 @@ describe 'fluentd::user', :type => :class do
}) })
} }
end end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
}
}
include_examples 'when called with no parameters'
end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end
end end