diff --git a/test/integration/repo/controls/packages_spec.rb b/test/integration/repo/controls/packages_spec.rb index fce7c13..8919c16 100644 --- a/test/integration/repo/controls/packages_spec.rb +++ b/test/integration/repo/controls/packages_spec.rb @@ -1,9 +1,26 @@ # 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' - describe package('prometheus2') do - it { should be_installed } + packages.each do |p| + describe package(p) do + it { should be_installed } + end end end diff --git a/test/integration/repo/controls/repositories_spec.rb b/test/integration/repo/controls/repositories_spec.rb new file mode 100644 index 0000000..c68b6b4 --- /dev/null +++ b/test/integration/repo/controls/repositories_spec.rb @@ -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 diff --git a/test/salt/pillar/repo.sls b/test/salt/pillar/repo.sls index 03473dd..46a3170 100644 --- a/test/salt/pillar/repo.sls +++ b/test/salt/pillar/repo.sls @@ -9,8 +9,9 @@ prometheus: - rust component: - prometheus - - alertmanager # not in debian repo, only archive + - alertmanager - node_exporter + - blackbox_exporter # - memcached_exporter # not in upstream repo, only archive exporters: @@ -29,7 +30,7 @@ prometheus: smartctl: /usr/sbin/smartctl pkg: - use_upstream_repo: true + use_upstream_repo: {{ false if grains.os_family|lower in ('debian',) else true }} use_upstream_archive: false clientlibs: