test(archive): add env vars tests

This commit is contained in:
lagooj 2020-12-01 17:41:18 +01:00
parent 1631137b1b
commit 018e759183
2 changed files with 35 additions and 0 deletions

View File

@ -10,12 +10,14 @@ control 'prometheus components' do
node_exporter_service = 'prometheus-node-exporter'
php_fpm_exporter_service = 'php-fpm_exporter'
postgres_exporter_service = 'prometheus-postgres-exporter'
mysqld_exporter_service = 'prometheus-mysqld-exporter'
else
service_dir = '/usr/lib/systemd/system'
alert_manager_service = 'alertmanager'
node_exporter_service = 'node_exporter'
php_fpm_exporter_service = 'php-fpm_exporter'
postgres_exporter_service = 'postgres_exporter'
mysqld_exporter_service = 'mysqld_exporter'
end
# describe package('cron') do
@ -45,6 +47,12 @@ control 'prometheus components' do
describe user('postgres_exporter') do
it { should exist }
end
describe group('mysqld_exporter') do
it { should exist }
end
describe user('mysqld_exporter') do
it { should exist }
end
describe directory('/var/lib/prometheus') do
it { should exist }
end
@ -131,6 +139,25 @@ control 'prometheus components' do
its('group') { should eq 'root' }
its('mode') { should cmp '0644' }
end
describe directory('/opt/prometheus/mysqld_exporter-v0.12.1') do
it { should exist }
its('group') { should eq 'root' }
end
describe file('/opt/prometheus/mysqld_exporter-v0.12.1/mysqld_exporter') do
it { should exist }
its('group') { should eq 'root' }
end
describe directory('/var/lib/prometheus/mysqld_exporter') do
it { should exist }
its('group') { should eq 'mysqld_exporter' }
end
describe file("#{service_dir}/#{mysqld_exporter_service}.service") do
it { should exist }
its('content') { should match 'Environment=DATA_SOURCE_NAME=foo:bar@/' }
its('group') { should eq 'root' }
its('mode') { should cmp '0644' }
end
describe file('/usr/local/sbin/alertmanager') do
it { should exist }
its('group') { should eq 'root' }

View File

@ -17,6 +17,7 @@ prometheus:
- consul_exporter
- php-fpm_exporter
- postgres_exporter
- mysqld_exporter
# - memcached_exporter # not in upstream repo, only archive
exporters:
@ -100,6 +101,13 @@ prometheus:
# This is to test that any fancy name we use, will work in archive mode
name: my-fancy-consul-exporter-service
mysqld_exporter:
service:
args:
web.listen-address: 0.0.0.0:9192
env:
- 'DATA_SOURCE_NAME=foo:bar@/'
prometheus:
service:
args: