forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# https://collectd.org/wiki/index.php/Plugin:Java | ||
class collectd::plugin::java ( | ||
$ensure = present, | ||
$jvmarg = [], | ||
$interval = undef, | ||
) { | ||
collectd::plugin { 'java': | ||
ensure => $ensure, | ||
content => template('collectd/plugin/java.conf.erb'), | ||
interval => $interval, | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require 'spec_helper' | ||
|
||
describe 'collectd::plugin::java', :type => :class do | ||
let :facts do | ||
{:osfamily => 'RedHat'} | ||
end | ||
|
||
context ':ensure => present, defaults' do | ||
it 'Will load the plugin' do | ||
should contain_file('java.load').with({ | ||
:ensure => 'present', | ||
:path => '/etc/collectd.d/10-java.conf', | ||
}) | ||
|
||
should contain_file('java.load').with_content(/<Plugin java>/) | ||
should contain_file('java.load').without_content(/JVMArg/) | ||
end | ||
end | ||
|
||
context ':ensure => absent' do | ||
let (:params) {{ | ||
:ensure => 'absent', | ||
}} | ||
|
||
it 'will not load the plugin' do | ||
should contain_file('java.load').with({ | ||
:ensure => 'absent', | ||
:path => '/etc/collectd.d/10-java.conf', | ||
}) | ||
end | ||
end | ||
|
||
context 'jvmarg parameter array' do | ||
let (:params) {{ | ||
:jvmarg => %w{ foo bar baz } | ||
}} | ||
|
||
it 'will have multiple JVMArg bits' do | ||
should contain_file('java.load').with_content(/JVMArg "foo"[\s\n]+JVMArg "bar"[\s\n]+JVMArg "baz"/) | ||
end | ||
end | ||
|
||
context 'jvmarg parameter string' do | ||
let (:params) {{ | ||
:jvmarg => 'bat' | ||
}} | ||
|
||
it 'will have a JVMArg bit' do | ||
should contain_file('java.load').with_content(/JVMArg "bat"/) | ||
end | ||
|
||
it 'will only have one JVMArg bit' do | ||
should contain_file('java.load').without_content(/(.*JVMArg.*){2,}/) | ||
end | ||
end | ||
end | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Plugin java> | ||
<% if @jvmarg -%> | ||
<% Array(@jvmarg).each do |arg| -%> | ||
JVMArg "<%= arg %>" | ||
<% end -%> | ||
<% end -%> | ||
</Plugin> |