Skip to content

Commit

Permalink
Add & refactor haproxy scraping uri tests
Browse files Browse the repository at this point in the history
  • Loading branch information
othalla committed Jan 11, 2019
1 parent 6a39d0c commit bc44d08
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 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,20 +38,21 @@
}
end

it { is_expected.to compile.with_all_deps }
end
context 'with bad scrape uri' do
let(:params) do
{
cnf_scrape_uri: '/var/haproxy/listen.sock',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin',
install_method: 'url'
}
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

it { is_expected.to raise_error(Puppet::Error) }
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 bc44d08

Please sign in to comment.