Skip to content

Commit

Permalink
Add specs for integrations recipe and template
Browse files Browse the repository at this point in the history
  • Loading branch information
olivielpeau committed Jun 7, 2016
1 parent 686d7a8 commit 9bfa20f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions spec/integrations/integrations_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
describe 'datadog::integrations' do
expected_yaml = <<-EOF
instances:
- url: 'http://localhost:22222'
init_config: {}
EOF

cached(:chef_run) do
ChefSpec::SoloRunner.new(step_into: ['datadog_monitor']) do |node|
node.automatic['languages'] = { python: { version: '2.7.2' } }

node.set['datadog'] = {
api_key: 'someapikey',
extra_packages: {
twemproxy: {
name: 'dd-check-twemproxy',
version: '0.1.0-1'
}
},
twemproxy: {
instances: [
{
url: 'http://localhost:22222'
}
]
}
}
end.converge(described_recipe)
end

subject { chef_run }

it { is_expected.to add_datadog_monitor('twemproxy') }

it 'renders expected YAML config file' do
expect(chef_run).to render_file('/etc/dd-agent/conf.d/twemproxy.yaml').with_content { |content|
expect(YAML.load(content).to_json).to be_json_eql(YAML.load(expected_yaml).to_json)
}
end

it 'installs check\'s package with specified version' do
expect(chef_run).to install_package('dd-check-twemproxy').with_version('0.1.0-1')
end
end

0 comments on commit 9bfa20f

Please sign in to comment.