diff --git a/test/integration/helpers/serverspec/xpack_spec.rb b/test/integration/helpers/serverspec/xpack_spec.rb index 4812fc6..e12e43e 100644 --- a/test/integration/helpers/serverspec/xpack_spec.rb +++ b/test/integration/helpers/serverspec/xpack_spec.rb @@ -80,10 +80,42 @@ shared_examples 'xpack::init' do |vars| 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' } + # X-Pack is no longer installed as a plugin in elasticsearch + if vars['es_major_version'] == '5.x' + describe file('/usr/share/elasticsearch/plugins') 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 + + 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('/usr/share/elasticsearch/plugins/x-pack') do + it { should be_directory } + it { should be_owned_by 'elasticsearch' } + end + + describe 'xpack plugin' do + it 'should be installed with the correct version' do + plugins = curl_json('http://localhost:9200/_nodes/plugins') + node, data = plugins['nodes'].first + version = 'plugin not found' + name = 'x-pack' + + data['plugins'].each do |plugin| + if plugin['name'] == name + version = plugin['version'] + end + end + expect(version).to eql(vars['es_version']) + end + end end #Test if x-pack is activated @@ -95,25 +127,11 @@ shared_examples 'xpack::init' do |vars| 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 vars['es_plugins'] plugin = plugin['plugin'] diff --git a/test/integration/issue-test.yml b/test/integration/issue-test.yml index 881ba85..5aaaff6 100644 --- a/test/integration/issue-test.yml +++ b/test/integration/issue-test.yml @@ -8,16 +8,14 @@ tasks: - include: elasticsearch/test/integration/debug.yml roles: - - { - role: elasticsearch, - es_config: - { - "xpack.security.authc.realms.file1.type": "file", - "xpack.security.authc.realms.file1.order": 1, - "xpack.security.authc.realms.native1.type": "native", - "xpack.security.authc.realms.native1.order": 0 - }, - es_instance_name: "security_node" } + - role: elasticsearch + es_instance_name: "security_node" + es_config: + xpack.security.enabled: True + xpack.security.authc.realms.file1.type: "file" + xpack.security.authc.realms.file1.order: 1 + xpack.security.authc.realms.native1.type: "native" + xpack.security.authc.realms.native1.order: 0 vars: es_heap_size: "1g" es_enable_xpack: true diff --git a/test/integration/xpack.yml b/test/integration/xpack.yml index 9c53ae2..5668dfd 100644 --- a/test/integration/xpack.yml +++ b/test/integration/xpack.yml @@ -106,9 +106,18 @@ tasks: - include: elasticsearch/test/integration/debug.yml roles: - - { role: elasticsearch, es_api_port: 9200, es_config: { "http.port": 9200, "transport.tcp.port":9300, discovery.zen.ping.unicast.hosts: "localhost:9300", - "xpack.security.authc.realms.file1.type": "file","xpack.security.authc.realms.file1.order": 0, "xpack.security.authc.realms.native1.type": "native","xpack.security.authc.realms.native1.order": 1 }, - es_instance_name: "security_node" } + - role: elasticsearch + es_api_port: 9200 + es_instance_name: "security_node" + es_config: + http.port: 9200 + transport.tcp.port: 9300 + discovery.zen.ping.unicast.hosts: "localhost:9300" + xpack.security.enabled: True + xpack.security.authc.realms.file1.type: "file" + xpack.security.authc.realms.file1.order: 0 + xpack.security.authc.realms.native1.type: "native" + xpack.security.authc.realms.native1.order: 1 vars: es_heap_size: "1g" es_templates: true