Correct handling of map in template

This commit is contained in:
Dale McDiarmid 2015-11-25 15:28:09 +00:00
parent d34d5e6103
commit d25fc792b6
19 changed files with 116 additions and 447 deletions

View file

@ -4,9 +4,9 @@
hosts: localhost
roles:
#expand to all available parameters
- { role: elasticsearch, es_config: { node_name_prefix: "node1_", cluster_name: "custom-cluster", unicast_hosts: "localhost:9301", http_port: "9201", transport_tcp_port: "9301", data_node: false, master_node: true, m_lock_enabled: true, multicast_enabled: false } }
- { role: elasticsearch, es_instance_name: "node1", es_config: {node.name: "node1", cluster.name: "custom-cluster", discovery.zen.ping.unicast.hosts: "localhost:9301", http.port: 9201, transport.tcp.port: 9301, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } }
vars:
es_scripts: false
es_templates: false
es_version_lock: false
es_config: { "m_lock_enabled": true }
es_config: { "discovery.zen.ping.multicast.enabled": true }

View file

@ -14,20 +14,25 @@ context "basic tests" do
it { should be_installed }
end
describe file('/etc/elasticsearch/node1_elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should be_file }
end
#test configuration parameters have been set - test all appropriately set in config file
describe file('/etc/elasticsearch/node1_elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should contain 'http.port: 9201' }
it { should contain 'transport.tcp.port: 9301' }
it { should contain 'node.data: false' }
it { should contain 'node.master: true' }
it { should contain 'discovery.zen.ping.multicast.enabled: false' }
it { should contain 'cluster.name: custom-cluster' }
it { should contain 'node.name: node1_localhost' }
it { should contain 'node.name: node1' }
it { should contain 'bootstrap.mlockall: true' }
it { should contain 'discovery.zen.ping.unicast.hosts: localhost:9301' }
it { should contain 'path.conf: /etc/elasticsearch/node1' }
it { should contain 'path.data: /var/lib/elasticsearch/localhost-node1' }
it { should contain 'path.work: /tmp/elasticsearch/localhost-node1' }
it { should contain 'path.logs: /var/log/elasticsearch/localhost-node1' }
end
#test we started on the correct port was used

View file

@ -3,6 +3,6 @@
- name: Elasticsearch Config tests
hosts: localhost
roles:
- { role: elasticsearch, es_config: { "multicast_enabled": false, node_name_prefix: "master_", unicast_hosts: "localhost:9300", http_port: "9200", transport_tcp_port: "9300", data_node: false, master_node: true, m_lock_enabled: true,multicast_enabled: false } }
- { role: elasticsearch, es_config: { "multicast_enabled": false, node_name_prefix: "node1_", unicast_hosts: "localhost:9300", http_port: "9201", transport_tcp_port: "9301", data_node: true, master_node: false, m_lock_enabled: true,multicast_enabled: false } }
vars:
- { 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_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:

View file

@ -18,33 +18,43 @@ context "basic tests" do
it { should be_installed }
end
describe file('/etc/elasticsearch/node1_elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should be_file }
end
describe file('/etc/elasticsearch/master_elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/master/elasticsearch.yml') do
it { should be_file }
end
#test configuration parameters have been set - test all appropriately set in config file
describe file('/etc/elasticsearch/node1_elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should contain 'http.port: 9201' }
it { should contain 'transport.tcp.port: 9301' }
it { should contain 'node.data: true' }
it { should contain 'node.master: false' }
it { should contain 'discovery.zen.ping.multicast.enabled: false' }
it { should contain 'node.name: node1_localhost' }
it { should contain 'node.name: localhost-node1' }
it { should_not contain 'bootstrap.mlockall: true' }
it { should contain 'path.conf: /etc/elasticsearch/node1' }
it { should contain 'path.data: /var/lib/elasticsearch/localhost-node1' }
it { should contain 'path.work: /tmp/elasticsearch/localhost-node1' }
it { should contain 'path.logs: /var/log/elasticsearch/localhost-node1' }
end
#test configuration parameters have been set for master - test all appropriately set in config file
describe file('/etc/elasticsearch/master_elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/master/elasticsearch.yml') do
it { should contain 'http.port: 9200' }
it { should contain 'transport.tcp.port: 9300' }
it { should contain 'node.data: false' }
it { should contain 'node.master: true' }
it { should contain 'discovery.zen.ping.multicast.enabled: false' }
it { should contain 'node.name: master_localhost' }
it { should contain 'node.name: localhost-master' }
it { should contain 'bootstrap.mlockall: true' }
it { should contain 'path.conf: /etc/elasticsearch/master' }
it { should contain 'path.data: /var/lib/elasticsearch/localhost-master' }
it { should contain 'path.work: /tmp/elasticsearch/localhost-master' }
it { should contain 'path.logs: /var/log/elasticsearch/localhost-master' }
end
describe 'Master listening' do

View file

@ -2,5 +2,5 @@
- name: Elasticsearch Package tests
hosts: localhost
roles:
- { role: elasticsearch, es_config: { "multicast_enabled": true } }
- { role: elasticsearch, es_config: { "discovery.zen.ping.multicast.enabled": true }, es_instance_name: "node1" }
vars:

View file

@ -6,7 +6,7 @@ context "basic tests" do
it { should exist }
end
describe service('elasticsearch') do
describe service('node1_elasticsearch') do
it { should be_running }
end
@ -14,9 +14,15 @@ context "basic tests" do
it { should be_installed }
end
describe file('/etc/elasticsearch/elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should be_file }
end
describe 'Node listening' do
it 'listening in port 9200' do
expect(port 9200).to be_listening
end
end
end

View file

@ -2,7 +2,7 @@
- name: wrapper playbook for kitchen testing "elasticsearch"
hosts: localhost
roles:
- { role: elasticsearch, es_config: { "multicast_enabled": true } }
- { role: elasticsearch, es_config: { "discovery.zen.ping.multicast.enabled": true }, es_instance_name: "node1" }
vars:
es_use_repository: "true"
es_plugins:

View file

@ -6,7 +6,7 @@ context "basic tests" do
it { should exist }
end
describe service('elasticsearch') do
describe service('node1_elasticsearch') do
it { should be_running }
end
@ -14,10 +14,25 @@ context "basic tests" do
it { should be_installed }
end
describe file('/etc/elasticsearch/elasticsearch/elasticsearch.yml') do
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should be_file }
end
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should contain 'node.name: localhost-node1' }
it { should contain 'cluster.name: "elasticsearch"' }
it { should contain 'path.conf: /etc/elasticsearch/node1' }
it { should contain 'path.data: /var/lib/elasticsearch/localhost-node1' }
it { should contain 'path.work: /tmp/elasticsearch/localhost-node1' }
it { should contain 'path.logs: /var/log/elasticsearch/localhost-node1' }
end
describe 'Node listening' do
it 'listening in port 9200' do
expect(port 9200).to be_listening
end
end
describe 'plugin' do
it 'should be reported as existing', :retry => 3, :retry_wait => 10 do