ansible-role-logstash/test/integration/default/serverspec/default_spec.rb
2019-09-10 08:57:26 +02:00

48 lines
944 B
Ruby

require 'serverspec'
set :backend, :exec
puts
puts '================================'
puts %x(ansible --version)
puts '================================'
describe package('logstash') do
it { should be_installed }
end
describe file('/etc/logstash/logstash.yml') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end
describe file('/etc/logstash/conf.d/input.conf') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should contain 'path => "/var/log/syslog"' }
end
describe service('logstash') do
it { should be_enabled }
it { should be_running.under('systemd') }
end
sleep 20
open('/tmp/logstash.log', 'a') do |f|
f << "test\n"
end
sleep 2
describe port(9600) do
it { should be_listening }
end
describe file('/tmp/logstash.log') do
it { should be_file }
end