Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ptance-test-puppet-service-runs-puppet
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
acceptance/tests/resource/service/puppet_service_runs_puppet.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'puppet/acceptance/service_utils' | ||
extend Puppet::Acceptance::ServiceUtils | ||
|
||
test_name 'Starting the puppet service should successfully run puppet' do | ||
|
||
tag 'audit:high', | ||
'audit:acceptance' | ||
|
||
skip_test 'requires a server node to run puppet agent -t' unless master | ||
|
||
agents.each do |agent| | ||
statedir = on(agent, puppet('config', 'print', 'statedir')).stdout.chomp | ||
last_run_report = "#{statedir}/last_run_report.yaml" | ||
|
||
teardown do | ||
on(agent, puppet_resource('file', last_run_report, 'ensure=absent')) | ||
end | ||
|
||
step 'Ensure last_run_report.yaml is absent' do | ||
on(agent, puppet_resource('file', last_run_report, 'ensure=absent')) | ||
end | ||
|
||
step 'Ensure stop puppet service' do | ||
on(agent, puppet_resource('service', 'puppet', 'ensure=stopped')) | ||
assert_service_status_on_host(agent, 'puppet', {'ensure' => 'stopped'}) | ||
end | ||
|
||
step 'Ensure start puppet service' do | ||
on(agent, puppet_resource('service', 'puppet', 'ensure=running')) | ||
assert_service_status_on_host(agent, 'puppet', {'ensure' => 'running'}) | ||
end | ||
|
||
retry_params = {:max_retries => 10, | ||
:retry_interval => 2} | ||
|
||
step 'Ensure last_run_report.yaml is created' do | ||
retry_on(agent, "test -e #{last_run_report}", retry_params) | ||
end | ||
end | ||
end |