Simpler restart handling + issue-test for recreation of problems
This commit is contained in:
parent
2c69fbcb40
commit
5e1873ca68
10 changed files with 43 additions and 2 deletions
|
|
@ -110,4 +110,10 @@ suites:
|
||||||
attributes:
|
attributes:
|
||||||
provisioner:
|
provisioner:
|
||||||
playbook: test/integration/xpack-standard.yml
|
playbook: test/integration/xpack-standard.yml
|
||||||
|
idempotency_test: true
|
||||||
|
- name: issue-test
|
||||||
|
run_list:
|
||||||
|
attributes:
|
||||||
|
provisioner:
|
||||||
|
playbook: test/integration/issue-test.yml
|
||||||
idempotency_test: true
|
idempotency_test: true
|
||||||
|
|
@ -9,5 +9,4 @@
|
||||||
when:
|
when:
|
||||||
- es_restart_on_change
|
- es_restart_on_change
|
||||||
- es_start_service
|
- es_start_service
|
||||||
- ((plugin_installed is defined and plugin_installed.changed) or (config_updated is defined and config_updated.changed) or (xpack_state.changed) or (debian_elasticsearch_install_from_repo.changed or redhat_elasticsearch_install_from_repo.changed or elasticsearch_install_from_package.changed))
|
|
||||||
register: es_restarted
|
register: es_restarted
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
apt: name=elasticsearch{% if es_version is defined and es_version != "" %}={{ es_version }}{% endif %} state=present force={{force_install}} allow_unauthenticated={{ 'no' if es_apt_key else 'yes' }} cache_valid_time=86400
|
apt: name=elasticsearch{% if es_version is defined and es_version != "" %}={{ es_version }}{% endif %} state=present force={{force_install}} allow_unauthenticated={{ 'no' if es_apt_key else 'yes' }} cache_valid_time=86400
|
||||||
when: es_use_repository
|
when: es_use_repository
|
||||||
register: debian_elasticsearch_install_from_repo
|
register: debian_elasticsearch_install_from_repo
|
||||||
|
notify: restart elasticsearch
|
||||||
|
|
||||||
- name: Debian - Download elasticsearch from url
|
- name: Debian - Download elasticsearch from url
|
||||||
get_url: url={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.deb{% endif %} dest=/tmp/elasticsearch-{{ es_version }}.deb validate_certs=no
|
get_url: url={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.deb{% endif %} dest=/tmp/elasticsearch-{{ es_version }}.deb validate_certs=no
|
||||||
|
|
@ -37,3 +38,4 @@
|
||||||
apt: deb=/tmp/elasticsearch-{{ es_version }}.deb
|
apt: deb=/tmp/elasticsearch-{{ es_version }}.deb
|
||||||
when: not es_use_repository
|
when: not es_use_repository
|
||||||
register: elasticsearch_install_from_package
|
register: elasticsearch_install_from_package
|
||||||
|
notify: restart elasticsearch
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
yum: name=elasticsearch{% if es_version is defined and es_version != "" %}-{{ es_version }}{% endif %} state=present update_cache=yes
|
yum: name=elasticsearch{% if es_version is defined and es_version != "" %}-{{ es_version }}{% endif %} state=present update_cache=yes
|
||||||
when: es_use_repository
|
when: es_use_repository
|
||||||
register: redhat_elasticsearch_install_from_repo
|
register: redhat_elasticsearch_install_from_repo
|
||||||
|
notify: restart elasticsearch
|
||||||
until: '"failed" not in redhat_elasticsearch_install_from_repo'
|
until: '"failed" not in redhat_elasticsearch_install_from_repo'
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 10
|
delay: 10
|
||||||
|
|
@ -23,3 +24,4 @@
|
||||||
yum: name={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.noarch.rpm{% endif %} state=present
|
yum: name={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.noarch.rpm{% endif %} state=present
|
||||||
when: not es_use_repository
|
when: not es_use_repository
|
||||||
register: elasticsearch_install_from_package
|
register: elasticsearch_install_from_package
|
||||||
|
notify: restart elasticsearch
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#Copy the config template
|
#Copy the config template
|
||||||
- name: Copy Configuration File
|
- name: Copy Configuration File
|
||||||
template: src=elasticsearch.yml.j2 dest={{conf_dir}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
template: src=elasticsearch.yml.j2 dest={{conf_dir}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
||||||
register: config_updated
|
register: system_change
|
||||||
notify: restart elasticsearch
|
notify: restart elasticsearch
|
||||||
|
|
||||||
#Copy the instance specific default file
|
#Copy the instance specific default file
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
#Add the elasticsearch user before installing from packages.
|
#Add the elasticsearch user before installing from packages.
|
||||||
- name: Ensure optional elasticsearch group is created with the correct id.
|
- name: Ensure optional elasticsearch group is created with the correct id.
|
||||||
|
#Restart if these change
|
||||||
|
notify: restart elasticsearch
|
||||||
group:
|
group:
|
||||||
state: present
|
state: present
|
||||||
name: "{{ es_group }}"
|
name: "{{ es_group }}"
|
||||||
|
|
@ -8,6 +10,8 @@
|
||||||
gid: "{{ es_group_id }}"
|
gid: "{{ es_group_id }}"
|
||||||
|
|
||||||
- name: Ensure optional elasticsearch user is created with the correct id.
|
- name: Ensure optional elasticsearch user is created with the correct id.
|
||||||
|
#Restart if these change
|
||||||
|
notify: restart elasticsearch
|
||||||
user:
|
user:
|
||||||
state: present
|
state: present
|
||||||
name: "{{ es_user }}"
|
name: "{{ es_user }}"
|
||||||
|
|
|
||||||
8
test/integration/helpers/serverspec/issue_test_spec.rb
Normal file
8
test/integration/helpers/serverspec/issue_test_spec.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
shared_examples 'issue_test::init' do |es_version,plugins|
|
||||||
|
|
||||||
|
#Add custom tests here for the issue-test.yml test
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
12
test/integration/issue-test.yml
Normal file
12
test/integration/issue-test.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#This file is for users to test issues and reproduce them using the test framework.
|
||||||
|
#Modify the playbook below and test with kitchen i.e. `kitchen test issue-test`
|
||||||
|
#To add custom tests modify the serverspec file ./helpers/serverspec/issue_test_spec.rb
|
||||||
|
#Idempot test is enabled for this test
|
||||||
|
- name: Simple Example
|
||||||
|
hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
roles:
|
||||||
|
- { role: elasticsearch, es_instance_name: "node1" }
|
||||||
|
vars:
|
||||||
2
test/integration/issue-test/issue-test.yml
Normal file
2
test/integration/issue-test/issue-test.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
- host: test-kitchen
|
||||||
6
test/integration/issue-test/serverspec/default_spec.rb
Normal file
6
test/integration/issue-test/serverspec/default_spec.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
require 'issue_test_spec'
|
||||||
|
|
||||||
|
describe 'Issue Test' do
|
||||||
|
include_examples 'issue_test::init', "5.5.1", []
|
||||||
|
end
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue