Add test for upgrading from previous version of oss to current
This commit is contained in:
parent
4c35794b76
commit
2c8ce3bb2d
7 changed files with 68 additions and 6 deletions
10
.kitchen.yml
10
.kitchen.yml
|
|
@ -41,7 +41,6 @@ platforms:
|
||||||
use_sudo: false
|
use_sudo: false
|
||||||
volume:
|
volume:
|
||||||
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
||||||
- /etc/elasticsearch
|
|
||||||
- name: ubuntu-16.04
|
- name: ubuntu-16.04
|
||||||
driver_config:
|
driver_config:
|
||||||
image: dliappis/ubuntu-devopsci:16.04
|
image: dliappis/ubuntu-devopsci:16.04
|
||||||
|
|
@ -55,7 +54,6 @@ platforms:
|
||||||
use_sudo: false
|
use_sudo: false
|
||||||
volume:
|
volume:
|
||||||
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
||||||
- /etc/elasticsearch
|
|
||||||
run_command: "/sbin/init"
|
run_command: "/sbin/init"
|
||||||
- name: debian-8
|
- name: debian-8
|
||||||
driver_config:
|
driver_config:
|
||||||
|
|
@ -71,7 +69,6 @@ platforms:
|
||||||
- pip uninstall -y ansible
|
- pip uninstall -y ansible
|
||||||
volume:
|
volume:
|
||||||
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
||||||
- /etc/elasticsearch
|
|
||||||
use_sudo: false
|
use_sudo: false
|
||||||
run_command: "/sbin/init"
|
run_command: "/sbin/init"
|
||||||
- name: centos-7
|
- name: centos-7
|
||||||
|
|
@ -88,7 +85,6 @@ platforms:
|
||||||
- pip install jmespath
|
- pip install jmespath
|
||||||
volume:
|
volume:
|
||||||
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
- <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json
|
||||||
- /etc/elasticsearch
|
|
||||||
run_command: "/usr/sbin/init"
|
run_command: "/usr/sbin/init"
|
||||||
privileged: true
|
privileged: true
|
||||||
use_sudo: false
|
use_sudo: false
|
||||||
|
|
@ -133,3 +129,9 @@ suites:
|
||||||
provisioner:
|
provisioner:
|
||||||
playbook: test/integration/issue-test.yml
|
playbook: test/integration/issue-test.yml
|
||||||
idempotency_test: false
|
idempotency_test: false
|
||||||
|
- name: oss-upgrade
|
||||||
|
run_list:
|
||||||
|
attributes:
|
||||||
|
provisioner:
|
||||||
|
playbook: test/integration/oss-upgrade.yml
|
||||||
|
idempotency_test: false
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,29 @@
|
||||||
content: ''
|
content: ''
|
||||||
when: ansible_os_family == 'RedHat'
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- name: Delete Default Sysconfig File
|
- name: Check if default systemd file exists
|
||||||
|
stat:
|
||||||
|
path: "{{ sysd_script }}"
|
||||||
|
register: sysd_stat_result
|
||||||
|
|
||||||
|
- name: Remove if it is a normal file
|
||||||
|
file:
|
||||||
|
path: "{{ sysd_script }}"
|
||||||
|
state: absent
|
||||||
|
when: not sysd_stat_result.stat.islnk
|
||||||
|
|
||||||
|
- name: Create a symbolic link to the default systemd location to the first instance running on this host
|
||||||
become: yes
|
become: yes
|
||||||
file: dest="{{ sysd_script }}" state=absent
|
file:
|
||||||
|
state: link
|
||||||
|
src: "{{ instance_sysd_script }}"
|
||||||
|
path: "{{ sysd_script }}"
|
||||||
|
when:
|
||||||
|
- use_system_d
|
||||||
|
- not sysd_stat_result.stat.islnk
|
||||||
|
notify:
|
||||||
|
- reload systemd configuration
|
||||||
|
- restart elasticsearch
|
||||||
|
|
||||||
- name: Delete Default Configuration File
|
- name: Delete Default Configuration File
|
||||||
become: yes
|
become: yes
|
||||||
|
|
|
||||||
9
test/integration/helpers/serverspec/oss_upgrade_spec.rb
Normal file
9
test/integration/helpers/serverspec/oss_upgrade_spec.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
shared_examples 'oss_upgrade::init' do |vars|
|
||||||
|
describe 'version check' do
|
||||||
|
it 'should be reported as version '+vars['es_version'] do
|
||||||
|
expect(curl_json('http://localhost:9200')['version']['number']).to eq(vars['es_version'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
21
test/integration/oss-upgrade.yml
Normal file
21
test/integration/oss-upgrade.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
- name: Standard test for single node setup. Tests idempotence.
|
||||||
|
hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- include: elasticsearch/test/integration/debug.yml
|
||||||
|
roles:
|
||||||
|
- { role: elasticsearch, es_instance_name: "node1" }
|
||||||
|
vars:
|
||||||
|
es_version: "{{ '6.2.4' if es_major_version == '6.x' else '5.6.9' }}" # This is set to an older version than the current default to force an upgrade
|
||||||
|
es_enable_xpack: false
|
||||||
|
es_heap_size: "1g"
|
||||||
|
|
||||||
|
- name: Standard test for single node setup. Tests idempotence.
|
||||||
|
hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- include: elasticsearch/test/integration/debug.yml
|
||||||
|
roles:
|
||||||
|
- { role: elasticsearch, es_instance_name: "node1" }
|
||||||
|
vars:
|
||||||
|
es_enable_xpack: false
|
||||||
|
es_heap_size: "1g"
|
||||||
2
test/integration/oss-upgrade/oss-upgrade.yml
Normal file
2
test/integration/oss-upgrade/oss-upgrade.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
- host: test-kitchen
|
||||||
7
test/integration/oss-upgrade/serverspec/default_spec.rb
Normal file
7
test/integration/oss-upgrade/serverspec/default_spec.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'oss_upgrade_spec'
|
||||||
|
require 'json'
|
||||||
|
vars = JSON.parse(File.read('/tmp/vars.json'))
|
||||||
|
|
||||||
|
describe 'oss upgrade Tests' do
|
||||||
|
include_examples 'oss_upgrade::init', vars
|
||||||
|
end
|
||||||
|
|
@ -14,3 +14,4 @@ TEST_TYPE:
|
||||||
- xpack
|
- xpack
|
||||||
- xpack-standard
|
- xpack-standard
|
||||||
- issue-test
|
- issue-test
|
||||||
|
- oss-upgrade
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue