From 7f2db3a912b4efd6f66adf634d141a8a514198f4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 17 Mar 2018 21:55:25 +0100 Subject: [PATCH] rework tests --- spec/classes/alertmanager_spec.rb | 3 ++- spec/classes/beanstalkd_exporter_spec.rb | 3 ++- spec/classes/blackbox_exporter_spec.rb | 1 + spec/classes/consul_exporter_spec.rb | 3 ++- spec/classes/elasticsearch_exporter_spec.rb | 3 ++- spec/classes/haproxy_exporter_spec.rb | 3 ++- spec/classes/mongodb_exporter_spec.rb | 3 ++- spec/classes/nginx_vts_exporter_spec.rb | 3 ++- spec/classes/node_exporter_spec.rb | 3 ++- spec/classes/prometheus_spec.rb | 7 ++++--- spec/classes/pushgateway_spec.rb | 3 ++- spec/classes/rabbitmq_exporter_spec.rb | 3 ++- spec/classes/redis_exporter_spec.rb | 3 ++- spec/classes/snmp_exporter_spec.rb | 3 ++- spec/defines/alerts_spec.rb | 3 ++- spec/defines/daemon_spec.rb | 5 +++-- 16 files changed, 34 insertions(+), 18 deletions(-) diff --git a/spec/classes/alertmanager_spec.rb b/spec/classes/alertmanager_spec.rb index 56ca6691b..2076e547a 100644 --- a/spec/classes/alertmanager_spec.rb +++ b/spec/classes/alertmanager_spec.rb @@ -12,7 +12,8 @@ { version: '0.9.1', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/beanstalkd_exporter_spec.rb b/spec/classes/beanstalkd_exporter_spec.rb index 17b92458d..591c77972 100644 --- a/spec/classes/beanstalkd_exporter_spec.rb +++ b/spec/classes/beanstalkd_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '1.0.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/blackbox_exporter_spec.rb b/spec/classes/blackbox_exporter_spec.rb index dd9c6b701..aabe786d9 100644 --- a/spec/classes/blackbox_exporter_spec.rb +++ b/spec/classes/blackbox_exporter_spec.rb @@ -13,6 +13,7 @@ version: '0.6.0', arch: 'amd64', os: 'linux', + bin_dir: '/usr/local/bin', modules: { 'http_2xx' => { 'prober' => 'http' diff --git a/spec/classes/consul_exporter_spec.rb b/spec/classes/consul_exporter_spec.rb index 3c4a88e0c..92161374a 100644 --- a/spec/classes/consul_exporter_spec.rb +++ b/spec/classes/consul_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.3.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/elasticsearch_exporter_spec.rb b/spec/classes/elasticsearch_exporter_spec.rb index 31e0dad1f..520a64ace 100644 --- a/spec/classes/elasticsearch_exporter_spec.rb +++ b/spec/classes/elasticsearch_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '1.0.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/haproxy_exporter_spec.rb b/spec/classes/haproxy_exporter_spec.rb index e9bbddbad..051ce9d2e 100644 --- a/spec/classes/haproxy_exporter_spec.rb +++ b/spec/classes/haproxy_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.7.1', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/mongodb_exporter_spec.rb b/spec/classes/mongodb_exporter_spec.rb index 83dcdca4c..4abc1098a 100644 --- a/spec/classes/mongodb_exporter_spec.rb +++ b/spec/classes/mongodb_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.3.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/nginx_vts_exporter_spec.rb b/spec/classes/nginx_vts_exporter_spec.rb index 09478f517..7cec68198 100644 --- a/spec/classes/nginx_vts_exporter_spec.rb +++ b/spec/classes/nginx_vts_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.6', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/node_exporter_spec.rb b/spec/classes/node_exporter_spec.rb index aac716921..618164a2f 100644 --- a/spec/classes/node_exporter_spec.rb +++ b/spec/classes/node_exporter_spec.rb @@ -39,7 +39,8 @@ { version: '0.13.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/prometheus_spec.rb b/spec/classes/prometheus_spec.rb index adcb70804..55ef905db 100644 --- a/spec/classes/prometheus_spec.rb +++ b/spec/classes/prometheus_spec.rb @@ -7,7 +7,7 @@ facts end - [{}, { version: '2.0.0-rc.1' }].each do |parameters| + [{ version: '2.0.0-rc.1', bin_dir: '/usr/local/bin', install_method: 'url' }].each do |parameters| context "with parameters #{parameters}" do let(:params) do parameters @@ -116,7 +116,7 @@ 'content' => File.read(fixtures('files', "prometheus#{prom_major}.sysv")) ) } - elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64'].include?(os) + elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64', 'archlinux-4-x86_64'].include?(os) # init_style = 'systemd' it { is_expected.to contain_class('systemd') } @@ -203,6 +203,7 @@ context 'with alerts configured', alerts: true do [ { + version: '1.5.3', alerts: [{ 'name' => 'alert_name', 'condition' => 'up == 0', @@ -236,7 +237,7 @@ parameters end - prom_version = parameters[:version] || '1.5.2' + prom_version = parameters[:version] prom_major = prom_version[0] it { diff --git a/spec/classes/pushgateway_spec.rb b/spec/classes/pushgateway_spec.rb index 05eb24319..ef7dd69f9 100644 --- a/spec/classes/pushgateway_spec.rb +++ b/spec/classes/pushgateway_spec.rb @@ -12,7 +12,8 @@ { version: '0.4.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/rabbitmq_exporter_spec.rb b/spec/classes/rabbitmq_exporter_spec.rb index baec28d22..4aeef756d 100644 --- a/spec/classes/rabbitmq_exporter_spec.rb +++ b/spec/classes/rabbitmq_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '1.0.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/redis_exporter_spec.rb b/spec/classes/redis_exporter_spec.rb index 593673800..93be13b5b 100644 --- a/spec/classes/redis_exporter_spec.rb +++ b/spec/classes/redis_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.11.2', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/classes/snmp_exporter_spec.rb b/spec/classes/snmp_exporter_spec.rb index a64c08533..da10b25fd 100644 --- a/spec/classes/snmp_exporter_spec.rb +++ b/spec/classes/snmp_exporter_spec.rb @@ -12,7 +12,8 @@ { version: '0.6.0', arch: 'amd64', - os: 'linux' + os: 'linux', + bin_dir: '/usr/local/bin' } end diff --git a/spec/defines/alerts_spec.rb b/spec/defines/alerts_spec.rb index 781032ead..6abbb4185 100644 --- a/spec/defines/alerts_spec.rb +++ b/spec/defines/alerts_spec.rb @@ -17,6 +17,7 @@ [ { + version: '1.5.2', alerts: [ { 'name' => 'alert_name', @@ -62,7 +63,7 @@ parameters end - prom_version = parameters[:version] || '1.5.2' + prom_version = parameters[:version] prom_major = prom_version[0] it { diff --git a/spec/defines/daemon_spec.rb b/spec/defines/daemon_spec.rb index 333ebc97d..cd7efd9d7 100644 --- a/spec/defines/daemon_spec.rb +++ b/spec/defines/daemon_spec.rb @@ -22,7 +22,8 @@ notify_service: 'Service[smurf_exporter]', user: 'smurf_user', group: 'smurf_group', - env_vars: { SOMEVAR: 42 } + env_vars: { SOMEVAR: 42 }, + bin_dir: '/usr/local/bin' } ].each do |parameters| context "with parameters #{parameters}" do @@ -102,7 +103,7 @@ %r{daemon --user=smurf_user \\\n --pidfile="\$PID_FILE" \\\n "\$DAEMON" '' >> "\$LOG_FILE" &} ) } - elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64'].include?(os) + elsif ['centos-7-x86_64', 'debian-8-x86_64', 'redhat-7-x86_64', 'ubuntu-16.04-x86_64', 'archlinux-4-x86_64'].include?(os) # init_style = 'systemd' it { is_expected.to contain_class('systemd') }