1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2025-09-13 08:59:29 +00:00

34 Commits
0.5.4 ... 0.6.0

Author SHA1 Message Date
Max Wilhelm
71352ea6b1 prepare 0.6.0 2017-08-17 17:11:06 +02:00
Max Wilhelm
d7ab62a388 fixed licensing 2017-08-17 17:10:15 +02:00
Max Wilhelm
78f9c03952 Merge pull request #20 from wywy/rename_company
Rename company
2017-08-17 16:52:38 +02:00
Max Wilhelm
ca55558b44 some more renaming 2017-08-17 16:52:10 +02:00
Jan Krause
cd9813f574 rename company 2017-08-17 16:49:04 +02:00
Max Wilhelm
d6231c3b13 Merge pull request #19 from wywy/use_rspec_puppet_facts
Use rspec puppet facts
2017-08-17 14:08:11 +02:00
Max Wilhelm
fc0f3fdf88 use rspec-puppet-facts for source_spec 2017-08-17 13:34:13 +02:00
Max Wilhelm
613a28ccaf use rspec-puppet-facts for plugin_spec 2017-08-17 13:34:03 +02:00
Max Wilhelm
5f213da8b3 use rspec-puppet-facts for match_spec 2017-08-17 13:33:54 +02:00
Max Wilhelm
258a37ff11 use rspec-puppet-facts for filter_spec 2017-08-17 13:33:43 +02:00
Max Wilhelm
c2f95f4bc9 use rspec-puppet-facts for fluentd_user_spec 2017-08-17 13:26:38 +02:00
Max Wilhelm
257880811c use rspec-puppet-facts for fluentd_spec 2017-08-17 13:26:16 +02:00
Max Wilhelm
6e97016aac use rspec-puppet-facts for fluentd_service_spec 2017-08-17 13:26:03 +02:00
Max Wilhelm
b34c7dc4e4 use rspec-puppet-facts for fluentd_repo_yum_spec 2017-08-14 17:56:33 +02:00
Max Wilhelm
d7f6d91a11 use rspec-puppet-facts for fluentd_repo_apt_spec 2017-08-14 17:56:20 +02:00
Max Wilhelm
e8cdc9a9e0 use rspec-puppet-facts for fluentd_install_spec 2017-08-14 17:56:06 +02:00
Max Wilhelm
b51a559684 use rspec-puppet-facts for fluentd_config_spec 2017-08-14 17:55:39 +02:00
Max Wilhelm
754cd4a696 use rspec-puppet-facts for fluentd_repo_spec 2017-08-14 17:55:27 +02:00
Max Wilhelm
41a617c156 add and init rspec-puppet-facts 2017-08-14 17:54:56 +02:00
Max Wilhelm
0c62c616f0 updated comments & README 2017-08-14 13:18:06 +02:00
Max Wilhelm
76d26e8216 changed puppet-lint config 2017-08-14 13:07:16 +02:00
Max Wilhelm
780df1edae Merge pull request #18 from wywygmbh/fix_indentation
Fix indentation
2017-08-04 17:03:05 +02:00
Max Wilhelm
3e3de2aed9 fixed source.erb template indentation 2017-08-04 11:16:51 +02:00
Max Wilhelm
5f84f04f0f fixed match.erb template indentation 2017-08-04 11:16:31 +02:00
Max Wilhelm
ad17694713 fixed filter.erb template indentation 2017-08-04 11:16:07 +02:00
Max Wilhelm
f4da637999 Merge pull request #17 from wywygmbh/conf_file_fixtures
Conf file fixtures
2017-08-04 10:51:32 +02:00
Max Wilhelm
533857e49c added missing fixtures 2017-08-03 12:11:13 +02:00
Max Wilhelm
525fc9c5ab use fixtures for conf file tests
should help to solve https://github.com/wywygmbh/puppet-fluentd/issues/4
2017-08-03 12:00:59 +02:00
Max Wilhelm
bfa6de193e prepare 0.5.6 2017-07-25 16:24:03 +02:00
Max Wilhelm
5f3aca9597 Merge pull request #16 from lzecca78/master
bug in referenced class variable
2017-07-25 16:20:37 +02:00
Luca Zecca
ee3a8e968a bug in referenced class variable 2017-07-25 16:10:06 +02:00
Max Wilhelm
3f26736084 prepare 0.5.5 2017-07-25 15:17:22 +02:00
Max Wilhelm
d27479eb17 Merge pull request #15 from lzecca78/master
added boolean param for enabling fluentd::conf_dir
2017-07-25 15:13:28 +02:00
Luca Zecca
c8046ee2c6 added boolean param for enabling fluentd::conf_dir exclusive file handling by puppet. 2017-07-24 14:33:21 +02:00
33 changed files with 513 additions and 498 deletions

View File

@@ -1,4 +1,17 @@
# Changelog # Changelog
## 0.6.0
* Updated README
* fixed broken links, due to github organisation rename
* fixed indentation for config files (filter, match, source)
* use rspec-puppet-facts for unit testing
## 0.5.6
* Fixed `conf_dir_manage` parameter call
## 0.5.5
* Added `conf_dir_manage` parameter (Default: false)
* Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
## 0.5.4 ## 0.5.4
* fixed templates/filter.erb * fixed templates/filter.erb
* fixed removing of old GPG key for yum repos * fixed removing of old GPG key for yum repos

View File

@@ -7,6 +7,7 @@ gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0' gem 'facter', '>= 1.7.0'
gem 'beaker-puppet_install_helper' gem 'beaker-puppet_install_helper'
gem 'metadata-json-lint' gem 'metadata-json-lint'
gem 'rspec-puppet-facts', '~> 1.7'
beakerrspec = '> 0' beakerrspec = '> 0'
platforms [:ruby_19, :ruby_21] do platforms [:ruby_19, :ruby_21] do

View File

@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright 2015 wywy GmbH Copyright 2017 ATVAG GmbH
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
# wywygmbh/fluentd Puppet Module # wywy/fluentd Puppet Module
[![GitHub version](https://badge.fury.io/gh/wywygmbh%2Fpuppet-fluentd.svg)](https://github.com/wywygmbh/puppet-fluentd) [![GitHub version](https://badge.fury.io/gh/wywy%2Fpuppet-fluentd.svg)](https://github.com/wywy/puppet-fluentd)
[![Build Status](https://travis-ci.org/wywygmbh/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywygmbh/puppet-fluentd) [![Build Status](https://travis-ci.org/wywy/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywy/puppet-fluentd)
@@ -84,6 +84,26 @@ include '::fluentd'
Defines if the service should be enabled. Defines if the service should be enabled.
**Default:** 'true' **Default:** 'true'
`config_path`
Path to configuration files
**Default:** '/etc/td-agent'
`config_dir`
Configuration directory name
**Default:** '${config_path}/conf.d'
`config_file`
Default configuration file name
**Default:** '${config_path}/td-agent.conf'
`conf_dir_manage`
Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
**Default:** 'false'
`user_manage` `user_manage`
Defines if the user should be manage, which will add the user Defines if the user should be manage, which will add the user
@@ -276,7 +296,7 @@ bundle exec rake beaker BEAKER_set=centos-70-x64
## License ## License
Copyright 2015 wywy GmbH Copyright 2017 ATVAG GmbH
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -290,4 +310,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
This Puppet module is being actively maintained by some fellow puppeteers at [wywy GmbH](http://wywy.com/). This Puppet module is being actively maintained by some fellow puppeteers at [wywy](http://wywy.com/).

View File

@@ -4,8 +4,9 @@ require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('relative') PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_140chars') PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables') PuppetLint.configuration.send('disable_single_quote_string_with_variables')

View File

@@ -12,6 +12,8 @@ class fluentd::config inherits fluentd {
file { $::fluentd::conf_dir: file { $::fluentd::conf_dir:
ensure => 'directory', ensure => 'directory',
recurse => $::fluentd::conf_dir_manage,
purge => $::fluentd::conf_dir_manage,
owner => $::fluentd::user_name, owner => $::fluentd::user_name,
group => $::fluentd::user_group, group => $::fluentd::user_group,
mode => '0750', mode => '0750',

View File

@@ -35,7 +35,7 @@
# Copyright # Copyright
# --------- # ---------
# #
# Copyright 2015 wywy GmbH, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::filter ( define fluentd::filter (
$ensure = present, $ensure = present,

View File

@@ -29,6 +29,18 @@
# [*service_enable*] # [*service_enable*]
# Defines if the service should be enabled # Defines if the service should be enabled
# Default: 'true' # Default: 'true'
# [*config_path*]
# Path to configuration files
# Default: '/etc/td-agent'
# [*config_dir*]
# Configuration directory name
# Default: '${config_path}/conf.d'
# [*config_file*]
# Default configuration file name
# Default: '${config_path}/td-agent.conf'
# [*conf_dir_manage*]
# Exclusively handle config files into fluentd::conf_dir. Other files not created by puppet, will be deleted
# Default: 'false'
# [*user_manage*] # [*user_manage*]
# Defines if the user should be manage, which will add the user # Defines if the user should be manage, which will add the user
# to groups defined in $user_groups. # to groups defined in $user_groups.
@@ -50,7 +62,7 @@
# Copyright # Copyright
# --------- # ---------
# #
# Copyright 2015 wywy GmbH, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
class fluentd ( class fluentd (
$repo_manage = $::fluentd::params::repo_manage, $repo_manage = $::fluentd::params::repo_manage,
@@ -64,6 +76,7 @@ class fluentd (
$config_path = $::fluentd::params::config_path, $config_path = $::fluentd::params::config_path,
$conf_dir = $::fluentd::params::conf_dir, $conf_dir = $::fluentd::params::conf_dir,
$config_file = $::fluentd::params::config_file, $config_file = $::fluentd::params::config_file,
$conf_dir_manage = $::fluentd::params::conf_dir_manage,
$user_manage = $::fluentd::params::user_manage, $user_manage = $::fluentd::params::user_manage,
$user_name = $::fluentd::params::user_name, $user_name = $::fluentd::params::user_name,
$user_group = $::fluentd::params::user_group, $user_group = $::fluentd::params::user_group,

View File

@@ -40,7 +40,7 @@
# Copyright # Copyright
# --------- # ---------
# #
# Copyright 2015 wywy GmbH, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::match ( define fluentd::match (
$ensure = present, $ensure = present,

View File

@@ -11,6 +11,7 @@ class fluentd::params {
# config params # config params
$config_path = '/etc/td-agent' $config_path = '/etc/td-agent'
$conf_dir = "${config_path}/conf.d" $conf_dir = "${config_path}/conf.d"
$conf_dir_manage = false
$config_file = "${config_path}/td-agent.conf" $config_file = "${config_path}/td-agent.conf"
# user params # user params
$user_manage = true $user_manage = true

View File

@@ -23,7 +23,7 @@
# Copyright # Copyright
# --------- # ---------
# #
# Copyright 2015 wywy GmbH, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::plugin ( define fluentd::plugin (
$ensure = present, $ensure = present,

View File

@@ -31,7 +31,7 @@
# Copyright # Copyright
# --------- # ---------
# #
# Copyright 2015 wywy GmbH, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::source ( define fluentd::source (
$ensure = present, $ensure = present,

View File

@@ -1,12 +1,12 @@
{ {
"name": "wywygmbh-fluentd", "name": "wywygmbh-fluentd",
"version": "0.5.4", "version": "0.6.0",
"author": "wywy GmbH", "author": "wywy",
"summary": "Generic module for fluentd (td-agent).", "summary": "Generic module for fluentd (td-agent).",
"license": "Apache-2.0", "license": "Apache-2.0",
"source": "https://github.com/wywygmbh/puppet-fluentd", "source": "https://github.com/wywy/puppet-fluentd",
"project_page": "https://github.com/wywygmbh/puppet-fluentd", "project_page": "https://github.com/wywy/puppet-fluentd",
"issues_url": "https://github.com/wywygmbh/puppet-fluentd/issues", "issues_url": "https://github.com/wywy/puppet-fluentd/issues",
"tags": ["fluentd", "td-agent"], "tags": ["fluentd", "td-agent"],
"operatingsystem_support": [ "operatingsystem_support": [
{ {

View File

@@ -1,7 +1,14 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::config', :type => :class do describe 'fluentd::config', :type => :class do
shared_examples 'when called with no parameters' do on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' 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',
@@ -19,28 +26,6 @@ describe 'fluentd::config', :type => :class do
}) })
} }
end end
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
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 end

View File

@@ -1,8 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::install', :type => :class do describe 'fluentd::install', :type => :class do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
shared_examples 'when called with no parameters' do describe 'when called with no parameters' do
it { it {
should contain_package('fluentd').with({ should contain_package('fluentd').with({
'ensure' => 'installed', 'ensure' => 'installed',
@@ -11,28 +16,6 @@ describe 'fluentd::install', :type => :class do
}) })
} }
end end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
include_examples 'when called with no parameters'
end end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end end
end end

View File

@@ -1,23 +1,18 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::repo::apt', :type => :class do describe 'fluentd::repo::apt', :type => :class do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
describe 'when called with no parameters on Ubuntu' do case facts[:osfamily]
when 'Debian'
it { it {
should contain_class('apt') should contain_class('apt')
should contain_apt__source('treasure-data').with({ should contain_apt__source('treasure-data').with({
'ensure' => 'present', 'ensure' => 'present',
'location' => 'http://packages.treasuredata.com/2/ubuntu/precise',
'release' => 'precise',
'repos' => 'contrib', 'repos' => 'contrib',
'architecture' => 'amd64', 'architecture' => 'amd64',
'key' => { 'key' => {
@@ -30,5 +25,57 @@ describe 'fluentd::repo::apt', :type => :class do
} }
}) })
} }
case facts[:operatingsystem]
when 'Ubuntu'
case facts[:lsbdistcodename]
when 'precise'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/precise',
'release' => 'precise'
})
}
when 'trusty'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/trusty',
'release' => 'trusty'
})
}
when 'xenial'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/ubuntu/xenial',
'release' => 'xenial'
})
}
end
when 'Debian'
case facts[:lsbdistcodename]
when 'jessie'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/jessie',
'release' => 'jessie'
})
}
when 'squeeze'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/squeeze',
'release' => 'squeeze'
})
}
when 'wheezy'
it {
should contain_apt__source('treasure-data').with({
'location' => 'http://packages.treasuredata.com/2/debian/wheezy',
'release' => 'wheezy'
})
}
end
end
end
end
end end
end end

View File

@@ -1,30 +1,21 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::repo', :type => :class do describe 'fluentd::repo', :type => :class do
on_supported_os.each do |os, facts|
context 'when called with no parameters on osfamily Debian' do context "on #{os}" do
let(:facts) { let :facts do
{ facts
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
it {
should contain_class('fluentd::repo::apt')
}
end end
context 'when called with no parameters on osfamily RedHat' do describe 'when called with no parameters' do
let(:facts) { case facts[:osfamily]
{ when 'Debian'
:osfamily => 'RedHat', it { is_expected.to contain_class('fluentd::repo::apt') }
} when 'RedHat'
} it { is_expected.to contain_class('fluentd::repo::yum') }
it {
should contain_class('fluentd::repo::yum')
}
end end
end end
end
end
end

View File

@@ -1,13 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::repo::yum', :type => :class do describe 'fluentd::repo::yum', :type => :class do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'RedHat', let :facts do
} facts
} end
describe 'when called with no parameters on RedHat' do describe 'when called with no parameters' do
case facts[:osfamily]
when 'RedHat'
it { it {
should contain_yumrepo('treasure-data').with({ should contain_yumrepo('treasure-data').with({
'ensure' => 'present', 'ensure' => 'present',
@@ -25,3 +27,6 @@ describe 'fluentd::repo::yum', :type => :class do
} }
end end
end end
end
end
end

View File

@@ -1,7 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::config', :type => :class do describe 'fluentd::config', :type => :class do
shared_examples 'when called with no parameters' do on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it { it {
should contain_service('fluentd').with({ should contain_service('fluentd').with({
'name' => 'td-agent', 'name' => 'td-agent',
@@ -12,28 +18,6 @@ describe 'fluentd::config', :type => :class do
}) })
} }
end end
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
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 end

View File

@@ -1,7 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd', :type => :class do describe 'fluentd', :type => :class do
shared_examples 'when called with no parameters' do on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it { it {
should contain_class('fluentd::repo') should contain_class('fluentd::repo')
should contain_class('fluentd::install') should contain_class('fluentd::install')
@@ -9,29 +15,6 @@ 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',
:architecture => 'amd64',
}
}
include_examples 'when called with no parameters'
end end
context 'when osfamily is RedHat' do
let(:facts) {
{
:osfamily => 'RedHat',
}
}
include_examples 'when called with no parameters'
end end
end end

View File

@@ -1,7 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::user', :type => :class do describe 'fluentd::user', :type => :class do
shared_examples 'when called with no parameters' do on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
describe 'when called with no parameters' do
it { it {
should contain_user('fluentd').with({ should contain_user('fluentd').with({
'name' => 'td-agent', 'name' => 'td-agent',
@@ -10,28 +16,6 @@ describe 'fluentd::user', :type => :class do
}) })
} }
end end
end
context 'when osfamily is Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
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 end

View File

@@ -1,18 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::filter' do describe 'fluentd::filter' do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
let(:pre_condition) { 'include fluentd' } let(:pre_condition) { 'include fluentd' }
context 'basic filter' do describe 'basic filter' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
@@ -29,12 +26,9 @@ describe 'fluentd::filter' do
it do it do
is_expected.to contain_file('/etc/td-agent/conf.d/20-filter-test.conf'). is_expected.to contain_file('/etc/td-agent/conf.d/20-filter-test.conf').
with_content(/<filter \*.test>/). with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/filter_record_transformer.conf')))
with_content(/type record_transformer/). end
with_content(/<record>/). end
with_content(/hostname \$\{hostname\}/).
with_content(/<\/record>/).
with_content(/<\/filter>/)
end end
end end
end end

View File

@@ -1,18 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::match' do describe 'fluentd::match' do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
let(:pre_condition) { 'include fluentd' } let(:pre_condition) { 'include fluentd' }
context 'basic match' do describe 'basic match' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
@@ -36,21 +33,11 @@ describe 'fluentd::match' do
it do it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf'). is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(/<match \*.test>/). with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_secure_forward.conf')))
with_content(/flush_interval 30s/).
with_content(/type secure_forward/).
with_content(/secure yes/).
with_content(/shared_key my_shared_key/).
with_content(/self_hostname instance.test.com/).
with_content(/ca_cert_path \/path\/to\/ca.cert/).
with_content(/<server>/).
with_content(/host test.server.com/).
with_content(/<\/server>/).
with_content(/<\/match>/)
end end
end end
context 'multiple store' do describe 'multiple store' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
@@ -76,19 +63,9 @@ describe 'fluentd::match' do
it do it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf'). is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(/<match \*.test>/). with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/match_copy.conf')))
with_content(/type copy/). end
with_content(/<store>/). end
with_content(/type elasticsearch/).
with_content(/logstashformat true/).
with_content(/hosts 172.20.10.17:9200/).
with_content(/flush_interval 30s/).
with_content(/<\/store>/).
with_content(/<store>/).
with_content(/type file/).
with_content(/path \/tmp\/td-agent-debug.log/).
with_content(/<\/store>/).
with_content(/<\/match>/)
end end
end end
end end

View File

@@ -1,18 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::plugin' do describe 'fluentd::plugin' do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
let(:pre_condition) { 'include fluentd' } let(:pre_condition) { 'include fluentd' }
context 'gem plugin' do describe 'gem plugin' do
let(:title) { 'fluent-plugin-elasticsearch' } let(:title) { 'fluent-plugin-elasticsearch' }
let(:params) do let(:params) do
{ {
@@ -29,7 +26,7 @@ describe 'fluentd::plugin' do
end end
end end
context 'file plugin' do describe 'file plugin' do
let(:title) { 'fluent-plugin-test' } let(:title) { 'fluent-plugin-test' }
let(:params) do let(:params) do
{ {
@@ -50,3 +47,5 @@ describe 'fluentd::plugin' do
end end
end end
end end
end
end

View File

@@ -1,18 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe 'fluentd::source' do describe 'fluentd::source' do
let(:facts) { on_supported_os.each do |os, facts|
{ context "on #{os}" do
:osfamily => 'Debian', let :facts do
:lsbdistid => 'Ubuntu', facts
:operatingsystem => 'Ubuntu', end
:lsbdistcodename => 'precise',
:architecture => 'amd64',
}
}
let(:pre_condition) { 'include fluentd' } let(:pre_condition) { 'include fluentd' }
context 'basic source' do describe 'basic source' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
@@ -28,12 +25,9 @@ describe 'fluentd::source' do
it do it do
is_expected.to contain_file('/etc/td-agent/conf.d/10-source-test.conf'). is_expected.to contain_file('/etc/td-agent/conf.d/10-source-test.conf').
with_content(/<source>/). with_content(IO.read(File.join(File.dirname(__FILE__), '../fixtures/files/source_tail.conf')))
with_content(/type tail/). end
with_content(/format json/). end
with_content(/path \/var\/log\/test-application\/\*.json/).
with_content(/tag application.test/).
with_content(/<\/source>/)
end end
end end
end end

View File

@@ -0,0 +1,6 @@
<filter *.test>
type record_transformer
<record>
hostname ${hostname}
</record>
</filter>

13
spec/fixtures/files/match_copy.conf vendored Normal file
View File

@@ -0,0 +1,13 @@
<match *.test>
type copy
<store>
type elasticsearch
logstashformat true
hosts 172.20.10.17:9200
flush_interval 30s
</store>
<store>
type file
path /tmp/td-agent-debug.log
</store>
</match>

View File

@@ -0,0 +1,11 @@
<match *.test>
flush_interval 30s
type secure_forward
secure yes
shared_key my_shared_key
self_hostname instance.test.com
ca_cert_path /path/to/ca.cert
<server>
host test.server.com
</server>
</match>

6
spec/fixtures/files/source_tail.conf vendored Normal file
View File

@@ -0,0 +1,6 @@
<source>
type tail
format json
path /var/log/test-application/*.json
tag application.test
</source>

View File

@@ -1 +1,3 @@
require 'puppetlabs_spec_helper/module_spec_helper' require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts