Commit 81450c5 1 parent f2718c3 commit 81450c5 Copy full SHA for 81450c5
File tree 5 files changed +97
-0
lines changed
test/integration/datadog_pgbouncer/serverspec
5 files changed +97
-0
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,22 @@ suites:
266
266
my_consumer :
267
267
my_topic : [0, 1, 4, 12]
268
268
269
+ - name : datadog_pgbouncer
270
+ run_list :
271
+ - recipe[datadog::pgbouncer]
272
+ attributes :
273
+ datadog :
274
+ << : *DATADOG
275
+ pgbouncer :
276
+ instances :
277
+ - host : localhost
278
+ port : 6432
279
+ username : john
280
+ password : doe
281
+ tags :
282
+ - toto
283
+ - tata
284
+
269
285
- name : datadog_process
270
286
run_list :
271
287
- recipe[datadog::process]
Original file line number Diff line number Diff line change
1
+ #
2
+ # Cookbook Name:: datadog
3
+ # Recipe:: pgbouncer
4
+ #
5
+ # Copyright 2011-2015, Datadog
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ include_recipe 'datadog::dd-agent'
20
+
21
+ # Build a data structure with configuration.
22
+ # @example
23
+ # node.override['datadog']['pgbouncer']['instances'] = [
24
+ # {
25
+ # host: 'localhost',
26
+ # port: '15432',
27
+ # username: 'john',
28
+ # password: 'doe',
29
+ # tags: [
30
+ # 'optional_tag1',
31
+ # 'optional_tag2'
32
+ # ]
33
+ # }
34
+ # ]
35
+
36
+ datadog_monitor 'pgbouncer' do
37
+ instances node [ 'datadog' ] [ 'pgbouncer' ] [ 'instances' ]
38
+ end
Original file line number Diff line number Diff line change
1
+ # Generated by Chef, local modifications will be overwritten
2
+
3
+ <%= JSON.parse(({ 'instances' => @instances }).to_json).to_yaml %>
4
+
5
+ init_config:
6
+ # Nothing to configure here
Original file line number Diff line number Diff line change
1
+ ../../helpers /serverspec /Gemfile
Original file line number Diff line number Diff line change
1
+ # Encoding: utf-8
2
+ require 'json_spec'
3
+ require 'serverspec'
4
+ require 'yaml'
5
+
6
+ set :backend , :exec
7
+ set :path , '/sbin:/usr/local/sbin:$PATH'
8
+
9
+ AGENT_CONFIG = '/etc/dd-agent/conf.d/pgbouncer.yaml'
10
+
11
+ describe service ( 'datadog-agent' ) do
12
+ it { should be_running }
13
+ end
14
+
15
+ describe file ( AGENT_CONFIG ) do
16
+ it { should be_a_file }
17
+
18
+ it 'is valid yaml matching input values' do
19
+ generated = YAML . load_file ( AGENT_CONFIG )
20
+
21
+ expected = {
22
+ instances : [
23
+ {
24
+ host : 'localhost' ,
25
+ port : 6432 ,
26
+ username : 'john' ,
27
+ password : 'doe' ,
28
+ tags : [ 'toto' , 'tata' ]
29
+ }
30
+ ] ,
31
+ init_config : nil
32
+ }
33
+
34
+ expect ( generated . to_json ) . to be_json_eql expected . to_json
35
+ end
36
+ end
You can’t perform that action at this time.
0 commit comments