Tests for scripts, templates and mlock all on multi node installs

This commit is contained in:
Dale McDiarmid 2015-11-26 14:45:00 +00:00
parent dc9b2dd53c
commit bddb7ee20b
3 changed files with 64 additions and 3 deletions

View file

@ -3,6 +3,8 @@
- name: Elasticsearch Config tests
hosts: localhost
roles:
- { role: elasticsearch, es_instance_name: "master", es_config: { "discovery.zen.ping.multicast.enabled": false, discovery.zen.ping.unicast.hosts: "localhost:9300", http.port: 9200, transport.tcp.port: 9300, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } }
- { role: elasticsearch, es_heap_size: "1g", es_instance_name: "master", es_config: { "discovery.zen.ping.multicast.enabled": false, discovery.zen.ping.unicast.hosts: "localhost:9300", http.port: 9200, transport.tcp.port: 9300, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } }
- { role: elasticsearch, es_instance_name: "node1", es_config: { "discovery.zen.ping.multicast.enabled": false, discovery.zen.ping.unicast.hosts: "localhost:9300", http.port: 9201, transport.tcp.port: 9301, node.data: true, node.master: false, discovery.zen.ping.multicast.enabled: false } }
vars:
vars:
es_scripts: true
es_templates: true

View file

@ -87,5 +87,64 @@ context "basic tests" do
end
end
#test to make sure mlock was applied
describe command('curl "localhost:9200/_nodes/process?pretty" | grep mlockall') do
its(:stdout) { should match /\"mlockall\" : true/ }
its(:exit_status) { should eq 0 }
end
#test to make sure mlock was not applied
describe command('curl "localhost:9201/_nodes/process?pretty" | grep mlockall') do
its(:stdout) { should match /\"mlockall\" : false/ }
its(:exit_status) { should eq 0 }
end
describe file('/etc/elasticsearch/templates') do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
describe file('/etc/elasticsearch/templates/basic.json') do
it { should be_file }
it { should be_owned_by 'elasticsearch' }
end
describe 'Template Installed' do
it 'should be reported as being installed', :retry => 3, :retry_wait => 10 do
command = command('curl localhost:9200/_template/basic')
expect(command.stdout).to match(/basic/)
expect(command.exit_status).to eq(0)
end
end
describe 'Template Installed' do
it 'should be reported as being installed', :retry => 3, :retry_wait => 10 do
command = command('curl localhost:9201/_template/basic')
expect(command.stdout).to match(/basic/)
expect(command.exit_status).to eq(0)
end
end
#Confirm scripts are on both nodes
describe file('/etc/elasticsearch/node1/scripts') do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
describe file('/etc/elasticsearch/node1/scripts/calculate-score.groovy') do
it { should be_file }
it { should be_owned_by 'elasticsearch' }
end
describe file('/etc/elasticsearch/master/scripts') do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
describe file('/etc/elasticsearch/master/scripts/calculate-score.groovy') do
it { should be_file }
it { should be_owned_by 'elasticsearch' }
end
end