Skip to content

Commit

Permalink
specs: don't start ES connection pool when only validating config
Browse files Browse the repository at this point in the history
Accidentally succeeding at connecting to an HTTP resource that is not a real,
live Elasticsearch (such as an Elastic Cloud instance that has been shut down
and reaped) can cause client initialization to fail.
  • Loading branch information
yaauie authored and elasticsearch-bot committed Aug 4, 2020
1 parent 7c6fca8 commit bba5e5d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions x-pack/spec/license_checker/license_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
LogStash::Helpers::ElasticsearchOptions.es_options_from_settings('monitoring', system_settings)
end

before(:each) do
# We do _not_ want the client's connection pool to start on initialization, as error conditions
# from accidentally succeeding at establishing a connection to an HTTP resource that's not actually
# a live Elasticsearch (e.g., reaped cloud instance) can cause errors.
allow_any_instance_of(LogStash::Outputs::ElasticSearch::HttpClient::Pool).to receive(:start)
end

subject { described_class.new(system_settings, 'monitoring', elasticsearch_options) }

describe '#fetch_xpack_info' do
Expand Down

0 comments on commit bba5e5d

Please sign in to comment.