Skip to content

Commit

Permalink
test(archive): add env vars tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lagooj committed Jan 6, 2021
1 parent 1631137 commit 018e759
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/integration/default/controls/archive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
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
Expand Down Expand Up @@ -45,6 +47,12 @@
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
Expand Down Expand Up @@ -131,6 +139,25 @@
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' }
Expand Down
8 changes: 8 additions & 0 deletions test/salt/pillar/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ prometheus:
- consul_exporter
- php-fpm_exporter
- postgres_exporter
- mysqld_exporter
# - memcached_exporter # not in upstream repo, only archive

exporters:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 018e759

Please sign in to comment.