|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require 'spec_helper_acceptance' |
| 4 | + |
| 5 | +describe 'cvmfs enable_prometheus_exporter' do |
| 6 | + it 'configures and work with no errors' do |
| 7 | + # Clean up all existing mounts |
| 8 | + shell('cvmfs_config killall', acceptable_exit_codes: [0, 127]) |
| 9 | + pp = <<-PUPPET |
| 10 | + class{ 'cvmfs': |
| 11 | + cvmfs_http_proxy => 'http://ca-proxy.cern.ch:3128;DIRECT', |
| 12 | + enable_prometheus_exporter => true, |
| 13 | + } |
| 14 | + cvmfs::domain{ 'cern.ch': |
| 15 | + cvmfs_server_url => 'http://cvmfs-stratum-one.cern.ch/cvmfs/@fqrn@' |
| 16 | + } |
| 17 | + PUPPET |
| 18 | + # Run it three times, it should be stable by then |
| 19 | + apply_manifest(pp, catch_failures: true) |
| 20 | + apply_manifest(pp, catch_failures: true) |
| 21 | + apply_manifest(pp, catch_changes: true) |
| 22 | + # The automounter can retrun before it is actually working. |
| 23 | + shell('sleep 10') |
| 24 | + shell('ls /cvmfs/cms.cern.ch', acceptable_exit_codes: 0) |
| 25 | + end |
| 26 | + |
| 27 | + describe service('cvmfs-client-prometheus.socket') do |
| 28 | + it { is_expected.to be_enabled } |
| 29 | + it { is_expected.to be_running } |
| 30 | + end |
| 31 | + |
| 32 | + describe port('9868') do |
| 33 | + it { is_expected.to be_listening } |
| 34 | + end |
| 35 | + |
| 36 | + describe command('curl -s http://localhost:9868/metrics') do |
| 37 | + its(:stdout) { is_expected.to match(%r{^# HELP}) } |
| 38 | + end |
| 39 | +end |
0 commit comments