Skip to content

Commit f7a8a73

Browse files
committed
Adds integration test for the _health_report API.
1 parent 8f4014b commit f7a8a73

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

qa/integration/services/monitoring_api.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ 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
7782
end

qa/integration/specs/monitoring_api_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,20 @@
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+
208222
shared_examples "pipeline metrics" do
209223
# let(:pipeline_id) { defined?(super()) or fail NotImplementedError }
210224
let(:settings_overrides) do

0 commit comments

Comments
 (0)