-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved handling of changes to sensu::etc_dir
This handling only works with systemd based sytems, adds dependency on campotcamp/systemd Fix unit tests to work with latest Puppet 6 release
- Loading branch information
Showing
15 changed files
with
178 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -92,6 +92,56 @@ class { 'sensu::agent': | |
end | ||
end | ||
|
||
context 'etc_dir changed' do | ||
it 'should work without errors' do | ||
pp = <<-EOS | ||
class { '::sensu': | ||
etc_dir => '/etc/sensugo', | ||
} | ||
class { 'sensu::agent': | ||
backends => ['sensu-backend:8081'], | ||
entity_name => 'sensu-agent', | ||
subscriptions => ['base'], | ||
labels => { 'foo' => 'bar' }, | ||
annotations => { 'contacts' => '[email protected]' }, | ||
config_hash => { | ||
'log-level' => 'info', | ||
'keepalive-interval' => 30, | ||
'api-port' => 4041, | ||
} | ||
} | ||
sensu::agent::subscription { 'linux': } | ||
sensu::agent::label { 'cpu.warning': value => '90' } | ||
sensu::agent::label { 'cpu.critical': value => '95' } | ||
sensu::agent::label { 'bar': value => 'baz2', redact => true } | ||
sensu::agent::annotation { 'foobar': value => 'bar' } | ||
sensu::agent::annotation { 'cpu.message': value => 'bar' } | ||
sensu::agent::config_entry { 'keepalive-interval': value => 20 } | ||
EOS | ||
|
||
if RSpec.configuration.sensu_use_agent | ||
site_pp = "node 'sensu-agent' { #{pp} }" | ||
puppetserver = hosts_as('puppetserver')[0] | ||
create_remote_file(puppetserver, "/etc/puppetlabs/code/environments/production/manifests/site.pp", site_pp) | ||
on node, puppet("agent -t --detailed-exitcodes"), acceptable_exit_codes: [0,2] | ||
on node, puppet("agent -t --detailed-exitcodes"), acceptable_exit_codes: [0] | ||
else | ||
# Run it twice and test for idempotency | ||
apply_manifest_on(node, pp, :catch_failures => true) | ||
apply_manifest_on(node, pp, :catch_changes => true) | ||
end | ||
end | ||
|
||
describe service('sensu-agent'), :node => node do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe port(4041), :node => node do | ||
it { should be_listening } | ||
end | ||
end | ||
|
||
context 'updates' do | ||
it 'should work without errors' do | ||
pp = <<-EOS | ||
|
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
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
class { 'sensu': | ||
api_host => 'sensu-backend.example.com', | ||
} | ||
class { 'sensu::agent': | ||
backends => ['sensu-backend.example.com:8081'], | ||
} |