From 52c5dd2e3f438f6dfd64c25564376e588e5d2046 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 15 Jul 2019 13:09:41 +0200 Subject: [PATCH 1/2] pushgateway: use correct CPU architecture In the past, this class relied on the actual architecture reported by facter, not by the normalized version from our main class. On CentOS, under certain conditions, this will not work and report x86_64 instead of amd64. --- manifests/pushgateway.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pushgateway.pp b/manifests/pushgateway.pp index 7a6b8d637..df7809503 100644 --- a/manifests/pushgateway.pp +++ b/manifests/pushgateway.pp @@ -90,7 +90,7 @@ String $os = $prometheus::os, String $extra_options = '', Optional[String] $download_url = undef, - String $arch = $prometheus::arch, + String[1] $arch = $prometheus::real_arch, String $bin_dir = $prometheus::bin_dir, ) inherits prometheus { From e49761147c5d5ca2e79cd75b9aabd820da569cf9 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 14 Jul 2019 14:34:42 +0200 Subject: [PATCH 2/2] pushgateway: Add acceptance tests --- spec/acceptance/pushgateway_spec.rb | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 spec/acceptance/pushgateway_spec.rb diff --git a/spec/acceptance/pushgateway_spec.rb b/spec/acceptance/pushgateway_spec.rb new file mode 100644 index 000000000..5758f998e --- /dev/null +++ b/spec/acceptance/pushgateway_spec.rb @@ -0,0 +1,52 @@ +require 'spec_helper_acceptance' + +describe 'prometheus pushgateway' do + it 'pushgateway works idempotently with no errors' do + pp = 'include prometheus::pushgateway' + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe service('pushgateway') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(9091) do + it { is_expected.to be_listening.with('tcp6') } + end + + describe 'pushgateway update from 0.4.0 to 0.8.0' do + it 'is idempotent' do + pp = "class{'prometheus::pushgateway': version => '0.4.0'}" + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe service('pushgateway') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(9091) do + it { is_expected.to be_listening.with('tcp6') } + end + it 'is idempotent' do + pp = "class{'prometheus::pushgateway': version => '0.8.0'}" + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe service('pushgateway') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(9091) do + it { is_expected.to be_listening.with('tcp6') } + end + end +end