Skip to content

Commit

Permalink
Keeps global settings aligned across entities used in the test for St…
Browse files Browse the repository at this point in the history
…atsEventFactory

Fixes a potential flaky test, due to shared (LogStash:SETTINGS) fixture across the test base.


Forward port the commit 609155a used to fix the non clean backport PR #16531 of #16525 to 8.x.

LogStash:SETTINGS is used in the constructor of LogStash::Inputs::Metrics::StatsEventFactory to query the value of api.enabled. This PR keeps updated the value for the setting provided to the Agent constructor and to the StatsEventFactory.
  • Loading branch information
andsel authored Oct 11, 2024
1 parent a931b2c commit 6064587
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
let(:agent_task) { start_agent(agent) }

before :each do
@existing_api_enabled = LogStash::SETTINGS.get_value("api.enabled")
LogStash::SETTINGS.set_value("api.enabled", webserver_enabled)
agent
agent_task

Expand Down Expand Up @@ -86,6 +88,7 @@
after :each do
agent.shutdown
agent_task.wait
LogStash::SETTINGS.set_value("api.enabled", @existing_api_enabled)
LogStash::SETTINGS.set_value("monitoring.enabled", false)
end

Expand Down

0 comments on commit 6064587

Please sign in to comment.