Skip to content

Commit

Permalink
Merge pull request voxpupuli#196 from bastelfreak/arch_package_name
Browse files Browse the repository at this point in the history
fix hiera key {prometheus_,}install_method on arch
  • Loading branch information
sebastianrakel committed May 20, 2018
2 parents 20c746b + 146a804 commit 7e15da8
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 20 deletions.
2 changes: 1 addition & 1 deletion data/Archlinux.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
prometheus::version: '2.2.0'
prometheus::prometheus_install_method: 'package'
prometheus::install_method: 'package'
prometheus::bin_dir: '/usr/bin'
prometheus::env_file_path: '/etc/default'
12 changes: 11 additions & 1 deletion spec/classes/alertmanager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@
version: '0.9.1',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

describe 'with specific params' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('/tmp/alertmanager-0.9.1.tar.gz') }
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_group('alertmanager') }
it { is_expected.to contain_user('alertmanager') }
it { is_expected.to contain_prometheus__daemon('alertmanager') }
it { is_expected.to contain_service('alertmanager') }
end
describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/alertmanager').with('target' => '/opt/alertmanager-0.9.1.linux-amd64/alertmanager') }
end
Expand Down
11 changes: 10 additions & 1 deletion spec/classes/beanstalkd_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@
version: '1.0.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

describe 'with specific params' do
it { is_expected.to contain_archive('/tmp/beanstalkd_exporter-1.0.0.tar.gz') }
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_group('beanstalkd-exporter') }
it { is_expected.to contain_user('beanstalkd-exporter') }
it { is_expected.to contain_prometheus__daemon('beanstalkd_exporter') }
it { is_expected.to contain_service('beanstalkd_exporter') }
end
describe 'compile manifest' do
it { is_expected.to compile.with_all_deps }
end
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/blackbox_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin',
install_method: 'url',
modules: {
'http_2xx' => {
'prober' => 'http'
Expand All @@ -23,6 +24,7 @@
end

describe 'with all defaults' do
it { is_expected.to contain_class('prometheus') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/usr/local/bin/blackbox_exporter').with('target' => '/opt/blackbox_exporter-0.6.0.linux-amd64/blackbox_exporter') }
it { is_expected.to contain_prometheus__daemon('blackbox_exporter') }
Expand Down
5 changes: 4 additions & 1 deletion spec/classes/consul_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '0.3.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand All @@ -24,6 +25,8 @@
it { is_expected.to contain_user('consul-exporter') }
it { is_expected.to contain_group('consul-exporter') }
it { is_expected.to contain_service('consul_exporter') }
it { is_expected.to contain_archive('/tmp/consul_exporter-0.3.0.tar.gz') }
it { is_expected.to contain_class('prometheus') }
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/elasticsearch_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '1.0.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand Down
12 changes: 11 additions & 1 deletion spec/classes/graphite_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@
context 'without parameters' do
it { is_expected.to contain_prometheus__daemon('graphite_exporter') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('/tmp/graphite_exporter-0.2.0.tar.gz') }
it { is_expected.to contain_group('graphite-exporter') }
it { is_expected.to contain_service('graphite_exporter') }
it { is_expected.to contain_user('graphite-exporter') }
it { is_expected.to contain_class('prometheus') }
end

context 'with params' do
let :params do
{
install_method: 'url'
}
end

it { is_expected.to contain_archive('/tmp/graphite_exporter-0.2.0.tar.gz') }
end
end
end
Expand Down
13 changes: 9 additions & 4 deletions spec/classes/haproxy_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
version: '0.7.1',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') }
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') }
it { is_expected.to contain_archive('/tmp/haproxy_exporter-0.7.1.tar.gz') }
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_user('haproxy-user') }
it { is_expected.to contain_group('haproxy-exporter') }
it { is_expected.to contain_prometheus__daemon('haproxy_exporter') }
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/mongodb_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '0.3.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand Down
11 changes: 10 additions & 1 deletion spec/classes/nginx_vts_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@
version: '0.6',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

describe 'with specific params' do
it { is_expected.to contain_archive('/tmp/nginx-vts-exporter-0.6.tar.gz') }
it { is_expected.to contain_user('nginx-vts-exporter') }
it { is_expected.to contain_group('nginx-vts-exporter') }
it { is_expected.to contain_service('nginx-vts-exporter') }
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_prometheus__daemon('nginx-vts-exporter') }
end
describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/nginx-vts-exporter').with('target' => '/opt/nginx-vts-exporter-0.6.linux-amd64/nginx-vts-exporter') }
it { is_expected.to compile.with_all_deps }
Expand Down
16 changes: 14 additions & 2 deletions spec/classes/node_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@
end

context 'without parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_user('node-exporter') }
it { is_expected.to contain_group('node-exporter') }
it { is_expected.to contain_prometheus__daemon('node_exporter').with(options: ' ') }
it { is_expected.to contain_service('node_exporter') }
end

context 'without collector parameters' do
let(:params) do
{
collectors_enable: %w[foo bar],
collectors_disable: %w[baz qux]
collectors_disable: %w[baz qux],
install_method: 'url'
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('/tmp/node_exporter-0.14.0.tar.gz') }
it { is_expected.to contain_prometheus__daemon('node_exporter').with(options: ' --collector.foo --collector.bar --no-collector.baz --no-collector.qux') }
end

Expand All @@ -31,6 +39,7 @@
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_prometheus__daemon('node_exporter').with(options: '--path.procfs /host/proc --path.sysfs /host/sys --collector.foo --collector.bar --no-collector.baz --no-collector.qux') }
end

Expand All @@ -40,10 +49,13 @@
version: '0.13.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('/tmp/node_exporter-0.13.0.tar.gz') }
describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/node_exporter-0.13.0.linux-amd64/node_exporter') }
end
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/pushgateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '0.4.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/rabbitmq_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '1.0.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/redis_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '0.11.2',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand Down
4 changes: 3 additions & 1 deletion spec/classes/snmp_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
version: '0.6.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

Expand All @@ -31,6 +32,7 @@
'notify' => 'Service[snmp_exporter]'
)
}
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_file('/usr/local/bin/snmp_exporter').with('target' => '/opt/snmp_exporter-0.6.0.linux-amd64/snmp_exporter') }
it { is_expected.to contain_prometheus__daemon('snmp_exporter') }
it { is_expected.to contain_user('snmp-exporter') }
Expand Down
4 changes: 3 additions & 1 deletion spec/classes/varnish_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
version: '1.4',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

it { is_expected.to compile.with_all_deps }
describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/prometheus_varnish_exporter').with('target' => '/opt/prometheus_varnish_exporter-1.4.linux-amd64/prometheus_varnish_exporter') }
end
Expand Down
5 changes: 4 additions & 1 deletion spec/defines/daemon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
user: 'smurf_user',
group: 'smurf_group',
env_vars: { SOMEVAR: 42 },
bin_dir: '/usr/local/bin'
bin_dir: '/usr/local/bin',
install_method: 'url'
}
].each do |parameters|
context "with parameters #{parameters}" do
let(:params) do
parameters
end

it { is_expected.to compile.with_all_deps }

it { is_expected.to contain_class('prometheus') }
prom_os = facts[:kernel].downcase
prom_arch = facts[:architecture] == 'i386' ? '386' : 'amd64'
Expand Down

0 comments on commit 7e15da8

Please sign in to comment.