From e98b74ab28374d8fc575c308b9851a465a4a77ac Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Thu, 26 Nov 2015 15:58:48 +0000 Subject: [PATCH] Data directory checks and inheritence variable test --- test/integration/multi.yml | 2 +- .../integration/multi/serverspec/default_spec.rb | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/integration/multi.yml b/test/integration/multi.yml index 7943b44..e138f7b 100644 --- a/test/integration/multi.yml +++ b/test/integration/multi.yml @@ -3,7 +3,7 @@ - name: Elasticsearch Config tests hosts: localhost roles: - - { 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: "master", es_data_dir: "/opt/elasticsearch", es_heap_size: "1g", 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: es_scripts: true diff --git a/test/integration/multi/serverspec/default_spec.rb b/test/integration/multi/serverspec/default_spec.rb index 6d09358..3447f4a 100644 --- a/test/integration/multi/serverspec/default_spec.rb +++ b/test/integration/multi/serverspec/default_spec.rb @@ -52,7 +52,7 @@ context "basic tests" do 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.data: /opt/elasticsearch/localhost-master' } it { should contain 'path.work: /tmp/elasticsearch/localhost-master' } it { should contain 'path.logs: /var/log/elasticsearch/localhost-master' } end @@ -146,5 +146,19 @@ context "basic tests" do it { should be_owned_by 'elasticsearch' } end + #Confirm that the data directory has only been set for the first node + describe file('/opt/elasticsearch/localhost-master') do + it { should be_directory } + it { should be_owned_by 'elasticsearch' } + end + + describe file('/opt/elasticsearch/localhost-node1') do + it { should_not exist } + end + + describe file('/var/lib/elasticsearch/localhost-node1') do + it { should be_directory } + it { should be_owned_by 'elasticsearch' } + end end