-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Zookeeper plugin #670
Add Zookeeper plugin #670
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class collectd::plugin::zookeeper ( | ||
Enum['present', 'absent'] $ensure = 'present', | ||
Optional[Integer] $interval = undef, | ||
String $zookeeper_host = 'localhost', | ||
String $zookeeper_port = '2181', | ||
) { | ||
|
||
include ::collectd | ||
|
||
collectd::plugin { 'zookeeper': | ||
ensure => $ensure, | ||
content => template('collectd/plugin/zookeeper.conf.erb'), | ||
interval => $interval, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'spec_helper' | ||
|
||
describe 'collectd::plugin::zookeeper', type: :class do | ||
let :facts do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you use rspec-puppet.-facts here? |
||
{ | ||
osfamily: 'RedHat', | ||
collectd_version: '5.5.0', | ||
operatingsystemmajrelease: '7', | ||
python_dir: '/usr/local/lib/python2.7/dist-packages' | ||
} | ||
end | ||
|
||
context ':ensure => present and :zookeeper_host => \'myhost\'' do | ||
let :params do | ||
{ zookeeper_host: 'myhost', zookeeper_port: '2181' } | ||
end | ||
|
||
it 'Will create /etc/collectd.d/10-zookeeper.conf' do | ||
is_expected.to contain_file('write_riemann.load').with(ensure: 'present') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. write_riemann.load here is also wrong. no idea how this went green on travis |
||
is_expected.to contain_file('write_riemann.load').with(path: '/etc/collectd.d/10-zookeeper.conf') | ||
is_expected.to contain_file('write_riemann.load').with(content: %r{Host "myhost"}) | ||
is_expected.to contain_file('write_riemann.load').with(content: %r{Port "2181"}) | ||
end | ||
end | ||
|
||
context ':ensure => absent' do | ||
let :params do | ||
{ zookeeper_host: ['myhost'], ensure: 'absent' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How did this pass the tests. This is clearly wrong. Defined datatype is String, but this is a tuple. Strange |
||
end | ||
|
||
it 'Will not create ' do | ||
is_expected.to contain_file('zookeeper.load').with(ensure: 'absent', | ||
path: '/etc/collectd.d/10-zookeeper.conf') | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<Plugin "zookeeper"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you migrate this to a epp template? |
||
Host "<%= @zookeeper_host %>" | ||
Port "<%= @zookeeper_port %>" | ||
</Plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datatypes \o/