[xpack] use elasticsearch default xpack features (#560)
- Stop forcing es_xpack_features variable in order to let elasticsearch install default features described in http://localhost:9200/_xpack - Change xpack test scope to be able to test default xpack install - xpack scenario will test xpack install with default features - xpack upgrade scenario will fully test security feature - oss-to-xpack-upgrade will test installing only other specific features - Cleanup some duplicate serverspec tests - Remove `system_key`feature (deprecated in 5.6 and removed in 6.0 - [Breaking Changes 6.0.0](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking-6.0.0-xes.html)) - Cleanup some ansible code (especially in `when` conditions)
This commit is contained in:
parent
5e99299637
commit
a879b74def
19 changed files with 70 additions and 92 deletions
|
|
@ -16,13 +16,7 @@ shared_examples 'multi::init' do |vars|
|
|||
else
|
||||
it { should contain 'transport.tcp.port: 9301' }
|
||||
end
|
||||
it { should contain 'node.data: true' }
|
||||
it { should contain 'node.master: false' }
|
||||
it { should contain "node.name: localhost-#{vars['es_instance_name']}" }
|
||||
it { should_not contain 'bootstrap.memory_lock: true' }
|
||||
it { should_not contain "path.conf: /etc/elasticsearch/#{vars['es_instance_name']}" }
|
||||
it { should contain "path.data: /opt/elasticsearch/data-1/localhost-#{vars['es_instance_name']},/opt/elasticsearch/data-2/localhost-#{vars['es_instance_name']}" }
|
||||
it { should contain "path.logs: /var/log/elasticsearch/localhost-#{vars['es_instance_name']}" }
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,22 @@ es_api_url = "http://localhost:#{vars['es_api_port']}"
|
|||
username = vars['es_api_basic_auth_username']
|
||||
password = vars['es_api_basic_auth_password']
|
||||
|
||||
# Sample of default features status
|
||||
features = {
|
||||
'monitoring' => {
|
||||
'enabled' => 'true',
|
||||
'available' => 'true'
|
||||
},
|
||||
'ml' => {
|
||||
'enabled' => 'true',
|
||||
'available' => 'false'
|
||||
},
|
||||
'sql' => {
|
||||
'enabled' => 'true',
|
||||
'available' => 'true'
|
||||
}
|
||||
}
|
||||
|
||||
shared_examples 'shared::init' do |vars|
|
||||
describe 'version check' do
|
||||
it 'should be reported as version '+vars['es_version'] do
|
||||
|
|
@ -35,12 +51,34 @@ shared_examples 'shared::init' do |vars|
|
|||
it 'xpack should be activated' do
|
||||
expect(curl_json("#{es_api_url}/_license", username=username, password=password)['license']['status']).to eq('active')
|
||||
end
|
||||
features = curl_json("#{es_api_url}/_xpack", username=username, password=password)
|
||||
curl_json("#{es_api_url}/_xpack", username=username, password=password)['features'].each do |feature,values|
|
||||
enabled = vars['es_xpack_features'].include? feature
|
||||
status = if enabled then 'enabled' else 'disabled' end
|
||||
it "the xpack feature '#{feature}' to be #{status}" do
|
||||
expect(values['enabled'] = enabled)
|
||||
if vars.key?('es_xpack_features')
|
||||
curl_json("#{es_api_url}/_xpack", username=username, password=password)['features'].each do |feature,values|
|
||||
enabled = vars['es_xpack_features'].include? feature
|
||||
status = if enabled then 'enabled' else 'disabled' end
|
||||
it "the xpack feature '#{feature}' to be #{status}" do
|
||||
expect(values['enabled'] = enabled)
|
||||
end
|
||||
end
|
||||
else
|
||||
features.each do |feature, status|
|
||||
feature_available = curl_json("#{es_api_url}/_xpack", username=username, password=password)['features'][feature]['available']
|
||||
if feature_available == "true"
|
||||
status = "available"
|
||||
else
|
||||
status = "unavailable"
|
||||
end
|
||||
it "the xpack feature '#{feature}' to be #{status}" do
|
||||
expect(feature_available = status['available'])
|
||||
end
|
||||
feature_enabled = curl_json("#{es_api_url}/_xpack", username=username, password=password)['features'][feature]['enabled']
|
||||
if feature_enabled == "true"
|
||||
status = "enabled"
|
||||
else
|
||||
status = "disabled"
|
||||
end
|
||||
it "the xpack feature '#{feature}' to be #{status}" do
|
||||
expect(feature_available = status['enabled'])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
shared_examples 'xpack::init' do |vars|
|
||||
describe file("/etc/elasticsearch/#{vars['es_instance_name']}/elasticsearch.yml") do
|
||||
it { should contain "node.name: localhost-#{vars['es_instance_name']}" }
|
||||
it { should contain 'cluster.name: elasticsearch' }
|
||||
it { should_not contain "path.conf: /etc/elasticsearch/#{vars['es_instance_name']}" }
|
||||
it { should contain "path.data: /var/lib/elasticsearch/localhost-#{vars['es_instance_name']}" }
|
||||
it { should contain "path.logs: /var/log/elasticsearch/localhost-#{vars['es_instance_name']}" }
|
||||
it { should contain 'xpack.security.enabled: false' }
|
||||
it { should contain 'xpack.watcher.enabled: false' }
|
||||
end
|
||||
end
|
||||
|
|
@ -3,14 +3,6 @@ require 'json'
|
|||
vars = JSON.parse(File.read('/tmp/vars.json'))
|
||||
|
||||
shared_examples 'xpack_upgrade::init' do |vars|
|
||||
describe file("/etc/elasticsearch/#{vars['es_instance_name']}/elasticsearch.yml") do
|
||||
it { should contain "node.name: localhost-#{vars['es_instance_name']}" }
|
||||
it { should contain 'cluster.name: elasticsearch' }
|
||||
it { should_not contain "path.conf: /etc/elasticsearch/#{vars['es_instance_name']}" }
|
||||
it { should contain "path.data: /var/lib/elasticsearch/localhost-#{vars['es_instance_name']}" }
|
||||
it { should contain "path.logs: /var/log/elasticsearch/localhost-#{vars['es_instance_name']}" }
|
||||
end
|
||||
|
||||
#Test users file, users_roles and roles.yml
|
||||
describe file("/etc/elasticsearch/#{vars['es_instance_name']}#{vars['es_xpack_conf_subdir']}/users_roles") do
|
||||
it { should be_owned_by 'elasticsearch' }
|
||||
|
|
@ -39,7 +31,7 @@ shared_examples 'xpack_upgrade::init' do |vars|
|
|||
it { should contain 'security.authc.realms.file1.order: 0' }
|
||||
it { should contain 'security.authc.realms.file1.type: file' }
|
||||
it { should contain 'security.authc.realms.native1.order: 1' }
|
||||
it { should contain 'security.authc.realms.native1.type: native' }
|
||||
it { should contain 'security.authc.realms.native1.type: native' }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue