Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jobs/loggr-system-metrics-agent/templates/ctl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ case $1 in
INDEX=<%= index %> \
IP=<%= ip %> \
LIMITED_METRICS=<%= p('bosh_metrics_forwarder_metrics_only') %> \
CLOCK_DRIFT_ENABLED=<%= p('clock_drift_enabled') %> \
CA_CERT_PATH="/var/vcap/jobs/loggr-system-metrics-agent/config/certs/system_metrics_agent_ca.crt" \
CERT_PATH="/var/vcap/jobs/loggr-system-metrics-agent/config/certs/system_metrics_agent.crt" \
KEY_PATH="/var/vcap/jobs/loggr-system-metrics-agent/config/certs/system_metrics_agent.key" \
Expand Down
45 changes: 45 additions & 0 deletions spec/jobs/loggr_system_metrics_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,51 @@ def render_system_metrics_monit(properties = {})
it 'passes the sample interval from properties' do
expect(process['env']['SAMPLE_INTERVAL']).to eq('15s')
end

it 'defaults CLOCK_DRIFT_ENABLED to false' do
expect(process['env']['CLOCK_DRIFT_ENABLED']).to eq('false')
end

context 'when clock_drift_enabled is true' do
let(:rendered) { template.render({'clock_drift_enabled' => true}) }

it 'passes CLOCK_DRIFT_ENABLED as true' do
expect(process['env']['CLOCK_DRIFT_ENABLED']).to eq('true')
end
end

context 'when clock_drift_enabled is false' do
let(:rendered) { template.render({'clock_drift_enabled' => false}) }

it 'passes CLOCK_DRIFT_ENABLED as false' do
expect(process['env']['CLOCK_DRIFT_ENABLED']).to eq('false')
end
end
end

describe 'bin/ctl' do
let(:template) { job.template('bin/ctl') }

it 'defaults CLOCK_DRIFT_ENABLED to false' do
rendered = template.render({})
expect(rendered).to include('CLOCK_DRIFT_ENABLED=false')
end

context 'when clock_drift_enabled is true' do
let(:rendered) { template.render({'clock_drift_enabled' => true}) }

it 'passes CLOCK_DRIFT_ENABLED=true as an environment variable' do
expect(rendered).to include('CLOCK_DRIFT_ENABLED=true')
end
end

context 'when clock_drift_enabled is false' do
let(:rendered) { template.render({'clock_drift_enabled' => false}) }

it 'passes CLOCK_DRIFT_ENABLED=false as an environment variable' do
expect(rendered).to include('CLOCK_DRIFT_ENABLED=false')
end
end
end

describe 'monit' do
Expand Down
Loading