Skip to content
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

Fix for issue #552 including acceptance tests #556

Merged
merged 4 commits into from
Oct 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ fixtures:
concat:
repo: 'git://github.com/puppetlabs/puppetlabs-concat'
ref: '2.1.0'
yum:
repo: 'https://github.com/voxpupuli/puppet-yum.git'
symlinks:
'collectd': "#{source_dir}"
12 changes: 12 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
}

if $manage_package {
if $::osfamily == 'RedHat' {
if !defined(Yum::Install['epel-release']) {
yum::install { 'epel-release':
ensure => 'present',
source => "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${::operatingsystemmajrelease}.noarch.rpm",
}
}
Package[$package_name] {
require => Yum::Install['epel-release']
}
}

package { $package_name:
ensure => $package_ensure,
provider => $package_provider,
Expand Down
4 changes: 4 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
{
"name": "puppetlabs/concat",
"version_requirement": ">= 1.0.4"
},
{
"name": "puppet-yum",
"version_requirement": ">= 0.9.15"
}
]
}
14 changes: 14 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,18 @@ class { 'collectd': }
it { should be_running }
end
end

context 'install memory plugin' do
it 'works idemptontently' do
pp = <<-EOS
class { '::collectd': }

class { '::collectd::plugin::memory': }
EOS

# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
end
7 changes: 4 additions & 3 deletions spec/classes/collectd_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down Expand Up @@ -102,13 +103,13 @@

context 'with internal_stats => true' do
context 'with collectd_version = 5.5' do
let(:facts) { { osfamily: 'RedHat', collectd_version: '5.5' } }
let(:facts) { { osfamily: 'RedHat', collectd_version: '5.5', operatingsystemmajrelease: '7' } }
let(:params) { { purge_config: true, internal_stats: true } }
it { is_expected.to contain_file('collectd.conf').without_content(%r{^CollectInternalStats}) }
end

context 'with collectd_version = 5.6' do
let(:facts) { { osfamily: 'RedHat', collectd_version: '5.6' } }
let(:facts) { { osfamily: 'RedHat', collectd_version: '5.6', operatingsystemmajrelease: '7' } }
let(:params) { { purge_config: true, internal_stats: true } }
it { is_expected.to contain_file('collectd.conf').with_content(%r{^CollectInternalStats true}) }
end
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_ceph_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
12 changes: 8 additions & 4 deletions spec/classes/collectd_plugin_cgroups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.4.0'
collectd_version: '5.4.0',
operatingsystemmajrelease: '7'
}
end
context ':ensure => present, default params' do
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.4.0'
collectd_version: '5.4.0',
operatingsystemmajrelease: '7'
}
end
it 'Will create /etc/collectd.d/10-cgroups.conf' do
Expand All @@ -26,7 +28,8 @@
let :facts do
{
osfamily: 'Redhat',
collectd_version: '5.4.0'
collectd_version: '5.4.0',
operatingsystemmajrelease: '7'
}
end
let :params do
Expand All @@ -49,7 +52,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5.0'
collectd_version: '5.5.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
6 changes: 4 additions & 2 deletions spec/classes/collectd_plugin_cpu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down Expand Up @@ -33,7 +34,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5'
collectd_version: '5.5',
operatingsystemmajrelease: '7'
}
end
let :params do
Expand Down
15 changes: 10 additions & 5 deletions spec/classes/collectd_plugin_curl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

context ':ensure => present, default params' do
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end
it 'Will create /etc/collectd.d/10-curl.conf' do
Expand All @@ -29,7 +31,8 @@
let :facts do
{
osfamily: 'Debian',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end
let :params do
Expand Down Expand Up @@ -64,7 +67,8 @@
let :facts do
{
osfamily: 'Debian',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end
let :params do
Expand Down Expand Up @@ -92,7 +96,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end
let :params do
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_dbi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
collectd_version: '5.0'
collectd_version: '5.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
21 changes: 14 additions & 7 deletions spec/classes/collectd_plugin_disk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down Expand Up @@ -33,7 +34,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5'
collectd_version: '5.5',
operatingsystemmajrelease: '7'
}
end

Expand All @@ -52,7 +54,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5'
collectd_version: '5.5',
operatingsystemmajrelease: '7'
}
end

Expand All @@ -71,7 +74,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5'
collectd_version: '5.5',
operatingsystemmajrelease: '7'
}
end

Expand All @@ -85,7 +89,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.4'
collectd_version: '5.4',
operatingsystemmajrelease: '7'
}
end

Expand All @@ -111,7 +116,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.4'
collectd_version: '5.4',
operatingsystemmajrelease: '7'
}
end
it 'Will not include the setting' do
Expand All @@ -127,7 +133,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5'
collectd_version: '5.5',
operatingsystemmajrelease: '7'
}
end
it 'Will include the setting' do
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_dns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
collectd_version: '5.2',
osfamily: 'RedHat'
osfamily: 'RedHat',
operatingsystemmajrelease: '7'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_ethstat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
collectd_version: '5.0'
collectd_version: '5.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
6 changes: 4 additions & 2 deletions spec/classes/collectd_plugin_fhcount_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5.0'
collectd_version: '5.5.0',
operatingsystemmajrelease: '7'
}
end

Expand All @@ -13,7 +14,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.5'
collectd_version: '5.5',
operatingsystemmajrelease: '7'
}
end
let :params do
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_filecount_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
collectd_version: '5.0'
collectd_version: '5.0',
operatingsystemmajrelease: '7'
}
end
context ':ensure => present and default parameters' do
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_genericjmx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
id: 'root',
concat_basedir: '/dne',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/collectd_plugin_interface_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
let :facts do
{
osfamily: 'RedHat',
collectd_version: '4.8.0'
collectd_version: '4.8.0',
operatingsystemmajrelease: '7'
}
end

Expand Down
Loading