This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 855
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
205 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
test/integration/helpers/serverspec/xpack_standard_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
require 'spec_helper' | ||
|
||
shared_examples 'xpack_standard::init' do |es_version,plugins| | ||
|
||
describe user('elasticsearch') do | ||
it { should exist } | ||
end | ||
|
||
describe service('security_node_elasticsearch') do | ||
it { should be_running } | ||
end | ||
|
||
describe package('elasticsearch') do | ||
it { should be_installed } | ||
end | ||
|
||
describe file('/etc/elasticsearch/security_node/elasticsearch.yml') do | ||
it { should be_file } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe file('/etc/elasticsearch/security_node/log4j2.properties') do | ||
it { should be_file } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe file('/etc/elasticsearch/security_node/elasticsearch.yml') do | ||
it { should contain 'node.name: localhost-security_node' } | ||
it { should contain 'cluster.name: elasticsearch' } | ||
it { should contain 'path.conf: /etc/elasticsearch/security_node' } | ||
it { should contain 'path.data: /var/lib/elasticsearch/localhost-security_node' } | ||
it { should contain 'path.logs: /var/log/elasticsearch/localhost-security_node' } | ||
it { should contain 'xpack.security.enabled: false' } | ||
it { should contain 'xpack.watcher.enabled: false' } | ||
|
||
end | ||
|
||
describe 'Node listening' do | ||
it 'listening in port 9200' do | ||
expect(port 9200).to be_listening | ||
end | ||
end | ||
|
||
describe 'version check' do | ||
it 'should be reported as version '+es_version do | ||
command = command('curl -s localhost:9200 | grep number') | ||
expect(command.stdout).to match(es_version) | ||
expect(command.exit_status).to eq(0) | ||
end | ||
end | ||
|
||
describe file('/etc/init.d/elasticsearch') do | ||
it { should_not exist } | ||
end | ||
|
||
describe file('/etc/default/elasticsearch') do | ||
it { should_not exist } | ||
end | ||
|
||
describe file('/etc/sysconfig/elasticsearch') do | ||
it { should_not exist } | ||
end | ||
|
||
describe file('/usr/lib/systemd/system/elasticsearch.service') do | ||
it { should_not exist } | ||
end | ||
|
||
describe file('/etc/elasticsearch/elasticsearch.yml') do | ||
it { should_not exist } | ||
end | ||
|
||
describe file('/etc/elasticsearch/logging.yml') do | ||
it { should_not exist } | ||
end | ||
|
||
#Xpack specific tests | ||
describe file('/usr/share/elasticsearch/plugins') do | ||
it { should be_directory } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
#Test if x-pack is activated | ||
describe 'x-pack activation' do | ||
it 'should be activated and valid' do | ||
command = command('curl -s localhost:9200/_license?pretty=true') | ||
expect(command.stdout).to match('"status" : "active"') | ||
expect(command.exit_status).to eq(0) | ||
end | ||
end | ||
|
||
describe file('/usr/share/elasticsearch/plugins/x-pack') do | ||
it { should be_directory } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true -u es_admin:changeMeAgain | grep x-pack') do | ||
its(:exit_status) { should eq 0 } | ||
end | ||
|
||
describe file('/etc/elasticsearch/security_node/x-pack') do | ||
it { should be_directory } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe file('/usr/share/elasticsearch/plugins/x-pack') do | ||
it { should be_directory } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
for plugin in plugins | ||
describe file('/usr/share/elasticsearch/plugins/'+plugin) do | ||
it { should be_directory } | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe command('curl -s localhost:9200/_nodes/plugins | grep \'"name":"'+plugin+'","version":"'+es_version+'"\'') do | ||
its(:exit_status) { should eq 0 } | ||
end | ||
end | ||
|
||
#Test users file, users_roles and roles.yml | ||
describe file('/etc/elasticsearch/security_node/x-pack/users_roles') do | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe file('/etc/elasticsearch/security_node/x-pack/users') do | ||
it { should be_owned_by 'elasticsearch' } | ||
end | ||
|
||
describe command('curl -s localhost:9200/_xpack') do | ||
its(:stdout_as_json) { should include('features' => include('security' => include('enabled' => false))) } | ||
its(:stdout_as_json) { should include('features' => include('watcher' => include('enabled' => false))) } | ||
its(:stdout_as_json) { should include('features' => include('graph' => include('enabled' => true))) } | ||
its(:stdout_as_json) { should include('features' => include('monitoring' => include('enabled' => true))) } | ||
its(:stdout_as_json) { should include('features' => include('ml' => include('enabled' => true))) } | ||
end | ||
|
||
end | ||
|
5 changes: 5 additions & 0 deletions
5
test/integration/xpack-standard-5x/serverspec/default_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'xpack_standard_spec' | ||
|
||
describe 'Xpack Standard Tests v 5.x' do | ||
include_examples 'xpack_standard::init', "5.5.1", [] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
- host: test-kitchen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#Tests x-pack is idempotent and works when security is not enabled | ||
--- | ||
- name: Elasticsearch Xpack tests - no security and manual download | ||
hosts: localhost | ||
roles: | ||
- { role: elasticsearch, es_api_port: 9200, es_config: { "http.port": 9200, "transport.tcp.port":9300, discovery.zen.ping.unicast.hosts: "localhost:9300" }, es_instance_name: "security_node" } | ||
vars: | ||
es_version: "5.5.1" | ||
es_heap_size: 2g | ||
es_enable_xpack: true | ||
es_xpack_custom_url: "https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.5.1.zip" | ||
es_xpack_features: | ||
- monitoring | ||
- graph | ||
- ml |