-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
27 changed files
with
1,410 additions
and
1,413 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ Puppetfile.lock | |
*.iml | ||
.*.sw? | ||
.yardoc/ | ||
Guardfile |
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 +1 @@ | ||
modulesync_config_version: '0.21.0' | ||
modulesync_config_version: '0.21.3' |
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 @@ | ||
--format progress |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# This file is managed via modulesync | ||
# https://github.com/voxpupuli/modulesync | ||
# https://github.com/voxpupuli/modulesync_config | ||
HOSTS: | ||
archlinux-2-x64: | ||
roles: | ||
- master | ||
platform: archlinux-2-x64 | ||
box: archlinux/archlinux | ||
hypervisor: vagrant | ||
CONFIG: | ||
type: foss |
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,118 +1,93 @@ | ||
require 'spec_helper' | ||
|
||
describe 'collectd::plugin::curl', type: :class do | ||
let :pre_condition do | ||
'include ::collectd' | ||
end | ||
let :facts do | ||
{ | ||
osfamily: 'RedHat', | ||
collectd_version: '4.8.0', | ||
operatingsystemmajrelease: '7', | ||
python_dir: '/usr/local/lib/python2.7/dist-packages' | ||
} | ||
end | ||
on_supported_os.each do |os, facts| | ||
context "on #{os} " do | ||
let :facts do | ||
facts | ||
end | ||
|
||
context ':ensure => present, default params' do | ||
let :facts do | ||
{ | ||
osfamily: 'RedHat', | ||
collectd_version: '4.8.0', | ||
operatingsystemmajrelease: '7', | ||
python_dir: '/usr/local/lib/python2.7/dist-packages' | ||
} | ||
end | ||
options = os_specific_options(facts) | ||
|
||
it 'Will create /etc/collectd.d/10-curl.conf' do | ||
is_expected.to contain_file('curl.load').with(ensure: 'present', | ||
path: '/etc/collectd.d/10-curl.conf', | ||
content: %r{\#\ Generated by Puppet\nLoadPlugin curl\n\n}) | ||
end | ||
end | ||
let :pre_condition do | ||
'include ::collectd' | ||
end | ||
|
||
context ':ensure => present, creating two pages' do | ||
let :facts do | ||
{ | ||
osfamily: 'Debian', | ||
collectd_version: '4.8.0', | ||
operatingsystemmajrelease: '7', | ||
python_dir: '/usr/local/lib/python2.7/dist-packages' | ||
} | ||
end | ||
let :params do | ||
{ | ||
ensure: 'present', | ||
pages: { | ||
'stocks_ILD' => { | ||
'url' => 'http://finance.google.com/finance?q=EPA%3AILD', | ||
'user' => 'foo', | ||
'password' => 'bar', | ||
'matches' => [ | ||
{ | ||
'dstype' => 'GaugeAverage', | ||
'instance' => 'ILD', | ||
'regex' => ']*> *([0-9]*\\.[0-9]+) *', | ||
'type' => 'stock_value' | ||
context ':ensure => present, default params' do | ||
it "Will create #{options[:plugin_conf_dir]}/10-curl.conf" do | ||
is_expected.to contain_file('curl.load').with( | ||
ensure: 'present', | ||
path: "#{options[:plugin_conf_dir]}/10-curl.conf", | ||
content: %r{LoadPlugin curl} | ||
) | ||
end | ||
end | ||
|
||
context ':ensure => present, creating two pages' do | ||
let :params do | ||
{ | ||
ensure: 'present', | ||
pages: { | ||
'stocks_ILD' => { | ||
'url' => 'http://finance.google.com/finance?q=EPA%3AILD', | ||
'user' => 'foo', | ||
'password' => 'bar', | ||
'matches' => [ | ||
{ | ||
'dstype' => 'GaugeAverage', | ||
'instance' => 'ILD', | ||
'regex' => ']*> *([0-9]*\\.[0-9]+) *', | ||
'type' => 'stock_value' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
end | ||
end | ||
|
||
it 'Will create /etc/collectd.d/conf.d/curl-stocks_ILD.conf and /etc/collectd/conf.d/curl-stocks_GM.conf' do | ||
is_expected.to contain_file('/etc/collectd/conf.d/curl-stocks_ILD.conf').with(ensure: 'present', | ||
path: '/etc/collectd/conf.d/curl-stocks_ILD.conf', | ||
content: "<Plugin curl>\n <Page \"stocks_ILD\">\n URL \"http://finance.google.com/finance?q=EPA%3AILD\"\n User \"foo\"\n Password \"bar\"\n <Match>\n Regex \"]*> *([0-9]*\\.[0-9]+) *\"\n DSType \"GaugeAverage\"\n Type \"stock_value\"\n Instance \"ILD\"\n </Match>\n\n </Page>\n</Plugin>\n") | ||
end | ||
end | ||
it "Will create #{options[:plugin_conf_dir]}/curl-stocks_ILD.conf and #{options[:plugin_conf_dir]}/curl-stocks_GM.conf" do | ||
is_expected.to contain_file("#{options[:plugin_conf_dir]}/curl-stocks_ILD.conf").with( | ||
ensure: 'present', | ||
path: "#{options[:plugin_conf_dir]}/curl-stocks_ILD.conf", | ||
content: "<Plugin curl>\n <Page \"stocks_ILD\">\n URL \"http://finance.google.com/finance?q=EPA%3AILD\"\n User \"foo\"\n Password \"bar\"\n <Match>\n Regex \"]*> *([0-9]*\\.[0-9]+) *\"\n DSType \"GaugeAverage\"\n Type \"stock_value\"\n Instance \"ILD\"\n </Match>\n\n </Page>\n</Plugin>\n") | ||
end | ||
end | ||
|
||
context ':ensure => present, verifypeer => false, verifyhost => \'false\', measureresponsetime => true, matches empty' do | ||
let :facts do | ||
{ | ||
osfamily: 'Debian', | ||
collectd_version: '4.8.0', | ||
operatingsystemmajrelease: '7', | ||
python_dir: '/usr/local/lib/python2.7/dist-packages' | ||
} | ||
end | ||
let :params do | ||
{ | ||
ensure: 'present', | ||
pages: { | ||
'selfsigned_ssl' => { | ||
'url' => 'https://some.selfsigned.ssl.site/', | ||
'verifypeer' => false, | ||
'verifyhost' => 'false', | ||
'measureresponsetime' => true | ||
context ':ensure => present, verifypeer => false, verifyhost => \'false\', measureresponsetime => true, matches empty' do | ||
let :params do | ||
{ | ||
ensure: 'present', | ||
pages: { | ||
'selfsigned_ssl' => { | ||
'url' => 'https://some.selfsigned.ssl.site/', | ||
'verifypeer' => false, | ||
'verifyhost' => 'false', | ||
'measureresponsetime' => true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
end | ||
end | ||
|
||
it 'Will create /etc/collectd.d/conf.d/curl-selfsigned_ssl.conf' do | ||
is_expected.to contain_file('/etc/collectd/conf.d/curl-selfsigned_ssl.conf').with(ensure: 'present', | ||
path: '/etc/collectd/conf.d/curl-selfsigned_ssl.conf', | ||
content: "<Plugin curl>\n <Page \"selfsigned_ssl\">\n URL \"https://some.selfsigned.ssl.site/\"\n VerifyPeer false\n VerifyHost false\n MeasureResponseTime true\n </Page>\n</Plugin>\n") | ||
end | ||
end | ||
it "Will create #{options[:plugin_conf_dir]}/curl-selfsigned_ssl.conf" do | ||
is_expected.to contain_file("#{options[:plugin_conf_dir]}/curl-selfsigned_ssl.conf").with( | ||
ensure: 'present', | ||
path: "#{options[:plugin_conf_dir]}/curl-selfsigned_ssl.conf", | ||
content: "<Plugin curl>\n <Page \"selfsigned_ssl\">\n URL \"https://some.selfsigned.ssl.site/\"\n VerifyPeer false\n VerifyHost false\n MeasureResponseTime true\n </Page>\n</Plugin>\n") | ||
end | ||
end | ||
|
||
context ':ensure => absent' do | ||
let :facts do | ||
{ | ||
osfamily: 'RedHat', | ||
collectd_version: '4.8.0', | ||
operatingsystemmajrelease: '7', | ||
python_dir: '/usr/local/lib/python2.7/dist-packages' | ||
} | ||
end | ||
let :params do | ||
{ ensure: 'absent' } | ||
end | ||
context ':ensure => absent' do | ||
let :params do | ||
{ ensure: 'absent' } | ||
end | ||
|
||
it 'Will not create /etc/collectd.d/10-curl.conf' do | ||
is_expected.to contain_file('curl.load').with(ensure: 'absent', | ||
path: '/etc/collectd.d/10-curl.conf') | ||
it "Will not create #{options[:plugin_conf_dir]}/10-curl.conf" do | ||
is_expected.to contain_file('curl.load').with( | ||
ensure: 'absent', | ||
path: "#{options[:plugin_conf_dir]}/10-curl.conf" | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.