From 911b2df9ac536fb3200f55fe394dbcf7fce8af9b Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Tue, 15 Aug 2017 14:31:56 +0100 Subject: [PATCH] Test for plugin on standard --- .kitchen.yml | 3 ++- README.md | 2 +- tasks/elasticsearch-plugins.yml | 2 +- .../helpers/serverspec/standard_spec.rb | 14 +++++++++++++- .../standard-5x/serverspec/default_spec.rb | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 1758d83..3727dd4 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -67,8 +67,9 @@ platforms: - rm /etc/yum.repos.d/epel*repo /etc/yum.repos.d/puppetlabs-pc1.repo - yum -y install initscripts - yum clean all + - pip install --upgrade pip - pip install jmespath - - pip uninstall -y ansible + - yum -y remove ansible volume: <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json run_command: "/usr/sbin/init" privileged: true diff --git a/README.md b/README.md index fd65c8b..4ccc642 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Ansible role for 5.x Elasticsearch. Currently this works on Debian and RedHat b * Debian 8 * Centos 7 -The latest Elasticsearch versions of 5.x are actively tested. **Only Ansible versions > 2.2.0 are supported.** +The latest Elasticsearch versions of 5.x are actively tested. **Only Ansible versions > 2.3.2 are supported, as this is currently the only version tested.** ## Usage diff --git a/tasks/elasticsearch-plugins.yml b/tasks/elasticsearch-plugins.yml index 67fb7a4..c3e6366 100644 --- a/tasks/elasticsearch-plugins.yml +++ b/tasks/elasticsearch-plugins.yml @@ -53,7 +53,7 @@ failed_when: "'ERROR' in plugin_installed.stdout" changed_when: plugin_installed.rc == 0 with_items: "{{ es_plugins }}" - when: "{{ item.plugin in plugins_to_install }}" + when: item.plugin in plugins_to_install notify: restart elasticsearch environment: CONF_DIR: "{{ conf_dir }}" diff --git a/test/integration/helpers/serverspec/standard_spec.rb b/test/integration/helpers/serverspec/standard_spec.rb index 6272ed2..1baf571 100644 --- a/test/integration/helpers/serverspec/standard_spec.rb +++ b/test/integration/helpers/serverspec/standard_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -shared_examples 'standard::init' do |es_version| +shared_examples 'standard::init' do |es_version,plugins| describe user('elasticsearch') do it { should exist } @@ -75,5 +75,17 @@ shared_examples 'standard::init' do |es_version| it { should_not exist } end + for plugin in plugins + describe file('/usr/share/elasticsearch/plugins/'+plugin) do + it { should be_directory } + it { should be_owned_by 'elasticsearch' } + end + #confirm plugins are installed and the correct version + describe command('curl -s localhost:9200/_nodes/plugins | grep \'"name":"'+plugin+'","version":"'+es_version+'"\'') do + its(:exit_status) { should eq 0 } + end + end + + end diff --git a/test/integration/standard-5x/serverspec/default_spec.rb b/test/integration/standard-5x/serverspec/default_spec.rb index 22b0976..f219dfc 100644 --- a/test/integration/standard-5x/serverspec/default_spec.rb +++ b/test/integration/standard-5x/serverspec/default_spec.rb @@ -2,7 +2,7 @@ require 'standard_spec' describe 'Standard Tests v 5.x' do - include_examples 'standard::init', "5.2.2" + include_examples 'standard::init', "5.2.2", ["ingest-geoip"] end