More tests
This commit is contained in:
parent
5353524137
commit
605baf9a96
2 changed files with 30 additions and 4 deletions
|
|
@ -10,7 +10,25 @@
|
||||||
shell: find . -maxdepth 1 -type f | sed "s#\./##" | sed "s/.json//" chdir=/etc/elasticsearch/templates
|
shell: find . -maxdepth 1 -type f | sed "s#\./##" | sed "s/.json//" chdir=/etc/elasticsearch/templates
|
||||||
register: resultstemplate
|
register: resultstemplate
|
||||||
|
|
||||||
#The basic auth details here may not be required - send always if they are defined. If not needed they will be ignored.
|
- name: Install templates without auth
|
||||||
- name: Install template(s) with auth
|
uri:
|
||||||
command: "curl -sL -XPUT http://{{es_api_host}}:{{es_api_port}}/_template/{{item}} -d @/etc/elasticsearch/templates/{{item}}.json {% if es_api_basic_auth_username is defined and es_api_basic_auth_password is defined%}-u {{es_api_basic_auth_username}}:{{es_api_basic_auth_password}}{% endif %}"
|
url: http://{{es_api_host}}:{{es_api_port}}/_template/{{item}}
|
||||||
|
method: PUT
|
||||||
|
status_code: 200
|
||||||
|
body_format: json
|
||||||
|
body: "{{ lookup('file', '/etc/elasticsearch/templates/'+item+'.json') }}"
|
||||||
|
when: not es_enable_xpack or not es_xpack_features is defined or not '"shield" in es_xpack_features'
|
||||||
|
with_items: "{{ resultstemplate.stdout_lines }}"
|
||||||
|
|
||||||
|
- name: Install templates with auth
|
||||||
|
uri:
|
||||||
|
url: http://{{es_api_host}}:{{es_api_port}}/_template/{{item}}
|
||||||
|
method: PUT
|
||||||
|
status_code: 200
|
||||||
|
user: "{{es_api_basic_auth_username}}"
|
||||||
|
password: "{{es_api_basic_auth_password}}"
|
||||||
|
force_basic_auth: yes
|
||||||
|
body_format: json
|
||||||
|
body: "{{ lookup('file', '/etc/elasticsearch/templates/'+item+'.json') }}"
|
||||||
|
when: es_enable_xpack and es_xpack_features is defined and '"shield" in es_xpack_features'
|
||||||
with_items: "{{ resultstemplate.stdout_lines }}"
|
with_items: "{{ resultstemplate.stdout_lines }}"
|
||||||
|
|
@ -195,6 +195,14 @@ shared_examples 'xpack::init' do |es_version|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#This is possibly subject to format changes in the response across versions so may fail in the future
|
||||||
|
describe 'Template Contents Correct' do
|
||||||
|
it 'should be reported as being installed', :retry => 3, :retry_wait => 10 do
|
||||||
|
command = command('curl -s "localhost:9200/_template/basic" -u es_admin:changeMe | md5sum')
|
||||||
|
expect(command.stdout).to match(/153b1a45daf48ccee80395b85c61e332/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#Test contents of Elasticsearch.yml file
|
#Test contents of Elasticsearch.yml file
|
||||||
describe file('/etc/elasticsearch/shield_node/elasticsearch.yml') do
|
describe file('/etc/elasticsearch/shield_node/elasticsearch.yml') do
|
||||||
it { should contain 'shield.authc.realms.file1.order: 0' }
|
it { should contain 'shield.authc.realms.file1.order: 0' }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue