WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit cfafdd5

Browse files
Adds integration test for the _health_report and _node/plugins APIs. (#18306) (#18310)
* Adds integration test for the _health_report API. * Add _node/plugins API integration test. (cherry picked from commit 08f4c52) Co-authored-by: Mashhur <[email protected]>
1 parent 1080595 commit cfafdd5

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

qa/integration/services/monitoring_api.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,14 @@ def logging_reset
7474
resp = Manticore.put("http://localhost:#{@port}/_node/logging/reset", {headers: {"Content-Type" => "application/json"}}).body
7575
JSON.parse(resp)
7676
end
77+
78+
def health_report
79+
resp = Manticore.get("http://localhost:#{@port}/_health_report").body
80+
JSON.parse(resp)
81+
end
82+
83+
def node_plugins
84+
resp = Manticore.get("http://localhost:#{@port}/_node/plugins").body
85+
JSON.parse(resp)
86+
end
7787
end

qa/integration/specs/monitoring_api_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,42 @@
205205
end
206206
end
207207

208+
it 'retrieves health report' do
209+
logstash_service = @fixture.get_service("logstash")
210+
logstash_service.start_with_stdin
211+
logstash_service.wait_for_logstash
212+
Stud.try(max_retry.times, [StandardError, RSpec::Expectations::ExpectationNotMetError]) do
213+
# health_report can fail if the subsystem isn't ready
214+
result = logstash_service.monitoring_api.health_report rescue nil
215+
expect(result).not_to be_nil
216+
expect(result).to be_a(Hash)
217+
expect(result).to include("status")
218+
expect(result["status"]).to match(/^(green|yellow|red)$/)
219+
end
220+
end
221+
222+
it 'retrieves node plugins information' do
223+
logstash_service = @fixture.get_service("logstash")
224+
logstash_service.start_with_stdin
225+
logstash_service.wait_for_logstash
226+
Stud.try(max_retry.times, [StandardError, RSpec::Expectations::ExpectationNotMetError]) do
227+
# node_plugins can fail if the subsystem isn't ready
228+
result = logstash_service.monitoring_api.node_plugins rescue nil
229+
expect(result).not_to be_nil
230+
expect(result).to be_a(Hash)
231+
expect(result).to include("plugins")
232+
plugins = result["plugins"]
233+
expect(plugins).to be_a(Array)
234+
expect(plugins.size).to be > 0
235+
# verify plugin structure and that stdin plugin is present
236+
stdin_plugin = plugins.find { |p| p["name"] == "logstash-input-stdin" }
237+
expect(stdin_plugin).not_to be_nil
238+
expect(stdin_plugin).to include("name")
239+
expect(stdin_plugin["name"]).to eq("logstash-input-stdin")
240+
expect(stdin_plugin).to include("version")
241+
end
242+
end
243+
208244
shared_examples "pipeline metrics" do
209245
# let(:pipeline_id) { defined?(super()) or fail NotImplementedError }
210246
let(:settings_overrides) do

0 commit comments

Comments
 (0)