2016-01-11 17:36:45 +00:00
|
|
|
require 'spec_helper_acceptance'
|
|
|
|
|
|
|
|
RSpec.describe 'fluentd' do
|
|
|
|
it 'runs successfully' do
|
2016-01-27 19:12:28 +00:00
|
|
|
manifest = File.read(File.expand_path('../../examples/test.pp', File.dirname(__FILE__)))
|
2016-01-11 17:36:45 +00:00
|
|
|
|
|
|
|
# Run it twice and test for idempotency
|
|
|
|
apply_manifest(manifest, catch_failures: true)
|
|
|
|
expect(apply_manifest(manifest, catch_failures: true).exit_code).to be_zero
|
|
|
|
end
|
|
|
|
|
2016-01-27 19:12:28 +00:00
|
|
|
# test package
|
2016-01-11 17:36:45 +00:00
|
|
|
describe package('td-agent') do
|
|
|
|
it { is_expected.to be_installed }
|
|
|
|
end
|
|
|
|
|
2016-01-27 19:12:28 +00:00
|
|
|
# test service
|
2016-01-11 17:36:45 +00:00
|
|
|
describe service('td-agent') do
|
|
|
|
it { is_expected.to be_running }
|
2016-01-25 11:42:03 +00:00
|
|
|
# @todo
|
|
|
|
# there seems to be a bug serverspec while checking if the service is enabled
|
|
|
|
# on Debian 8:
|
|
|
|
# server spec checks:
|
|
|
|
# /bin/sh -c systemctl\ --quiet\ is-enabled\ td-agent
|
|
|
|
# Failed to get unit file state for td-agent.service: No such file or directory
|
|
|
|
#
|
|
|
|
# but all update-rc.d files are present:
|
|
|
|
# /etc/rc0.d/K01td-agent
|
|
|
|
# /etc/rc1.d/K01td-agent
|
|
|
|
# /etc/rc2.d/S01td-agent
|
|
|
|
# /etc/rc3.d/S01td-agent
|
|
|
|
# /etc/rc4.d/S01td-agent
|
|
|
|
# /etc/rc5.d/S01td-agent
|
|
|
|
# /etc/rc6.d/K01td-agent
|
|
|
|
if ! ( os[:family] == 'debian' and os[:release].to_f >= 8.0 )
|
|
|
|
it { is_expected.to be_enabled }
|
|
|
|
end
|
2016-01-11 17:36:45 +00:00
|
|
|
end
|
2016-01-27 19:12:28 +00:00
|
|
|
|
|
|
|
# test gem installed plugin
|
|
|
|
describe command('/opt/td-agent/embedded/bin/gem list') do
|
|
|
|
its(:stdout) { should contain('fluent-plugin-elasticsearch') }
|
|
|
|
end
|
|
|
|
|
2016-01-11 17:36:45 +00:00
|
|
|
end
|