-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a `$major_version` parameter so that Filebeat 6 can be installed.
- Loading branch information
1 parent
f38bb37
commit 67ad329
Showing
11 changed files
with
229 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,92 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'filebeat class' do | ||
package_name = 'filebeat' | ||
service_name = 'filebeat' | ||
RSpec.shared_examples 'filebeat' do | ||
describe package('filebeat') do | ||
it { is_expected.to be_installed } | ||
end | ||
|
||
context 'default parameters' do | ||
let(:pp) do | ||
<<-EOS | ||
if $::osfamily == 'Debian' { | ||
include ::apt | ||
describe service('filebeat') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
|
||
package { 'apt-transport-https': | ||
ensure => present, | ||
} | ||
describe file('/etc/filebeat/filebeat.yml') do | ||
it { is_expected.to be_file } | ||
it { is_expected.to contain('---') } | ||
it { is_expected.not_to contain('max_procs: !ruby') } | ||
end | ||
end | ||
|
||
describe 'filebeat class' do | ||
let(:pp) do | ||
<<-EOS | ||
if $::osfamily == 'Debian' { | ||
include ::apt | ||
package { 'apt-transport-https': | ||
ensure => present, | ||
} | ||
} | ||
class { 'filebeat': | ||
outputs => { | ||
'logstash' => { | ||
'bulk_max_size' => 1024, | ||
'hosts' => [ | ||
'localhost:5044', | ||
], | ||
}, | ||
'file' => { | ||
'path' => '/tmp', | ||
'filename' => 'filebeat', | ||
'rotate_every_kb' => 10240, | ||
'number_of_files' => 2, | ||
}, | ||
}, | ||
shipper => { | ||
refresh_topology_freq => 10, | ||
topology_expire => 15, | ||
queue_size => 1000, | ||
class { 'filebeat': | ||
major_version => '#{major_version}', | ||
outputs => { | ||
'logstash' => { | ||
'bulk_max_size' => 1024, | ||
'hosts' => [ | ||
'localhost:5044', | ||
], | ||
}, | ||
logging => { | ||
files => { | ||
rotateeverybytes => 10485760, | ||
keepfiles => 7, | ||
} | ||
'file' => { | ||
'path' => '/tmp', | ||
'filename' => 'filebeat', | ||
'rotate_every_kb' => 10240, | ||
'number_of_files' => 2, | ||
}, | ||
prospectors => { | ||
'system-logs' => { | ||
doc_type => 'system', | ||
paths => [ | ||
'/var/log/dmesg', | ||
], | ||
fields => { | ||
service => 'system', | ||
file => 'dmesg', | ||
}, | ||
tags => [ | ||
'tag1', | ||
'tag2', | ||
'tag3', | ||
] | ||
} | ||
}, | ||
shipper => { | ||
refresh_topology_freq => 10, | ||
topology_expire => 15, | ||
queue_size => 1000, | ||
}, | ||
logging => { | ||
files => { | ||
rotateeverybytes => 10485760, | ||
keepfiles => 7, | ||
} | ||
}, | ||
prospectors => { | ||
'system-logs' => { | ||
doc_type => 'system', | ||
paths => [ | ||
'/var/log/dmesg', | ||
], | ||
fields => { | ||
service => 'system', | ||
file => 'dmesg', | ||
}, | ||
tags => [ | ||
'tag1', | ||
'tag2', | ||
'tag3', | ||
] | ||
} | ||
} | ||
EOS | ||
end | ||
} | ||
EOS | ||
end | ||
|
||
it_behaves_like 'an idempotent resource' | ||
context 'with $major_version = 5' do | ||
let(:major_version) { 5 } | ||
|
||
describe service(service_name) do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
end | ||
it_behaves_like 'an idempotent resource' | ||
include_examples 'filebeat' | ||
end | ||
|
||
describe package(package_name) do | ||
it { is_expected.to be_installed } | ||
end | ||
context 'with $major_version = 6' do | ||
let(:major_version) { 6 } | ||
|
||
describe file('/etc/filebeat/filebeat.yml') do | ||
it { is_expected.to be_file } | ||
it { is_expected.to contain('---') } | ||
it { is_expected.not_to contain('max_procs: !ruby') } | ||
end | ||
it_behaves_like 'an idempotent resource' | ||
include_examples 'filebeat' | ||
end | ||
end |
Oops, something went wrong.