test(services): fix path for debian family

This commit is contained in:
Javier Bértoli 2020-08-24 19:55:09 -03:00
parent 844a77f16a
commit 7c1cdb8fdf
2 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,14 @@
control 'prometheus components' do control 'prometheus components' do
title 'should be installed' title 'should be installed'
service_dir =
case platform[:family]
when 'debian'
'/lib/systemd/system'
else
'/usr/lib/systemd/system'
end
# describe package('cron') do # describe package('cron') do
# it { should be_installed } # not available on amazonlinux? # it { should be_installed } # not available on amazonlinux?
# end # end
@ -39,7 +47,7 @@ control 'prometheus components' do
it { should exist } it { should exist }
its('group') { should eq 'prometheus' } its('group') { should eq 'prometheus' }
end end
describe file('/usr/lib/systemd/system/prometheus.service') do describe file("#{service_dir}/prometheus.service") do
it { should exist } it { should exist }
its('group') { should eq 'root' } its('group') { should eq 'root' }
its('mode') { should cmp '0644' } its('mode') { should cmp '0644' }
@ -56,7 +64,7 @@ control 'prometheus components' do
it { should exist } it { should exist }
its('group') { should eq 'alertmanager' } its('group') { should eq 'alertmanager' }
end end
describe file('/usr/lib/systemd/system/alertmanager.service') do describe file("#{service_dir}/alertmanager.service") do
it { should exist } it { should exist }
its('group') { should eq 'root' } its('group') { should eq 'root' }
its('mode') { should cmp '0644' } its('mode') { should cmp '0644' }
@ -73,7 +81,7 @@ control 'prometheus components' do
it { should exist } it { should exist }
its('group') { should eq 'node_exporter' } its('group') { should eq 'node_exporter' }
end end
describe file('/usr/lib/systemd/system/node_exporter.service') do describe file("#{service_dir}/node_exporter.service") do
it { should exist } it { should exist }
its('group') { should eq 'root' } its('group') { should eq 'root' }
its('mode') { should cmp '0644' } its('mode') { should cmp '0644' }

View File

@ -93,7 +93,7 @@ prometheus:
archive: archive:
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424 source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
service: service:
# name: prometheus-node-exporter name: node_exporter
args: args:
web.listen-address: ":9110" web.listen-address: ":9110"
# collector.textfile.directory: /var/tmp/node_exporter # collector.textfile.directory: /var/tmp/node_exporter