Skip to content

Commit

Permalink
Adding tests for haproxy scrape_uri
Browse files Browse the repository at this point in the history
Add & refactor haproxy scraping uri tests
  • Loading branch information
othalla committed Jan 11, 2019
1 parent 244dbf4 commit 81d1e07
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions spec/classes/haproxy_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
it { is_expected.to contain_prometheus__daemon('haproxy_exporter') }
end

context 'with unix socket as scraping url' do
context 'with custom scraping uri' do
let(:params) do
{
cnf_scrape_uri: 'unix:/var/haproxy/listen.sock',
Expand All @@ -38,11 +38,21 @@
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('prometheus') }
it { is_expected.to contain_user('haproxy-user') }
it { is_expected.to contain_group('haproxy-exporter') }
it { is_expected.to contain_prometheus__daemon('haproxy_exporter') }
context 'unix socket' do
let(:params) do
super().merge(cnf_scrape_uri: 'unix:/var/haproxy/listen.sock')
end

it { is_expected.to compile.with_all_deps }
end

context 'bad format' do
let(:params) do
super().merge(cnf_scrape_uri: 'nosocket:/not/a/socket.format')
end

it { is_expected.to raise_error(Puppet::Error) }
end
end
end
end
Expand Down

0 comments on commit 81d1e07

Please sign in to comment.