Skip to content

Commit 4e766bf

Browse files
committed
[apm] adding apm tests.
1 parent 92db780 commit 4e766bf

5 files changed

Lines changed: 23 additions & 10 deletions

File tree

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@
398398
order => '05',
399399
}
400400

401+
concat::fragment{ 'datadog apm footer':
402+
target => '/etc/dd-agent/datadog.conf',
403+
content => template('datadog_agent/datadog_apm_footer.conf.erb'),
404+
order => '06',
405+
}
406+
401407

402408
if $puppet_run_reports {
403409
class { 'datadog_agent::reports':

spec/classes/datadog_agent_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
end
207207

208208
context 'for APM' do
209-
it { should contain_file('/etc/dd-agent/datadog.conf').with(
209+
it { should contain_concat__fragment('datadog footer').with(
210210
'content' => /^apm_enabled: false\n/,
211211
)}
212212
end
@@ -509,7 +509,7 @@
509509
end
510510
context 'with apm_enabled set to true' do
511511
let(:params) {{:apm_enabled => true }}
512-
it { should contain_file('/etc/dd-agent/datadog.conf').with(
512+
it { should contain_concat__fragment('datadog footer').with(
513513
'content' => /^apm_enabled: true\n/,
514514
)}
515515
end
@@ -518,13 +518,13 @@
518518
{:apm_enabled => true,
519519
:apm_env => 'foo',
520520
}}
521-
it { should contain_file('/etc/dd-agent/datadog.conf').with(
521+
it { should contain_concat__fragment('datadog footer').with(
522522
'content' => /^apm_enabled: true\n/,
523523
)}
524-
it { should contain_file('/etc/dd-agent/datadog.conf').with(
524+
it { should contain_concat__fragment('datadog apm footer').with(
525525
'content' => /^\[trace.agent\]\n/,
526526
)}
527-
it { should contain_file('/etc/dd-agent/datadog.conf').with(
527+
it { should contain_concat__fragment('datadog apm footer').with(
528528
'content' => /^env: foo\n/,
529529
)}
530530
end

templates/datadog.conf.erb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,3 @@ apm_enabled: <%= @apm_enabled %>
433433
# ========================================================================== #
434434

435435
<% end -%>
436-
437-
<% if not @apm_env.empty? -%>
438-
[trace.agent]
439-
env: <%= @apm_env %>
440-
<% end -%>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<% if not @apm_env.empty? -%>
2+
[trace.agent]
3+
env: <%= @apm_env %>
4+
<% end -%>

templates/datadog_footer.conf.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ sd_jmx_enable: <%= @sd_jmx_enable %>
343343
consul_token: <%= @consul_token %>
344344
<% end -%>
345345

346+
# ========================================================================== #
347+
# Trace #
348+
# ========================================================================== #
349+
350+
# Enable the trace agent.
351+
apm_enabled: <%= @apm_enabled %>
352+
353+
346354
<% if not @extra_template.empty? -%>
347355
# ========================================================================== #
348356
# Custom Templates from Puppet #

0 commit comments

Comments
 (0)