Skip to content

Commit

Permalink
Merge 2acffdb into 75b28f0
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed May 26, 2017
2 parents 75b28f0 + 2acffdb commit 3299e62
Show file tree
Hide file tree
Showing 27 changed files with 1,410 additions and 1,413 deletions.
1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ fixtures:
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib'
concat:
repo: 'git://github.com/puppetlabs/puppetlabs-concat'
ref: '2.1.0'
epel:
repo: 'https://github.com/stahnma/puppet-module-epel'
symlinks:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Puppetfile.lock
*.iml
.*.sw?
.yardoc/
Guardfile
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '0.21.0'
modulesync_config_version: '0.21.3'
1 change: 1 addition & 0 deletions .rspec_parallel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--format progress
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AllCops:
- spec/fixtures/**/*
- Gemfile
- Rakefile
- Guardfile
Lint/ConditionPosition:
Enabled: True

Expand Down Expand Up @@ -502,6 +503,10 @@ Style/ClosingParenthesisIndentation:

# RSpec

RSpec/BeforeAfterAll:
Exclude:
- spec/acceptance/**/*

# We don't use rspec in this way
RSpec/DescribeClass:
Enabled: False
Expand All @@ -524,6 +529,7 @@ RSpec/NestedGroups:
# this is broken on ruby1.9
Style/IndentHeredoc:
Enabled: False

# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs
Security/YAMLLoad:
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ group :test do
gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2'
gem 'parallel_tests', :require => false
end

group :development do
Expand Down
13 changes: 13 additions & 0 deletions spec/acceptance/nodesets/archlinux-2-x64.yml
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
177 changes: 76 additions & 101 deletions spec/classes/collectd_plugin_curl_spec.rb
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
Loading

0 comments on commit 3299e62

Please sign in to comment.