test(packages): check when using repo or archives

This commit is contained in:
Javier Bértoli 2020-08-21 10:34:29 -03:00
parent 3014494740
commit c5ad857590
3 changed files with 46 additions and 5 deletions

View File

@ -1,9 +1,26 @@
# frozen_string_literal: true # frozen_string_literal: true
control 'prometheus package' do case platform[:family]
when 'redhat'
packages = %w[
prometheus2
alertmanager
node_exporter
]
when 'debian'
packages = %w[
prometheus
prometheus-alertmanager
prometheus-node-exporter
]
end
control 'prometheus packages' do
title 'should be installed' title 'should be installed'
describe package('prometheus2') do packages.each do |p|
describe package(p) do
it { should be_installed } it { should be_installed }
end end
end
end end

View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
control 'repositories' do
impact 0.6
title 'Configure the repositories'
desc '
Configure the Debian/RedHat repositories for the supported platforms.
'
tag 'repositories', 'apt', 'yum'
ref 'Prometheus prerequisites - Section: Prometheus package repositories', url: 'https://prometheus.io/download'
case os[:family]
when 'debian'
describe file('/etc/apt/sources.list.d/prometheus.list') do
it { should_not exist }
end
when 'redhat', 'centos'
describe yum.repo('prometheus') do
it { should exist }
it { should be_enabled }
end
end
end

View File

@ -9,8 +9,9 @@ prometheus:
- rust - rust
component: component:
- prometheus - prometheus
- alertmanager # not in debian repo, only archive - alertmanager
- node_exporter - node_exporter
- blackbox_exporter
# - memcached_exporter # not in upstream repo, only archive # - memcached_exporter # not in upstream repo, only archive
exporters: exporters:
@ -29,7 +30,7 @@ prometheus:
smartctl: /usr/sbin/smartctl smartctl: /usr/sbin/smartctl
pkg: pkg:
use_upstream_repo: true use_upstream_repo: {{ false if grains.os_family|lower in ('debian',) else true }}
use_upstream_archive: false use_upstream_archive: false
clientlibs: clientlibs: