Tests for templates
This commit is contained in:
parent
23c8bdb7de
commit
61fa65d161
5 changed files with 35 additions and 5 deletions
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"template" : "te*",
|
||||||
|
"settings" : {
|
||||||
|
"number_of_shards" : 1
|
||||||
|
},
|
||||||
|
"mappings" : {
|
||||||
|
"type1" : {
|
||||||
|
"_source" : { "enabled" : false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#TODO: How to handle in multi node
|
#TODO: How to handle in multi node
|
||||||
# 1. Template directory needs to be specifiable
|
# 1. Template directory needs to be specifiable
|
||||||
- name: Copy templates to elasticsearch
|
- name: Copy templates to elasticsearch
|
||||||
copy: src=templates dest=/etc/elasticsearch/
|
copy: src=templates dest=/etc/elasticsearch/ owner={{ es_user }} group={{ es_group }}
|
||||||
|
|
||||||
- set_fact: http_port=9200
|
- set_fact: http_port=9200
|
||||||
|
|
||||||
|
|
@ -18,4 +18,4 @@
|
||||||
|
|
||||||
- name: Install template(s)
|
- name: Install template(s)
|
||||||
command: "curl -sL -XPUT http://localhost:{{http_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json"
|
command: "curl -sL -XPUT http://localhost:{{http_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json"
|
||||||
with_items: resultstemplate.stdout_lines
|
with_items: resultstemplate.stdout_lines
|
||||||
|
|
@ -4,4 +4,5 @@
|
||||||
roles:
|
roles:
|
||||||
- { role: elasticsearch, es_config: { "discovery.zen.ping.multicast.enabled": true }, es_instance_name: "node1" }
|
- { role: elasticsearch, es_config: { "discovery.zen.ping.multicast.enabled": true }, es_instance_name: "node1" }
|
||||||
vars:
|
vars:
|
||||||
es_scripts: true
|
es_scripts: true
|
||||||
|
es_templates: true
|
||||||
|
|
@ -34,5 +34,23 @@ context "basic tests" do
|
||||||
end
|
end
|
||||||
end
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ context "basic tests" do
|
||||||
|
|
||||||
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
|
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
|
it { should be_owned_by 'elasticsearch' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/etc/elasticsearch/node1/logging.yml') do
|
describe file('/etc/elasticsearch/node1/logging.yml') do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
|
it { should be_owned_by 'elasticsearch' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
|
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
|
||||||
|
|
@ -38,13 +40,11 @@ context "basic tests" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'plugin' do
|
describe 'plugin' do
|
||||||
|
|
||||||
it 'should be reported as existing', :retry => 3, :retry_wait => 10 do
|
it 'should be reported as existing', :retry => 3, :retry_wait => 10 do
|
||||||
command = command('curl localhost:9200/_nodes/?plugin | grep kopf')
|
command = command('curl localhost:9200/_nodes/?plugin | grep kopf')
|
||||||
expect(command.stdout).to match(/kopf/)
|
expect(command.stdout).to match(/kopf/)
|
||||||
expect(command.exit_status).to eq(0)
|
expect(command.exit_status).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue