Skip to content

Commit 54dd51b

Browse files
author
Dale McDiarmid
committed
Multi node plugin tests
1 parent 50f1c6f commit 54dd51b

File tree

9 files changed

+62
-11
lines changed

9 files changed

+62
-11
lines changed

.kitchen.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ suites:
8080
- name: multi-2x
8181
run_list:
8282
attributes:
83+
extra_vars:
84+
es_plugins:
85+
- plugin: lmenezes/elasticsearch-kopf
86+
version: master
87+
- plugin: license
88+
- plugin: marvel-agent
8389
provisioner:
8490
playbook: test/integration/multi.yml
8591
- name: standard-1x
@@ -117,5 +123,10 @@ suites:
117123
extra_vars:
118124
es_major_version: 1.7
119125
es_version: 1.7.3
126+
es_plugins:
127+
- plugin: lmenezes/elasticsearch-kopf
128+
version: master
129+
- plugin: elasticsearch/marvel
130+
version: latest
120131
provisioner:
121132
playbook: test/integration/multi.yml

tasks/checkParameters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Check for mandatory parameters
22

3-
- fail: msg="es_instance_name must be specified"
4-
when: es_instance_name is not defined
3+
- fail: msg="es_instance_name must be specified and cannot be blank"
4+
when: es_instance_name is not defined or es_instance_name == ''
55

66
- set_fact: multi_cast={{ (es_version | version_compare('2.0', '<') and es_config['discovery.zen.ping.multicast.enabled'] is not defined) or (es_config['discovery.zen.ping.multicast.enabled'] is defined and es_config['discovery.zen.ping.multicast.enabled'])}}
77

tasks/elasticsearch-config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,6 @@
6868
#Copy the logging.yml
6969
- name: Copy Logging.yml File for Instance
7070
template: src=logging.yml.j2 dest={{conf_dir}}/logging.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
71-
notify: restart elasticsearch
71+
notify: restart elasticsearch
72+
73+
#Clean up un-wanted package scripts to avoid confusion

test/integration/helpers/serverspec/multi_spec.rb

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
shared_examples 'multi::init' do |es_version|
3+
shared_examples 'multi::init' do |es_version,plugins|
44

55
describe user('elasticsearch') do
66
it { should exist }
@@ -171,8 +171,42 @@
171171
end
172172
end
173173

174+
#Multi node plugin tests
175+
describe file('/opt/elasticsearch/plugins/node1') do
176+
it { should be_directory }
177+
it { should be_owned_by 'elasticsearch' }
178+
end
179+
180+
describe file('/opt/elasticsearch/plugins/master') do
181+
it { should be_directory }
182+
it { should be_owned_by 'elasticsearch' }
183+
end
184+
185+
186+
for plugin in plugins
187+
describe file('/opt/elasticsearch/plugins/node1/'+plugin) do
188+
it { should be_directory }
189+
it { should be_owned_by 'elasticsearch' }
190+
end
191+
192+
describe file('/opt/elasticsearch/plugins/master/'+plugin) do
193+
it { should be_directory }
194+
it { should be_owned_by 'elasticsearch' }
195+
end
196+
197+
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true | grep '+plugin) do
198+
its(:exit_status) { should eq 0 }
199+
end
200+
201+
describe command('curl -s localhost:9201/_nodes/plugins?pretty=true | grep '+plugin) do
202+
its(:exit_status) { should eq 0 }
203+
end
204+
end
205+
206+
207+
174208

175-
#Test server spec file has been created and modified
209+
#Test server spec file has been created and modified - currently not possible as not copied for debian 8
176210
#describe file('/usr/lib/systemd/system/master_elasticsearch.service') do
177211
# it { should be_file }
178212
# it { should contain 'LimitMEMLOCK=infinity' }

test/integration/helpers/serverspec/package_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
1818
it { should be_file }
19+
it { should contain 'path.plugins: /usr/share/elasticsearch/plugins/node1' }
20+
it { should contain 'http.port: 9200' }
21+
it { should contain 'transport.tcp.port: 9300' }
22+
it { should contain 'discovery.zen.ping.unicast.hosts: localhost:9300' }
1923
end
2024

2125
describe file('/etc/elasticsearch/node1/scripts') do
@@ -77,10 +81,7 @@
7781
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true | grep '+plugin) do
7882
its(:exit_status) { should eq 0 }
7983
end
80-
8184
end
8285

83-
#path.plugins: /usr/share/elasticsearch/plugins/node1
84-
8586
end
8687

test/integration/multi-1x/serverspec/default_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
describe 'Multi Tests v 1.x' do
5-
include_examples 'multi::init', "1.7.3"
5+
include_examples 'multi::init', "1.7.3", ["kopf","marvel"]
66
end

test/integration/multi-2x/serverspec/default_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
describe 'Multi Tests v 2.x' do
5-
include_examples 'multi::init', "2.1.0"
5+
include_examples 'multi::init', "2.1.0", ["kopf","license","marvel-agent"]
66
end
77

88

test/integration/multi.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
- { 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 } }
88
vars:
99
es_scripts: true
10-
es_templates: true
10+
es_templates: true
11+
es_plugin_dir: "/opt/elasticsearch/plugins"
12+
#Plugins installed for this test are specified in .kitchen.yml under suite

test/integration/package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
vars:
77
es_scripts: true
88
es_templates: true
9+
#Plugins installed for this test are specified in .kitchen.yml under suite

0 commit comments

Comments
 (0)