File tree Expand file tree Collapse file tree 3 files changed +56
-2
lines changed
Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 1+ require 'spec_helper_acceptance'
2+
3+ describe 'hosts_with_pe_profile function' do
4+ it 'returns 127.0.0.1 when no hosts are found' do
5+ pp = <<-MANIFEST
6+ $result=puppet_metrics_collector::hosts_with_pe_profile('non_existant')
7+ notice "Received=$result"
8+ MANIFEST
9+ output = apply_manifest ( pp ) . stdout
10+ expect ( output ) . to match ( %r{127.0.0.1} )
11+ end
12+ it 'return the FQDN for the master profile' do
13+ # This influences the custom facts
14+ run_shell ( 'puppet config set storeconfigs true --section user' , expect_failures : false )
15+ pp = <<-MANIFEST
16+ $result=puppet_metrics_collector::hosts_with_pe_profile('master')
17+ notice "Received=$result"
18+ MANIFEST
19+ output = apply_manifest ( pp ) . stdout
20+ expect ( output ) . to match ( host_inventory [ 'fqdn' ] )
21+ run_shell ( 'puppet config set storeconfigs false --section user' , expect_failures : false )
22+ end
23+ end
Original file line number Diff line number Diff line change 88 MANIFEST
99
1010 # Run it twice and test for idempotency
11- expect ( apply_manifest ( pp ) . exit_code ) . not_to eq ( 1 )
12- expect ( apply_manifest ( pp ) . exit_code ) . not_to eq ( 1 )
1311 idempotent_apply ( pp )
1412 end
1513 describe 'check systemd fact' do
1614 it 'is true on all supported OS' do
1715 expect ( host_inventory [ 'facter' ] [ 'puppet_metrics_collector' ] [ 'have_systemd' ] ) . to eq true
1816 end
1917 end
18+ describe 'check puppet-metrics-collector directory' do
19+ it 'scripts folder exists' do
20+ file ( '/opt/puppetlabs/puppet-metrics-collector/scripts' ) . should be_directory
21+ end
22+ end
2023 end
2124end
Original file line number Diff line number Diff line change 1+ require 'spec_helper_acceptance'
2+
3+ describe 'test default and system includes' do
4+ before ( :all ) do
5+ pp = <<-MANIFEST
6+ include puppet_metrics_collector
7+ include puppet_metrics_collector::system
8+ MANIFEST
9+ idempotent_apply ( pp )
10+ end
11+ it 'sets all puppet_* metric services to be active' do
12+ run_shell ( 'systemctl list-units --type=service | grep "puppet_.*metrics"' ) do |r |
13+ puts r . stdout
14+ expect ( r . stdout ) . to match ( %r{activ} )
15+ end
16+ end
17+ it 'check for the tidy services files' do
18+ files = run_shell ( 'ls /etc/systemd/system/puppet_*-tidy.service' ) . stdout
19+ expect ( files . split ( "\n " ) . count ) . to eq ( 9 )
20+ end
21+ it 'check for the timer files' do
22+ files = run_shell ( 'ls /etc/systemd/system/puppet_*-tidy.timer' ) . stdout
23+ expect ( files . split ( "\n " ) . count ) . to eq ( 9 )
24+ end
25+ it 'checks if sysstat package is installed' do
26+ expect ( package ( 'sysstat' ) ) . to be_installed
27+ end
28+ end
You can’t perform that action at this time.
0 commit comments