2019-09-05 13:48:41 +00:00
|
|
|
require 'serverspec'
|
|
|
|
|
|
|
|
set :backend, :exec
|
|
|
|
|
|
|
|
puts
|
|
|
|
puts '================================'
|
|
|
|
puts %x(ansible --version)
|
|
|
|
puts '================================'
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
describe package('elasticsearch') do
|
|
|
|
it { should be_installed }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/elasticsearch/elasticsearch.yml') do
|
|
|
|
it { should be_file }
|
|
|
|
it { should be_mode 640 }
|
|
|
|
it { should be_owned_by 'root' }
|
|
|
|
it { should be_grouped_into 'elasticsearch' }
|
|
|
|
it { should contain 'path.data: /var/lib/elasticsearch' }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe service('elasticsearch') do
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running.under('systemd') }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe port(9200) do
|
|
|
|
it { should be_listening }
|
|
|
|
end
|
2019-11-21 12:06:01 +00:00
|
|
|
|
2020-02-08 16:12:04 +00:00
|
|
|
describe command('systemctl status elasticsearch') do
|
2019-11-21 12:06:01 +00:00
|
|
|
its(:stdout) { should contain('-Xms512m -Xmx512m') }
|
|
|
|
end
|
2019-11-21 12:15:34 +00:00
|
|
|
|
|
|
|
describe command('curl -v http://127.0.0.1:9200/_template/test') do
|
|
|
|
its(:exit_status) { should eq 0 }
|
|
|
|
its(:stdout) { should contain('"number_of_replicas":"1"') }
|
|
|
|
end
|