diff --git a/spec/acceptance/haproxy_exporter_spec.rb b/spec/acceptance/haproxy_exporter_spec.rb new file mode 100644 index 000000000..2af0d831d --- /dev/null +++ b/spec/acceptance/haproxy_exporter_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper_acceptance' + +describe 'prometheus haproxy_exporter' do + it 'haproxy_exporter works idempotently with no errors' do + if default[:platform] =~ %r{ubuntu-18.04-amd64} + pp = "package{'iproute2': ensure => present}" + apply_manifest(pp, catch_failures: true) + end + pp = 'include prometheus::haproxy_exporter' + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe service('haproxy_exporter') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(9101) do + it { is_expected.to be_listening.with('tcp6') } + end + + describe 'haproxy_exporter update from 0.7.1 to 0.9.0' do + it 'is idempotent' do + pp = "class{'prometheus::haproxy_exporter': version => '0.7.1'}" + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe service('haproxy_exporter') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(9101) do + it { is_expected.to be_listening.with('tcp6') } + end + it 'is idempotent' do + pp = "class{'prometheus::haproxy_exporter': version => '0.9.0'}" + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe service('haproxy_exporter') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(9101) do + it { is_expected.to be_listening.with('tcp6') } + end + end +end