-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit dd1f6dd) Co-authored-by: Mashhur <[email protected]>
- Loading branch information
1 parent
9d94258
commit 03fad21
Showing
1 changed file
with
14 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,22 @@ | ||
shared_examples_for 'a container with xpack features' do |flavor| | ||
context 'when configuring xpack settings' do | ||
before do | ||
@image = find_image(flavor) | ||
@container = start_container(@image, {'ENV' => env}) | ||
end | ||
|
||
after do | ||
cleanup_container(@container) | ||
end | ||
|
||
context 'when disabling xpack monitoring' do | ||
let(:env) {['xpack.monitoring.enabled=false']} | ||
|
||
it 'should set monitoring to false' do | ||
expect(get_settings(@container)['xpack.monitoring.enabled']).to be_falsey | ||
end | ||
end | ||
|
||
context 'when enabling xpack monitoring' do | ||
let(:env) {['xpack.monitoring.enabled=true']} | ||
before do | ||
@image = find_image(flavor) | ||
@container = start_container(@image, {'ENV' => env}) | ||
end | ||
|
||
it 'should set monitoring to true' do | ||
expect(get_settings(@container)['xpack.monitoring.enabled']).to be_truthy | ||
end | ||
end | ||
after do | ||
cleanup_container(@container) | ||
end | ||
|
||
context 'when setting elasticsearch urls as an array' do | ||
let(:env) { ['xpack.monitoring.elasticsearch.hosts=["http://node1:9200","http://node2:9200"]']} | ||
context 'when configuring xpack settings' do | ||
let(:env) { %w(xpack.monitoring.enabled=false xpack.monitoring.elasticsearch.hosts=["http://node1:9200","http://node2:9200"]) } | ||
|
||
it 'should set set the hosts property correctly' do | ||
expect(get_settings(@container)['xpack.monitoring.elasticsearch.hosts']).to be_an(Array) | ||
expect(get_settings(@container)['xpack.monitoring.elasticsearch.hosts']).to include('http://node1:9200') | ||
expect(get_settings(@container)['xpack.monitoring.elasticsearch.hosts']).to include('http://node2:9200') | ||
end | ||
it 'persists monitoring environment var keys' do | ||
# persisting actual value of the environment keys bring the issue where keystore looses its power | ||
# visit https://github.com/elastic/logstash/issues/15766 for details | ||
expect(get_settings(@container)['xpack.monitoring.enabled']).to eq("${xpack.monitoring.enabled}") | ||
expect(get_settings(@container)['xpack.monitoring.elasticsearch.hosts']).to eq("${xpack.monitoring.elasticsearch.hosts}") | ||
end | ||
end | ||
end |