2.0 Support + Plugin Directory Support + Supporting Tests + Defaults Change

This commit is contained in:
Dale McDiarmid 2015-12-13 22:46:50 +00:00
parent 1034995899
commit 86f2bd9a2d
40 changed files with 297 additions and 113 deletions

View file

@ -0,0 +1,6 @@
require 'config_spec'
describe 'Config Tests v 1.x' do
include_examples 'config::init', "1.7.3"
end

View file

@ -0,0 +1,6 @@
require 'config_spec'
describe 'Config Tests v 2.x' do
include_examples 'config::init', "2.1.0"
end

View file

@ -1,2 +0,0 @@
require 'serverspec'
set :backend, :exec

View file

@ -1,6 +1,6 @@
require 'spec_helper'
context "basic tests" do
shared_examples 'config::init' do |es_version|
describe user('elasticsearch') do
it { should exist }
@ -61,7 +61,7 @@ context "basic tests" do
end
#test we started on the correct port was used
describe command('curl -s "localhost:9201" | grep status') do
describe command('curl -s "localhost:9201"') do
#TODO: This is returning an empty string
#its(:stdout) { should match /\"status\" : 200/ }
its(:exit_status) { should eq 0 }
@ -73,5 +73,20 @@ context "basic tests" do
its(:exit_status) { should eq 0 }
end
describe 'version check' do
it 'should be reported as version '+es_version do
command = command('curl -s localhost:9201 | grep number')
expect(command.stdout).to match(es_version)
expect(command.exit_status).to eq(0)
end
end
#Not copied on Debian 8
#describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
# it { should be_file }
# it { should contain 'LimitMEMLOCK=infinity' }
#end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
context "basic tests" do
shared_examples 'multi::init' do |es_version|
describe user('elasticsearch') do
it { should exist }
@ -155,6 +155,33 @@ context "basic tests" do
its(:exit_status) { should eq 0 }
end
describe 'version check on master' 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 'version check on data' do
it 'should be reported as version '+es_version do
command = command('curl -s localhost:9201 | grep number')
expect(command.stdout).to match(es_version)
expect(command.exit_status).to eq(0)
end
end
#Test server spec file has been created and modified
#describe file('/usr/lib/systemd/system/master_elasticsearch.service') do
# it { should be_file }
# it { should contain 'LimitMEMLOCK=infinity' }
#end
#describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
# it { should be_file }
# it { should_not contain 'LimitMEMLOCK=infinity' }
#end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
context "basic tests" do
shared_examples 'package::init' do |es_version,plugins|
describe user('elasticsearch') do
it { should exist }
@ -23,6 +23,8 @@ context "basic tests" do
it { should be_owned_by 'elasticsearch' }
end
describe file('/etc/elasticsearch/node1/scripts/calculate-score.groovy') do
it { should be_file }
it { should be_owned_by 'elasticsearch' }
@ -52,5 +54,33 @@ context "basic tests" do
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('/usr/share/elasticsearch/plugins/node1') do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
for plugin in plugins
describe file('/usr/share/elasticsearch/plugins/node1/'+plugin) do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true | grep '+plugin) do
its(:exit_status) { should eq 0 }
end
end
#path.plugins: /usr/share/elasticsearch/plugins/node1
end

View file

@ -8,4 +8,4 @@ RSpec.configure do |config|
config.verbose_retry = true
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
context "basic tests" do
shared_examples 'standard::init' do |es_version|
describe user('elasticsearch') do
it { should exist }
@ -39,10 +39,10 @@ context "basic tests" do
end
end
describe 'plugin' do
it 'should be reported as existing', :retry => 3, :retry_wait => 10 do
command = command('curl -s localhost:9200/_nodes/?plugin | grep kopf')
expect(command.stdout).to match(/kopf/)
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

View file

@ -0,0 +1,6 @@
require 'multi_spec'
describe 'Multi Tests v 1.x' do
include_examples 'multi::init', "1.7.3"
end

View file

@ -0,0 +1,8 @@
require 'multi_spec'
describe 'Multi Tests v 2.x' do
include_examples 'multi::init', "2.1.0"
end

View file

@ -1,2 +0,0 @@
require 'serverspec'
set :backend, :exec

View file

@ -0,0 +1,2 @@
---
- host: test-kitchen

View file

@ -0,0 +1,5 @@
require 'package_spec'
describe 'Package Tests v 1.x' do
include_examples 'package::init', "1.7.3", ["kopf","marvel"]
end

View file

@ -0,0 +1,2 @@
---
- host: test-kitchen

View file

@ -0,0 +1,6 @@
require 'package_spec'
describe 'Package Tests v 2.x' do
include_examples 'package::init', "2.1.0", ["kopf","license","marvel-agent"]
end

View file

@ -2,7 +2,7 @@
- name: Elasticsearch Package tests
hosts: localhost
roles:
- { role: elasticsearch, es_config: { "discovery.zen.ping.multicast.enabled": true }, es_instance_name: "node1" }
- { role: elasticsearch, es_config: { "http.port": 9200, "transport.tcp.port":9300, discovery.zen.ping.unicast.hosts: "localhost:9300" }, es_instance_name: "node1" }
vars:
es_scripts: true
es_templates: true
es_templates: true

View file

@ -1,2 +0,0 @@
require 'serverspec'
set :backend, :exec

View file

@ -0,0 +1,8 @@
require 'standard_spec'
describe 'Standard Tests v 1.x' do
include_examples 'standard::init', "1.7.3"
end

View file

@ -0,0 +1,2 @@
---
- host: test-kitchen

View file

@ -0,0 +1,9 @@
require 'standard_spec'
describe 'Standard Tests v 2.x' do
include_examples 'standard::init', "2.1.0"
end

View file

@ -0,0 +1,2 @@
---
- host: test-kitchen

View file

@ -4,7 +4,4 @@
roles:
- { role: elasticsearch, es_instance_name: "node1" }
vars:
es_use_repository: "true"
es_plugins:
- plugin: lmenezes/elasticsearch-kopf
version: master
es_use_repository: "true"