Skip to content

Commit 3206f90

Browse files
yaauiekares
authored andcommitted
specs: don't start ES connection pool when only validating config
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.
1 parent a5378af commit 3206f90

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

x-pack/spec/license_checker/license_reader_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
LogStash::Helpers::ElasticsearchOptions.es_options_from_settings('monitoring', system_settings)
3838
end
3939

40+
before(:each) do
41+
# We do _not_ want the client's connection pool to start on initialization, as error conditions
42+
# from accidentally succeeding at establishing a connection to an HTTP resource that's not actually
43+
# a live Elasticsearch (e.g., reaped cloud instance) can cause errors.
44+
allow_any_instance_of(LogStash::Outputs::ElasticSearch::HttpClient::Pool).to receive(:start)
45+
end
46+
4047
subject { described_class.new(system_settings, 'monitoring', elasticsearch_options) }
4148

4249
describe '#fetch_xpack_info' do

0 commit comments

Comments
 (0)