Skip to content

Commit

Permalink
Merge d0a1caa into f9f2e7d
Browse files Browse the repository at this point in the history
  • Loading branch information
mrunge committed Oct 13, 2020
2 parents f9f2e7d + d0a1caa commit d6109c8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
43 changes: 43 additions & 0 deletions spec/acceptance/class_plugin_ovs_stats_spec.rb
@@ -0,0 +1,43 @@
require 'spec_helper_acceptance'

describe 'collectd::plugin::ovs_stats class' do
context 'basic parameters' do
# Using puppet_apply as a helper
it 'works idempotently with no errors' do
pp = <<-EOS
class{'collectd':
utils => true,
}
class{ 'collectd::plugin::ovs_stats':
port => 6639,
}
# Add one write plugin to keep logs quiet
class{'collectd::plugin::csv':}
# Create a socket to query
class{'collectd::plugin::unixsock':
socketfile => '/var/run/collectd-sock',
socketgroup => 'root',
}
EOS
# Run 3 times since the collectd_version
# fact is impossible until collectd is
# installed.
apply_manifest(pp, catch_failures: false)
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
# Wait to get some data
shell('sleep 10')
end

describe service('collectd') do
it { is_expected.to be_running }
end

# it is expected to unload the ovs_stats plugin, since there
# is no ovs running inside the docker container.
# At the same time, collectd should continue to run.
describe command('collectdctl -s /var/run/collectd-sock listval') do
its(:exit_status) { is_expected.to eq 0 }
end
end
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ovs_stats_spec.rb
Expand Up @@ -26,7 +26,7 @@

it 'will create config which will contain port configuration' do
is_expected.to contain_file('ovs_stats.load').with(
content: %r{Port 666}
content: %r{Port "666"}
)
end

Expand Down
2 changes: 1 addition & 1 deletion templates/plugin/ovs_stats.conf.erb
@@ -1,6 +1,6 @@
<Plugin "ovs_stats">
<%- if @port %>
Port <%= @port %>
Port "<%= @port %>"
<%- end -%>
<%- if @address %>
Address "<%= @address %>"
Expand Down

0 comments on commit d6109c8

Please sign in to comment.