Skip to content

Commit

Permalink
Add test for ntp recipe, doc updates
Browse files Browse the repository at this point in the history
Fixes #182
  • Loading branch information
miketheman committed Apr 9, 2015
1 parent c591741 commit f2718c3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,20 @@ suites:
- host: localhost
port: 27017

- name: datadog_ntp
run_list:
- recipe[datadog::ntp]
attributes:
datadog:
<<: *DATADOG
ntp:
instances:
- offset_threshold: 600
host: europe.pool.ntp.org
port: 9999
version: 4
timeout: 10

- name: datadog_kafka
run_list:
- recipe[datadog::kafka]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changes

# 2.1.0 / Unreleased

* [FEATURE] Add support for `ntp` check, [#182][] [@chrissnell][], [@miketheman][]
* [OPTIMIZE] Remove long-dead `debug_mode` and replace with `log_level`, [#187][] [@remh][]
* [FEATURE] Add support for `http` & `tcp` monitoring check, [#177][] [@mtougeron][], [#178][] [@chrissnell][], [@miketheman][]
* [FEATURE] Add support for `fluentd` monitoring check, [#191][] [@takus][], [#192][] [@miketheman][]
Expand Down Expand Up @@ -253,6 +254,7 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit
[#171]: https://github.com/DataDog/chef-datadog/issues/171
[#177]: https://github.com/DataDog/chef-datadog/issues/177
[#178]: https://github.com/DataDog/chef-datadog/issues/178
[#182]: https://github.com/DataDog/chef-datadog/issues/182
[#187]: https://github.com/DataDog/chef-datadog/issues/187
[#190]: https://github.com/DataDog/chef-datadog/issues/190
[#191]: https://github.com/DataDog/chef-datadog/issues/191
Expand Down
5 changes: 3 additions & 2 deletions recipes/ntp.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
include_recipe 'datadog::dd-agent'

# Build a data structure with configuration.
# @see https://github.com/DataDog/dd-agent/blob/master/conf.d/ntp.yaml.example
# @note NTP check is enabled by default since datadog-agent 5.3.0.
# @see https://github.com/DataDog/dd-agent/blob/master/conf.d/ntp.yaml.default
# @example
# node.override['datadog']['ntp']['instances'] = [
# {
# 'offset_threshold' => '600',
# 'offset_threshold' => '60',
# 'host' => 'pool.ntp.org',
# 'port' => 'ntp',
# 'version' => '3',
Expand Down
1 change: 1 addition & 0 deletions test/integration/datadog_ntp/serverspec/Gemfile
36 changes: 36 additions & 0 deletions test/integration/datadog_ntp/serverspec/ntp_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Encoding: utf-8
require 'json_spec'
require 'serverspec'
require 'yaml'

set :backend, :exec
set :path, '/sbin:/usr/local/sbin:$PATH'

AGENT_CONFIG = '/etc/dd-agent/conf.d/ntp.yaml'

describe service('datadog-agent') do
it { should be_running }
end

describe file(AGENT_CONFIG) do
it { should be_a_file }

it 'is valid yaml matching input values' do
generated = YAML.load_file(AGENT_CONFIG)

expected = {
'instances' => [
{
'offset_threshold' => 600,
'host' => 'europe.pool.ntp.org',
'port' => 9999,
'version' => 4,
'timeout' => 10
}
],
'init_config' => nil
}

expect(generated.to_json).to be_json_eql expected.to_json
end
end

0 comments on commit f2718c3

Please sign in to comment.