|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
3 |
| -control 'prometheus services' do |
| 3 | +control 'services with a consistent service name across distros' do |
4 | 4 | title 'should be running'
|
5 | 5 |
|
| 6 | + # we forced node_exporter's service name to `node_exporter` in the pillar, |
| 7 | + # so its name will be the same across distros for this test |
6 | 8 | describe service('node_exporter') do
|
7 | 9 | it { should be_enabled }
|
8 | 10 | it { should be_running }
|
|
13 | 15 | it { should be_listening }
|
14 | 16 | end
|
15 | 17 | end
|
| 18 | + |
| 19 | +control 'services with a consistent service name on each distro' do |
| 20 | + title 'should be running' |
| 21 | + |
| 22 | + # if we don't set a service name in the pillar, |
| 23 | + # its name will be the same on each distro, no matter what the |
| 24 | + # install method we choose |
| 25 | + |
| 26 | + distro_service = |
| 27 | + case platform[:family] |
| 28 | + when 'debian' |
| 29 | + 'prometheus-blackbox-exporter' |
| 30 | + else |
| 31 | + 'blackbox_exporter' |
| 32 | + end |
| 33 | + |
| 34 | + describe service(distro_service) do |
| 35 | + it { should be_enabled } |
| 36 | + it { should be_running } |
| 37 | + end |
| 38 | + |
| 39 | + # blackbox_exporter port |
| 40 | + describe port(9115) do |
| 41 | + it { should be_listening } |
| 42 | + end |
| 43 | +end |
| 44 | + |
| 45 | +control 'services with any service name we want to give them' do |
| 46 | + title 'should be running' |
| 47 | + |
| 48 | + # if we set a service name in the pillar, |
| 49 | + # the formula should work, no matter what it is or the |
| 50 | + # install method we choose |
| 51 | + |
| 52 | + describe service('my-fancy-consul-exporter-service') do |
| 53 | + it { should be_enabled } |
| 54 | + it { should be_running } |
| 55 | + end |
| 56 | + |
| 57 | + # consul_exporter port |
| 58 | + describe port(9107) do |
| 59 | + it { should be_listening } |
| 60 | + end |
| 61 | +end |
0 commit comments