11require 'spec_helper_acceptance'
22
33describe 'agent' , :unless => UNSUPPORTED_PLATFORMS . include? ( fact ( 'osfamily' ) ) do
4- context 'with default parameters' do
4+ context 'with default parameters' , :agent_method => 'default' do
55 it 'should run with no errors' , :agent do
66 pp = <<-EOS
77 class { 'puppet::agent': }
@@ -13,26 +13,49 @@ class { 'puppet::agent': }
1313 end
1414 end
1515
16- # context 'running as service' do
17- # it 'should run with no errors' do
18- # pp = <<-EOS
19- # class { 'puppet::agent':
20- # method => 'service',
21- # }
22- # EOS
23-
24- # # Run it twice and test for idempotency
25- # apply_manifest(pp, :catch_failures => true)
26- # expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
27- # end
28- #
29- # describe service('puppet') do
30- # it {
31- # should be_enabled
32- # }
33- # it {
34- # should be_running
35- # }
36- # end
37- # end
16+ context 'running as cron' , :agent_method => 'cron' do
17+ it 'should run with no errors' do
18+ pp = <<-EOS
19+ class { 'puppet::agent':
20+ method => 'cron',
21+ }
22+ EOS
23+
24+ # Run it twice and test for idempotency
25+ apply_manifest ( pp , :catch_failures => true )
26+ expect ( apply_manifest ( pp , :catch_failures => true ) . exit_code ) . to be_zero
27+ end
28+
29+ describe service ( 'puppet' ) do
30+ it {
31+ should be_disabled
32+ }
33+ it {
34+ should_not be_running
35+ }
36+ end
37+ end
38+ context 'running as service' , :agenttype => 'service' do
39+ it 'should run with no errors' do
40+ pp = <<-EOS
41+ class { 'puppet::agent':
42+ method => 'service',
43+ }
44+ EOS
45+
46+ # Run it twice and test for idempotency
47+ apply_manifest ( pp , :catch_failures => true )
48+ expect ( apply_manifest ( pp , :catch_failures => true ) . exit_code ) . to be_zero
49+ end
50+
51+ describe service ( 'puppet' ) do
52+ it {
53+ should be_enabled
54+ }
55+ it {
56+ should be_running
57+ }
58+ end
59+ end
60+
3861end
0 commit comments