Skip to content

Commit

Permalink
Added allow legacy flag to expose montoring section in API
Browse files Browse the repository at this point in the history
  • Loading branch information
andsel committed Oct 23, 2024
1 parent 2e90f14 commit 8abc793
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def http_address

private
def enabled_xpack_monitoring?
LogStash::SETTINGS.get_value("allow.legacy.monitoring") &&
LogStash::SETTINGS.registered?("xpack.monitoring.enabled") &&
LogStash::SETTINGS.get("xpack.monitoring.enabled")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,22 @@ def registerIfNot(setting)
)
end

it "check monitoring exist when monitoring is enabled" do
it "check monitoring section exist when legacy monitoring is enabled and allowed" do
LogStash::SETTINGS.set_value("allow.legacy.monitoring", true)
LogStash::SETTINGS.set_value("xpack.monitoring.enabled", true)
expect(report.keys).to include(
:monitoring
)
end

it "check monitoring section does not appear when legacy monitoring is not allowed but enabled" do
LogStash::SETTINGS.set_value("allow.legacy.monitoring", false)
LogStash::SETTINGS.set_value("xpack.monitoring.enabled", true)
expect(report.keys).not_to include(
:monitoring
)
end

it "check monitoring does not appear when not enabled and nor cluster_uuid is defined" do
LogStash::SETTINGS.set_value("xpack.monitoring.enabled", false)
LogStash::SETTINGS.get_setting("monitoring.cluster_uuid").reset
Expand Down

0 comments on commit 8abc793

Please sign in to comment.